| 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 <utility> |
| 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 9 #include "chromecast/public/cast_egl_platform.h" | 11 #include "chromecast/public/cast_egl_platform.h" |
| 10 #include "chromecast/public/cast_egl_platform_shlib.h" | 12 #include "chromecast/public/cast_egl_platform_shlib.h" |
| 11 #include "ui/ozone/common/native_display_delegate_ozone.h" | 13 #include "ui/ozone/common/native_display_delegate_ozone.h" |
| 12 #include "ui/ozone/platform/cast/gpu_platform_support_cast.h" | 14 #include "ui/ozone/platform/cast/gpu_platform_support_cast.h" |
| 13 #include "ui/ozone/platform/cast/overlay_manager_cast.h" | 15 #include "ui/ozone/platform/cast/overlay_manager_cast.h" |
| 14 #include "ui/ozone/platform/cast/platform_window_cast.h" | 16 #include "ui/ozone/platform/cast/platform_window_cast.h" |
| 15 #include "ui/ozone/platform/cast/surface_factory_cast.h" | 17 #include "ui/ozone/platform/cast/surface_factory_cast.h" |
| 16 #include "ui/ozone/public/cursor_factory_ozone.h" | 18 #include "ui/ozone/public/cursor_factory_ozone.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 // Ozone platform implementation for Cast. Implements functionality | 32 // Ozone platform implementation for Cast. Implements functionality |
| 31 // common to all Cast implementations: | 33 // common to all Cast implementations: |
| 32 // - Always one window with window size equal to display size | 34 // - Always one window with window size equal to display size |
| 33 // - No input, cursor support | 35 // - No input, cursor support |
| 34 // - Relinquish GPU resources flow for switching to external applications | 36 // - Relinquish GPU resources flow for switching to external applications |
| 35 // Meanwhile, platform-specific implementation details are abstracted out | 37 // Meanwhile, platform-specific implementation details are abstracted out |
| 36 // to the CastEglPlatform interface. | 38 // to the CastEglPlatform interface. |
| 37 class OzonePlatformCast : public OzonePlatform { | 39 class OzonePlatformCast : public OzonePlatform { |
| 38 public: | 40 public: |
| 39 explicit OzonePlatformCast(scoped_ptr<CastEglPlatform> egl_platform) | 41 explicit OzonePlatformCast(scoped_ptr<CastEglPlatform> egl_platform) |
| 40 : egl_platform_(egl_platform.Pass()) {} | 42 : egl_platform_(std::move(egl_platform)) {} |
| 41 ~OzonePlatformCast() override {} | 43 ~OzonePlatformCast() override {} |
| 42 | 44 |
| 43 // OzonePlatform implementation: | 45 // OzonePlatform implementation: |
| 44 SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { | 46 SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { |
| 45 return surface_factory_.get(); | 47 return surface_factory_.get(); |
| 46 } | 48 } |
| 47 OverlayManagerOzone* GetOverlayManager() override { | 49 OverlayManagerOzone* GetOverlayManager() override { |
| 48 return overlay_manager_.get(); | 50 return overlay_manager_.get(); |
| 49 } | 51 } |
| 50 CursorFactoryOzone* GetCursorFactoryOzone() override { | 52 CursorFactoryOzone* GetCursorFactoryOzone() override { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 80 cursor_factory_.reset(new CursorFactoryOzone()); | 82 cursor_factory_.reset(new CursorFactoryOzone()); |
| 81 input_controller_ = CreateStubInputController(); | 83 input_controller_ = CreateStubInputController(); |
| 82 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 84 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| 83 | 85 |
| 84 // Enable dummy software rendering support if GPU process disabled | 86 // Enable dummy software rendering support if GPU process disabled |
| 85 // Note: switch is kDisableGpu from content/public/common/content_switches.h | 87 // Note: switch is kDisableGpu from content/public/common/content_switches.h |
| 86 if (base::CommandLine::ForCurrentProcess()->HasSwitch("disable-gpu")) | 88 if (base::CommandLine::ForCurrentProcess()->HasSwitch("disable-gpu")) |
| 87 surface_factory_.reset(new SurfaceFactoryCast()); | 89 surface_factory_.reset(new SurfaceFactoryCast()); |
| 88 } | 90 } |
| 89 void InitializeGPU() override { | 91 void InitializeGPU() override { |
| 90 surface_factory_.reset(new SurfaceFactoryCast(egl_platform_.Pass())); | 92 surface_factory_.reset(new SurfaceFactoryCast(std::move(egl_platform_))); |
| 91 g_gpu_platform_support.Get() = | 93 g_gpu_platform_support.Get() = |
| 92 make_scoped_ptr(new GpuPlatformSupportCast(surface_factory_.get())); | 94 make_scoped_ptr(new GpuPlatformSupportCast(surface_factory_.get())); |
| 93 } | 95 } |
| 94 | 96 |
| 95 private: | 97 private: |
| 96 scoped_ptr<CastEglPlatform> egl_platform_; | 98 scoped_ptr<CastEglPlatform> egl_platform_; |
| 97 scoped_ptr<SurfaceFactoryCast> surface_factory_; | 99 scoped_ptr<SurfaceFactoryCast> surface_factory_; |
| 98 scoped_ptr<CursorFactoryOzone> cursor_factory_; | 100 scoped_ptr<CursorFactoryOzone> cursor_factory_; |
| 99 scoped_ptr<InputController> input_controller_; | 101 scoped_ptr<InputController> input_controller_; |
| 100 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 102 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| 101 scoped_ptr<OverlayManagerOzone> overlay_manager_; | 103 scoped_ptr<OverlayManagerOzone> overlay_manager_; |
| 102 | 104 |
| 103 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCast); | 105 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCast); |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 } // namespace | 108 } // namespace |
| 107 | 109 |
| 108 OzonePlatform* CreateOzonePlatformCast() { | 110 OzonePlatform* CreateOzonePlatformCast() { |
| 109 const std::vector<std::string>& argv = | 111 const std::vector<std::string>& argv = |
| 110 base::CommandLine::ForCurrentProcess()->argv(); | 112 base::CommandLine::ForCurrentProcess()->argv(); |
| 111 scoped_ptr<chromecast::CastEglPlatform> platform( | 113 scoped_ptr<chromecast::CastEglPlatform> platform( |
| 112 chromecast::CastEglPlatformShlib::Create(argv)); | 114 chromecast::CastEglPlatformShlib::Create(argv)); |
| 113 return new OzonePlatformCast(platform.Pass()); | 115 return new OzonePlatformCast(std::move(platform)); |
| 114 } | 116 } |
| 115 | 117 |
| 116 } // namespace ui | 118 } // namespace ui |
| OLD | NEW |