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