| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return std::move(window); | 84 return std::move(window); |
| 85 } | 85 } |
| 86 | 86 |
| 87 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 87 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
| 88 override { | 88 override { |
| 89 return base::MakeUnique<NativeDisplayDelegateOzoneX11>(); | 89 return base::MakeUnique<NativeDisplayDelegateOzoneX11>(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void InitializeUI() override { | 92 void InitializeUI() override { |
| 93 window_manager_.reset(new X11WindowManagerOzone); | 93 window_manager_.reset(new X11WindowManagerOzone); |
| 94 event_source_.reset(new X11EventSourceLibevent(gfx::GetXDisplay())); | 94 if (!event_source_) |
| 95 event_source_.reset(new X11EventSourceLibevent(gfx::GetXDisplay())); |
| 95 overlay_manager_.reset(new StubOverlayManager()); | 96 overlay_manager_.reset(new StubOverlayManager()); |
| 96 input_controller_ = CreateStubInputController(); | 97 input_controller_ = CreateStubInputController(); |
| 97 cursor_factory_ozone_.reset(new X11CursorFactoryOzone()); | 98 cursor_factory_ozone_.reset(new X11CursorFactoryOzone()); |
| 98 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 99 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| 99 } | 100 } |
| 100 | 101 |
| 101 void InitializeGPU() override { | 102 void InitializeGPU() override { |
| 103 if (!event_source_) |
| 104 event_source_.reset(new X11EventSourceLibevent(gfx::GetXDisplay())); |
| 102 surface_factory_ozone_.reset(new X11SurfaceFactory()); | 105 surface_factory_ozone_.reset(new X11SurfaceFactory()); |
| 103 } | 106 } |
| 104 | 107 |
| 105 private: | 108 private: |
| 106 // Objects in the Browser process. | 109 // Objects in the browser process. |
| 107 std::unique_ptr<X11WindowManagerOzone> window_manager_; | 110 std::unique_ptr<X11WindowManagerOzone> window_manager_; |
| 108 std::unique_ptr<X11EventSourceLibevent> event_source_; | |
| 109 std::unique_ptr<OverlayManagerOzone> overlay_manager_; | 111 std::unique_ptr<OverlayManagerOzone> overlay_manager_; |
| 110 std::unique_ptr<InputController> input_controller_; | 112 std::unique_ptr<InputController> input_controller_; |
| 111 std::unique_ptr<X11CursorFactoryOzone> cursor_factory_ozone_; | 113 std::unique_ptr<X11CursorFactoryOzone> cursor_factory_ozone_; |
| 112 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 114 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| 113 | 115 |
| 114 // Objects in the GPU process. | 116 // Objects in the GPU process. |
| 115 std::unique_ptr<X11SurfaceFactory> surface_factory_ozone_; | 117 std::unique_ptr<X11SurfaceFactory> surface_factory_ozone_; |
| 116 | 118 |
| 119 // Objects in both browser and GPU process. |
| 120 std::unique_ptr<X11EventSourceLibevent> event_source_; |
| 121 |
| 117 DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11); | 122 DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11); |
| 118 }; | 123 }; |
| 119 | 124 |
| 120 } // namespace | 125 } // namespace |
| 121 | 126 |
| 122 OzonePlatform* CreateOzonePlatformX11() { | 127 OzonePlatform* CreateOzonePlatformX11() { |
| 123 return new OzonePlatformX11; | 128 return new OzonePlatformX11; |
| 124 } | 129 } |
| 125 | 130 |
| 126 } // namespace ui | 131 } // namespace ui |
| OLD | NEW |