Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(784)

Side by Side Diff: ui/ozone/platform/drm/ozone_platform_gbm.cc

Issue 2903353002: Make ozone/drm/mojo more immune to startup races (Closed)
Patch Set: simpler patch Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/drm/mus_thread_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ui/ozone/platform/drm/ozone_platform_gbm.h" 5 #include "ui/ozone/platform/drm/ozone_platform_gbm.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <gbm.h> 9 #include <gbm.h>
10 #include <stdlib.h> 10 #include <stdlib.h>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (drm_thread_proxy_) 117 if (drm_thread_proxy_)
118 drm_thread_proxy_->AddBinding(std::move(request)); 118 drm_thread_proxy_->AddBinding(std::move(request));
119 else 119 else
120 pending_cursor_requests_.push_back(std::move(request)); 120 pending_cursor_requests_.push_back(std::move(request));
121 } 121 }
122 std::unique_ptr<PlatformWindow> CreatePlatformWindow( 122 std::unique_ptr<PlatformWindow> CreatePlatformWindow(
123 PlatformWindowDelegate* delegate, 123 PlatformWindowDelegate* delegate,
124 const gfx::Rect& bounds) override { 124 const gfx::Rect& bounds) override {
125 GpuThreadAdapter* adapter = gpu_platform_support_host_.get(); 125 GpuThreadAdapter* adapter = gpu_platform_support_host_.get();
126 if (using_mojo_ || single_process_) { 126 if (using_mojo_ || single_process_) {
127 DCHECK(drm_thread_proxy_)
128 << "drm_thread_proxy_ should exist (and be running) here.";
129 adapter = mus_thread_proxy_.get(); 127 adapter = mus_thread_proxy_.get();
130 } 128 }
131 129
132 std::unique_ptr<DrmWindowHost> platform_window(new DrmWindowHost( 130 std::unique_ptr<DrmWindowHost> platform_window(new DrmWindowHost(
133 delegate, bounds, adapter, event_factory_ozone_.get(), cursor_.get(), 131 delegate, bounds, adapter, event_factory_ozone_.get(), cursor_.get(),
134 window_manager_.get(), display_manager_.get(), overlay_manager_.get())); 132 window_manager_.get(), display_manager_.get(), overlay_manager_.get()));
135 platform_window->Initialize(); 133 platform_window->Initialize();
136 return std::move(platform_window); 134 return std::move(platform_window);
137 } 135 }
138 std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate() 136 std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate()
(...skipping 30 matching lines...) Expand all
169 cursor_.get(), device_manager_.get(), 167 cursor_.get(), device_manager_.get(),
170 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); 168 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()));
171 169
172 GpuThreadAdapter* adapter; 170 GpuThreadAdapter* adapter;
173 171
174 // TODO(rjkroege): Once mus is split, only do this for single_process. 172 // TODO(rjkroege): Once mus is split, only do this for single_process.
175 if (single_process_ || using_mojo_) 173 if (single_process_ || using_mojo_)
176 gl_api_loader_.reset(new GlApiLoader()); 174 gl_api_loader_.reset(new GlApiLoader());
177 175
178 if (using_mojo_) { 176 if (using_mojo_) {
179 DCHECK(args.connector); 177 mus_thread_proxy_ =
180 mus_thread_proxy_.reset(new MusThreadProxy()); 178 base::MakeUnique<MusThreadProxy>(cursor_.get(), args.connector);
181 adapter = mus_thread_proxy_.get(); 179 adapter = mus_thread_proxy_.get();
182 cursor_->SetDrmCursorProxy(new CursorProxyMojo(args.connector));
183 } else if (single_process_) { 180 } else if (single_process_) {
184 mus_thread_proxy_.reset(new MusThreadProxy()); 181 mus_thread_proxy_ =
182 base::MakeUnique<MusThreadProxy>(cursor_.get(), nullptr);
185 adapter = mus_thread_proxy_.get(); 183 adapter = mus_thread_proxy_.get();
186 cursor_->SetDrmCursorProxy(
187 new CursorProxyThread(mus_thread_proxy_.get()));
188 } else { 184 } else {
189 gpu_platform_support_host_.reset( 185 gpu_platform_support_host_.reset(
190 new DrmGpuPlatformSupportHost(cursor_.get())); 186 new DrmGpuPlatformSupportHost(cursor_.get()));
191 adapter = gpu_platform_support_host_.get(); 187 adapter = gpu_platform_support_host_.get();
192 } 188 }
193 189
194 overlay_manager_.reset( 190 overlay_manager_.reset(
195 new DrmOverlayManager(adapter, window_manager_.get())); 191 new DrmOverlayManager(adapter, window_manager_.get()));
196 display_manager_.reset(new DrmDisplayHostManager( 192 display_manager_.reset(new DrmDisplayHostManager(
197 adapter, device_manager_.get(), overlay_manager_.get(), 193 adapter, device_manager_.get(), overlay_manager_.get(),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); 265 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm);
270 }; 266 };
271 267
272 } // namespace 268 } // namespace
273 269
274 OzonePlatform* CreateOzonePlatformGbm() { 270 OzonePlatform* CreateOzonePlatformGbm() {
275 return new OzonePlatformGbm; 271 return new OzonePlatformGbm;
276 } 272 }
277 273
278 } // namespace ui 274 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/mus_thread_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698