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

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

Issue 2903353002: Make ozone/drm/mojo more immune to startup races (Closed)
Patch Set: make CursorProxyMojo a GpuThreadObserver 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
OLDNEW
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/drm/cursor_proxy_mojo.h" 5 #include "ui/ozone/platform/drm/cursor_proxy_mojo.h"
6 6
7 #include "services/service_manager/public/cpp/connector.h" 7 #include "services/service_manager/public/cpp/connector.h"
8 #include "services/ui/public/interfaces/constants.mojom.h" 8 #include "services/ui/public/interfaces/constants.mojom.h"
9 9
10 namespace ui { 10 namespace ui {
11 11
12 CursorProxyMojo::CursorProxyMojo(service_manager::Connector* connector) 12 CursorProxyMojo::CursorProxyMojo(service_manager::Connector* connector)
13 : connector_(connector->Clone()) { 13 : connector_(connector->Clone()) {
14 connector->BindInterface(ui::mojom::kServiceName, &main_cursor_ptr_); 14 connector->BindInterface(ui::mojom::kServiceName, &main_cursor_ptr_);
15 } 15 }
16 16
17 void CursorProxyMojo::InitializeOnEvdev() { 17 void CursorProxyMojo::InitializeOnEvdev() {
18 evdev_ref_ = base::PlatformThread::CurrentRef(); 18 evdev_ref_ = base::PlatformThread::CurrentRef();
19 connector_->BindInterface(ui::mojom::kServiceName, &evdev_cursor_ptr_); 19 connector_->BindInterface(ui::mojom::kServiceName, &evdev_cursor_ptr_);
20 } 20 }
21 21
22 CursorProxyMojo::~CursorProxyMojo() {} 22 CursorProxyMojo::~CursorProxyMojo() {}
23 23
24 void CursorProxyMojo::CursorSet(gfx::AcceleratedWidget widget, 24 void CursorProxyMojo::CursorSet(gfx::AcceleratedWidget widget,
25 const std::vector<SkBitmap>& bitmaps, 25 const std::vector<SkBitmap>& bitmaps,
26 const gfx::Point& location, 26 const gfx::Point& location,
27 int frame_delay_ms) { 27 int frame_delay_ms) {
28 if (!have_gpu_thread_)
29 return;
28 if (evdev_ref_ == base::PlatformThread::CurrentRef()) { 30 if (evdev_ref_ == base::PlatformThread::CurrentRef()) {
29 evdev_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms); 31 evdev_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms);
30 } else { 32 } else {
31 main_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms); 33 main_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms);
32 } 34 }
33 } 35 }
34 36
35 void CursorProxyMojo::Move(gfx::AcceleratedWidget widget, 37 void CursorProxyMojo::Move(gfx::AcceleratedWidget widget,
36 const gfx::Point& location) { 38 const gfx::Point& location) {
39 if (!have_gpu_thread_)
40 return;
37 if (evdev_ref_ == base::PlatformThread::CurrentRef()) { 41 if (evdev_ref_ == base::PlatformThread::CurrentRef()) {
38 evdev_cursor_ptr_->MoveCursor(widget, location); 42 evdev_cursor_ptr_->MoveCursor(widget, location);
39 } else { 43 } else {
40 main_cursor_ptr_->MoveCursor(widget, location); 44 main_cursor_ptr_->MoveCursor(widget, location);
41 } 45 }
42 } 46 }
43 47
48 void CursorProxyMojo::OnGpuProcessLaunched() {}
49
50 void CursorProxyMojo::OnGpuThreadReady() {
51 have_gpu_thread_ = true;
52 }
53
54 void CursorProxyMojo::OnGpuThreadRetired() {
55 have_gpu_thread_ = false;
56 }
57
44 } // namespace ui 58 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698