| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/ozone/platform/cast/ozone_platform_cast.h" | 5 #include "ui/ozone/platform/cast/ozone_platform_cast.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "chromecast/public/cast_egl_platform.h" | 9 #include "chromecast/public/cast_egl_platform.h" |
| 10 #include "chromecast/public/cast_egl_platform_shlib.h" | 10 #include "chromecast/public/cast_egl_platform_shlib.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 base::ScopedFD OpenClientNativePixmapDevice() const override { | 74 base::ScopedFD OpenClientNativePixmapDevice() const override { |
| 75 return base::ScopedFD(); | 75 return base::ScopedFD(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void InitializeUI() override { | 78 void InitializeUI() override { |
| 79 overlay_manager_.reset(new OverlayManagerCast()); | 79 overlay_manager_.reset(new OverlayManagerCast()); |
| 80 cursor_factory_.reset(new CursorFactoryOzone()); | 80 cursor_factory_.reset(new CursorFactoryOzone()); |
| 81 input_controller_ = CreateStubInputController(); | 81 input_controller_ = CreateStubInputController(); |
| 82 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 82 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| 83 |
| 84 // Enable dummy software rendering support if GPU process disabled |
| 85 // Note: switch is kDisableGpu from content/public/common/content_switches.h |
| 86 if (base::CommandLine::ForCurrentProcess()->HasSwitch("disable-gpu")) |
| 87 surface_factory_.reset(new SurfaceFactoryCast()); |
| 83 } | 88 } |
| 84 void InitializeGPU() override { | 89 void InitializeGPU() override { |
| 85 surface_factory_.reset(new SurfaceFactoryCast(egl_platform_.Pass())); | 90 surface_factory_.reset(new SurfaceFactoryCast(egl_platform_.Pass())); |
| 86 g_gpu_platform_support.Get() = | 91 g_gpu_platform_support.Get() = |
| 87 make_scoped_ptr(new GpuPlatformSupportCast(surface_factory_.get())); | 92 make_scoped_ptr(new GpuPlatformSupportCast(surface_factory_.get())); |
| 88 } | 93 } |
| 89 | 94 |
| 90 private: | 95 private: |
| 91 scoped_ptr<CastEglPlatform> egl_platform_; | 96 scoped_ptr<CastEglPlatform> egl_platform_; |
| 92 scoped_ptr<SurfaceFactoryCast> surface_factory_; | 97 scoped_ptr<SurfaceFactoryCast> surface_factory_; |
| 93 scoped_ptr<CursorFactoryOzone> cursor_factory_; | 98 scoped_ptr<CursorFactoryOzone> cursor_factory_; |
| 94 scoped_ptr<InputController> input_controller_; | 99 scoped_ptr<InputController> input_controller_; |
| 95 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 100 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| 96 scoped_ptr<OverlayManagerOzone> overlay_manager_; | 101 scoped_ptr<OverlayManagerOzone> overlay_manager_; |
| 97 | 102 |
| 98 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCast); | 103 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCast); |
| 99 }; | 104 }; |
| 100 | 105 |
| 101 } // namespace | 106 } // namespace |
| 102 | 107 |
| 103 OzonePlatform* CreateOzonePlatformCast() { | 108 OzonePlatform* CreateOzonePlatformCast() { |
| 104 const std::vector<std::string>& argv = | 109 const std::vector<std::string>& argv = |
| 105 base::CommandLine::ForCurrentProcess()->argv(); | 110 base::CommandLine::ForCurrentProcess()->argv(); |
| 106 scoped_ptr<chromecast::CastEglPlatform> platform( | 111 scoped_ptr<chromecast::CastEglPlatform> platform( |
| 107 chromecast::CastEglPlatformShlib::Create(argv)); | 112 chromecast::CastEglPlatformShlib::Create(argv)); |
| 108 return new OzonePlatformCast(platform.Pass()); | 113 return new OzonePlatformCast(platform.Pass()); |
| 109 } | 114 } |
| 110 | 115 |
| 111 } // namespace ui | 116 } // namespace ui |
| OLD | NEW |