目录
前言
多年前,谷歌就对外宣布未来将使用Fuchsia OS代替Android OS。原本来以为谷歌就是说说,想炫技而已,证明自己可以开发出比安卓更好用的移动端操作系统(Android毕竟是收购过来的)。
正文
说到谷歌想替换Android,其实也是可以理解的。尽管Android生态是成功的,占据了全球移动市场份额超过80%的份额,但谷歌的商业模式无疑是失败的。尽管谷歌有这把好牌,但自己却没有从中赚到什么钱,很郁闷。所以想通过Fuchsia改变这一现状。
最近没有Fuchsia的消息了,猜想可能是谷歌也打算放弃了。
事实却非如此。
今天走读electron最新的源码,才发现chrome和chromium中都有Fuchsia的影子(之前是没有的),都有不断新增的相关代码,见下图:
文件:src/media/audio/fuchsia/audio_manager_fuchsia.h
源码:
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_AUDIO_FUCHSIA_AUDIO_MANAGER_FUCHSIA_H_
#define MEDIA_AUDIO_FUCHSIA_AUDIO_MANAGER_FUCHSIA_H_
#include "media/audio/audio_manager_base.h"
namespace media {
class AudioManagerFuchsia : public AudioManagerBase {
public:
AudioManagerFuchsia(std::unique_ptr<AudioThread> audio_thread,
AudioLogFactory* audio_log_factory);
~AudioManagerFuchsia() override;
// Implementation of AudioManager.
bool HasAudioOutputDevices() override;
bool HasAudioInputDevices() override;
void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
AudioParameters GetInputStreamParameters(
const std::string& device_id) override;
const char* GetName() override;
// Implementation of AudioManagerBase.
AudioOutputStream* MakeLinearOutputStream(
const AudioParameters& params,
const LogCallback& log_callback) override;
AudioOutputStream* MakeLowLatencyOutputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) override;
AudioInputStream* MakeLinearInputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) override;
AudioInputStream* MakeLowLatencyInputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) override;
protected:
AudioParameters GetPreferredOutputStreamParameters(
const std::string& output_device_id,
const AudioParameters& input_params) override;
private:
DISALLOW_COPY_AND_ASSIGN(AudioManagerFuchsia);
};
} // namespace media
#endif // MEDIA_AUDIO_FUCHSIA_AUDIO_MANAGER_FUCHSIA_H_
另外,过滤器部分也用Fuchsia实现了一份,见下图:
文件:src/media/filters/fuchsia/fuchsia_video_decoder.h
源码:
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_FILTERS_FUCHSIA_FUCHSIA_VIDEO_DECODER_H_
#define MEDIA_FILTERS_FUCHSIA_FUCHSIA_VIDEO_DECODER_H_
#include <memory>
#include "media/base/media_export.h"
namespace gpu {
class ContextSupport;
class SharedImageInterface;
} // namespace gpu
namespace media {
class VideoDecoder;
// Creates VideoDecoder that uses fuchsia.mediacodec API. The returned
// VideoDecoder instance will only try to use hardware video codecs.
// |shared_image_interface| and |gpu_context_support| must outlive the decoder.
MEDIA_EXPORT std::unique_ptr<VideoDecoder> CreateFuchsiaVideoDecoder(
gpu::SharedImageInterface* shared_image_interface,
gpu::ContextSupport* gpu_context_support);
// Same as above, but also allows to enable software codecs. This is useful for
// FuchsiaVideoDecoder tests that run on systems that don't have hardware
// decoder support.
MEDIA_EXPORT std::unique_ptr<VideoDecoder> CreateFuchsiaVideoDecoderForTests(
gpu::SharedImageInterface* shared_image_interface,
gpu::ContextSupport* gpu_context_support,
bool enable_sw_decoding);
} // namespace media
#endif // MEDIA_FILTERS_FUCHSIA_FUCHSIA_VIDEO_DECODER_H_
当然不只这些地方,别的一些模块也都有Fuchsia的渗透。
其实,谷歌对Fuchsia OS倾注了大量的心血。Fuchsia OS是基于Zircon内核(谷歌自家研发的)开发,虽然也是开源系统,但不存在开源污染问题,应用程序可以摆脱虚拟机运行,大幅提升了运行效率,对硬件的要求也大大降低。
结尾
所以说谷歌不是放弃了Android的替代计划,只是进度没有想象的那么顺利。Fuchsia的开发一直在进行中,其实本人也想看看将来Fuchsia真正商业化后,和老大干架的样子。