| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/x11/ozone_platform_x11.h" | 5 #include "ui/ozone/platform/x11/ozone_platform_x11.h" |
| 6 | 6 |
| 7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return std::move(window); | 88 return std::move(window); |
| 89 } | 89 } |
| 90 | 90 |
| 91 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 91 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
| 92 override { | 92 override { |
| 93 return base::WrapUnique(new NativeDisplayDelegateOzone()); | 93 return base::WrapUnique(new NativeDisplayDelegateOzone()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void InitializeUI() override { | 96 void InitializeUI() override { |
| 97 window_manager_.reset(new X11WindowManagerOzone); | 97 window_manager_.reset(new X11WindowManagerOzone); |
| 98 event_source_.reset(new X11EventSourceLibevent(gfx::GetXDisplay())); | 98 if (!event_source_) |
| 99 event_source_.reset(new X11EventSourceLibevent(gfx::GetXDisplay())); |
| 99 overlay_manager_.reset(new StubOverlayManager()); | 100 overlay_manager_.reset(new StubOverlayManager()); |
| 100 input_controller_ = CreateStubInputController(); | 101 input_controller_ = CreateStubInputController(); |
| 101 cursor_factory_ozone_.reset(new X11CursorFactoryOzone()); | 102 cursor_factory_ozone_.reset(new X11CursorFactoryOzone()); |
| 102 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 103 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| 103 } | 104 } |
| 104 | 105 |
| 105 void InitializeGPU() override { | 106 void InitializeGPU() override { |
| 107 if (!event_source_) |
| 108 event_source_.reset(new X11EventSourceLibevent(gfx::GetXDisplay())); |
| 106 surface_factory_ozone_.reset(new X11SurfaceFactory()); | 109 surface_factory_ozone_.reset(new X11SurfaceFactory()); |
| 107 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | 110 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
| 108 } | 111 } |
| 109 | 112 |
| 110 private: | 113 private: |
| 111 // Objects in the Browser process. | 114 // Objects in the Browser process. |
| 112 std::unique_ptr<X11WindowManagerOzone> window_manager_; | 115 std::unique_ptr<X11WindowManagerOzone> window_manager_; |
| 113 std::unique_ptr<X11EventSourceLibevent> event_source_; | |
| 114 std::unique_ptr<OverlayManagerOzone> overlay_manager_; | 116 std::unique_ptr<OverlayManagerOzone> overlay_manager_; |
| 115 std::unique_ptr<InputController> input_controller_; | 117 std::unique_ptr<InputController> input_controller_; |
| 116 std::unique_ptr<X11CursorFactoryOzone> cursor_factory_ozone_; | 118 std::unique_ptr<X11CursorFactoryOzone> cursor_factory_ozone_; |
| 117 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 119 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| 118 | 120 |
| 119 // Objects in the GPU process. | 121 // Objects in the GPU process. |
| 120 std::unique_ptr<X11SurfaceFactory> surface_factory_ozone_; | 122 std::unique_ptr<X11SurfaceFactory> surface_factory_ozone_; |
| 121 std::unique_ptr<GpuPlatformSupport> gpu_platform_support_; | 123 std::unique_ptr<GpuPlatformSupport> gpu_platform_support_; |
| 122 | 124 |
| 125 // Objects in both Browser and GPU process. |
| 126 std::unique_ptr<X11EventSourceLibevent> event_source_; |
| 127 |
| 123 DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11); | 128 DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11); |
| 124 }; | 129 }; |
| 125 | 130 |
| 126 } // namespace | 131 } // namespace |
| 127 | 132 |
| 128 OzonePlatform* CreateOzonePlatformX11() { | 133 OzonePlatform* CreateOzonePlatformX11() { |
| 129 return new OzonePlatformX11; | 134 return new OzonePlatformX11; |
| 130 } | 135 } |
| 131 | 136 |
| 132 } // namespace ui | 137 } // namespace ui |
| OLD | NEW |