Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef UI_OZONE_PUBLIC_OZONE_PLATFORM_H_ | 5 #ifndef UI_OZONE_PUBLIC_OZONE_PLATFORM_H_ |
| 6 #define UI_OZONE_PUBLIC_OZONE_PLATFORM_H_ | 6 #define UI_OZONE_PUBLIC_OZONE_PLATFORM_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/message_loop/message_loop.h" | |
| 11 #include "ui/ozone/ozone_export.h" | 12 #include "ui/ozone/ozone_export.h" |
| 12 | 13 |
| 13 namespace display { | 14 namespace display { |
| 14 class NativeDisplayDelegate; | 15 class NativeDisplayDelegate; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace gfx { | 18 namespace gfx { |
| 18 class Rect; | 19 class Rect; |
| 19 } | 20 } |
| 20 | 21 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 // must set this parameter in order for the Ozone platform implementation to | 65 // must set this parameter in order for the Ozone platform implementation to |
| 65 // be able to use Mojo. | 66 // be able to use Mojo. |
| 66 service_manager::Connector* connector = nullptr; | 67 service_manager::Connector* connector = nullptr; |
| 67 | 68 |
| 68 // Setting this to true indicates that the platform implementation should | 69 // Setting this to true indicates that the platform implementation should |
| 69 // operate as a single process for platforms (i.e. drm) that are usually | 70 // operate as a single process for platforms (i.e. drm) that are usually |
| 70 // split between a main and gpu specific portion. | 71 // split between a main and gpu specific portion. |
| 71 bool single_process = false; | 72 bool single_process = false; |
| 72 }; | 73 }; |
| 73 | 74 |
| 75 // Creates the OzonePlatform instance without doing any initialization. | |
| 76 // This is useful in order call virtual methods that depend on the ozone | |
| 77 // platform selected at runtime, e.g. ::GetMessageLoopTypeForGpu, | |
|
Ken Russell (switch to Gerrit)
2017/02/08 04:57:45
Document that this is idempotent, and has no effec
tonikitoo
2017/02/08 06:42:08
Done.
| |
| 78 static void CreateInstance(); | |
| 79 | |
| 74 // Initializes the subsystems/resources necessary for the UI process (e.g. | 80 // Initializes the subsystems/resources necessary for the UI process (e.g. |
| 75 // events, etc.) | 81 // events, etc.) |
| 76 // TODO(rjkroege): Remove deprecated entry point (http://crbug.com/620934) | 82 // TODO(rjkroege): Remove deprecated entry point (http://crbug.com/620934) |
| 77 static void InitializeForUI(); | 83 static void InitializeForUI(); |
| 78 | 84 |
| 79 // Initializes the subsystems/resources necessary for the UI process (e.g. | 85 // Initializes the subsystems/resources necessary for the UI process (e.g. |
| 80 // events) with additional properties to customize the ozone platform | 86 // events) with additional properties to customize the ozone platform |
| 81 // implementation. Ozone will not retain InitParams after returning from | 87 // implementation. Ozone will not retain InitParams after returning from |
| 82 // InitalizeForUI. | 88 // InitalizeForUI. |
| 83 static void InitializeForUI(const InitParams& args); | 89 static void InitializeForUI(const InitParams& args); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 101 virtual ui::InputController* GetInputController() = 0; | 107 virtual ui::InputController* GetInputController() = 0; |
| 102 virtual IPC::MessageFilter* GetGpuMessageFilter(); | 108 virtual IPC::MessageFilter* GetGpuMessageFilter(); |
| 103 virtual ui::GpuPlatformSupportHost* GetGpuPlatformSupportHost() = 0; | 109 virtual ui::GpuPlatformSupportHost* GetGpuPlatformSupportHost() = 0; |
| 104 virtual std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() = 0; | 110 virtual std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() = 0; |
| 105 virtual std::unique_ptr<PlatformWindow> CreatePlatformWindow( | 111 virtual std::unique_ptr<PlatformWindow> CreatePlatformWindow( |
| 106 PlatformWindowDelegate* delegate, | 112 PlatformWindowDelegate* delegate, |
| 107 const gfx::Rect& bounds) = 0; | 113 const gfx::Rect& bounds) = 0; |
| 108 virtual std::unique_ptr<display::NativeDisplayDelegate> | 114 virtual std::unique_ptr<display::NativeDisplayDelegate> |
| 109 CreateNativeDisplayDelegate() = 0; | 115 CreateNativeDisplayDelegate() = 0; |
| 110 | 116 |
| 117 // Returns the message loop type required for OzonePlatform instance that | |
| 118 // will be initialized for the GPU process. | |
| 119 virtual base::MessageLoop::Type GetMessageLoopTypeForGpu(); | |
| 120 | |
| 111 // Ozone platform implementations may also choose to expose mojo interfaces to | 121 // Ozone platform implementations may also choose to expose mojo interfaces to |
| 112 // internal functionality. Embedders wishing to take advantage of ozone mojo | 122 // internal functionality. Embedders wishing to take advantage of ozone mojo |
| 113 // implementations must invoke AddInterfaces with a valid | 123 // implementations must invoke AddInterfaces with a valid |
| 114 // service_manager::InterfaceRegistry* pointer to export all Mojo interfaces | 124 // service_manager::InterfaceRegistry* pointer to export all Mojo interfaces |
| 115 // defined within Ozone. | 125 // defined within Ozone. |
| 116 // | 126 // |
| 117 // A default do-nothing implementation is provided to permit platform | 127 // A default do-nothing implementation is provided to permit platform |
| 118 // implementations to opt out of implementing any Mojo interfaces. | 128 // implementations to opt out of implementing any Mojo interfaces. |
| 119 virtual void AddInterfaces(service_manager::InterfaceRegistry* registry); | 129 virtual void AddInterfaces(service_manager::InterfaceRegistry* registry); |
| 120 | 130 |
| 121 private: | 131 private: |
| 122 virtual void InitializeUI() = 0; | 132 virtual void InitializeUI() = 0; |
| 123 virtual void InitializeGPU() = 0; | 133 virtual void InitializeGPU() = 0; |
| 124 virtual void InitializeUI(const InitParams& args); | 134 virtual void InitializeUI(const InitParams& args); |
| 125 virtual void InitializeGPU(const InitParams& args); | 135 virtual void InitializeGPU(const InitParams& args); |
| 126 | 136 |
| 127 static void CreateInstance(); | |
| 128 | |
| 129 static OzonePlatform* instance_; | 137 static OzonePlatform* instance_; |
| 130 | 138 |
| 131 DISALLOW_COPY_AND_ASSIGN(OzonePlatform); | 139 DISALLOW_COPY_AND_ASSIGN(OzonePlatform); |
| 132 }; | 140 }; |
| 133 | 141 |
| 134 } // namespace ui | 142 } // namespace ui |
| 135 | 143 |
| 136 #endif // UI_OZONE_PUBLIC_OZONE_PLATFORM_H_ | 144 #endif // UI_OZONE_PUBLIC_OZONE_PLATFORM_H_ |
| OLD | NEW |