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 <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 window->Create(); | 85 window->Create(); |
86 return std::move(window); | 86 return std::move(window); |
87 } | 87 } |
88 | 88 |
89 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 89 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
90 return make_scoped_ptr(new NativeDisplayDelegateOzone()); | 90 return make_scoped_ptr(new NativeDisplayDelegateOzone()); |
91 } | 91 } |
92 | 92 |
93 void InitializeUI() override { | 93 void InitializeUI() override { |
94 window_manager_.reset(new X11WindowManagerOzone); | 94 window_manager_.reset(new X11WindowManagerOzone); |
95 event_source_.reset(new X11EventSourceLibevent(gfx::GetXDisplay())); | 95 if (!event_source_) |
96 event_source_.reset(new X11EventSourceLibevent(gfx::GetXDisplay())); | |
96 overlay_manager_.reset(new StubOverlayManager()); | 97 overlay_manager_.reset(new StubOverlayManager()); |
97 input_controller_ = CreateStubInputController(); | 98 input_controller_ = CreateStubInputController(); |
98 cursor_factory_ozone_.reset(new X11CursorFactoryOzone()); | 99 cursor_factory_ozone_.reset(new X11CursorFactoryOzone()); |
99 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 100 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
100 } | 101 } |
101 | 102 |
102 void InitializeGPU() override { | 103 void InitializeGPU() override { |
104 if (!event_source_) | |
sadrul
2016/04/19 14:49:49
The null-check here (and above) implies we may be
kylechar
2016/04/19 16:00:20
Yep. In MUS they are both in the same process.
sadrul
2016/04/19 16:13:37
Oh, that's interesting.
PlatformEventSource (and
| |
105 event_source_.reset(new X11EventSourceLibevent(gfx::GetXDisplay())); | |
103 surface_factory_ozone_.reset(new X11SurfaceFactory()); | 106 surface_factory_ozone_.reset(new X11SurfaceFactory()); |
104 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | 107 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
105 } | 108 } |
106 | 109 |
107 private: | 110 private: |
108 // Objects in the Browser process. | 111 // Objects in the Browser process. |
109 scoped_ptr<X11WindowManagerOzone> window_manager_; | 112 scoped_ptr<X11WindowManagerOzone> window_manager_; |
110 scoped_ptr<X11EventSourceLibevent> event_source_; | |
111 scoped_ptr<OverlayManagerOzone> overlay_manager_; | 113 scoped_ptr<OverlayManagerOzone> overlay_manager_; |
112 scoped_ptr<InputController> input_controller_; | 114 scoped_ptr<InputController> input_controller_; |
113 scoped_ptr<X11CursorFactoryOzone> cursor_factory_ozone_; | 115 scoped_ptr<X11CursorFactoryOzone> cursor_factory_ozone_; |
114 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 116 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
115 | 117 |
116 // Objects in the GPU process. | 118 // Objects in the GPU process. |
117 scoped_ptr<X11SurfaceFactory> surface_factory_ozone_; | 119 scoped_ptr<X11SurfaceFactory> surface_factory_ozone_; |
118 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; | 120 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; |
119 | 121 |
122 // Objects in both Browser and GPU process. | |
123 scoped_ptr<X11EventSourceLibevent> event_source_; | |
124 | |
120 DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11); | 125 DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11); |
121 }; | 126 }; |
122 | 127 |
123 } // namespace | 128 } // namespace |
124 | 129 |
125 OzonePlatform* CreateOzonePlatformX11() { | 130 OzonePlatform* CreateOzonePlatformX11() { |
126 return new OzonePlatformX11; | 131 return new OzonePlatformX11; |
127 } | 132 } |
128 | 133 |
129 } // namespace ui | 134 } // namespace ui |
OLD | NEW |