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

Unified Diff: ui/ozone/platform/drm/cursor_proxy_mojo.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/drm/cursor_proxy_mojo.h ('k') | ui/ozone/platform/drm/host/drm_cursor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/cursor_proxy_mojo.cc
diff --git a/ui/ozone/platform/drm/cursor_proxy_mojo.cc b/ui/ozone/platform/drm/cursor_proxy_mojo.cc
index a0918fc0a2250a92eb8a51560bd2af26a22277b5..c48ddcad7c494d45fefb385d785b17860dfdb3cc 100644
--- a/ui/ozone/platform/drm/cursor_proxy_mojo.cc
+++ b/ui/ozone/platform/drm/cursor_proxy_mojo.cc
@@ -9,35 +9,45 @@
namespace ui {
+// We assume that this is invoked only on the UI thread.
CursorProxyMojo::CursorProxyMojo(service_manager::Connector* connector)
: connector_(connector->Clone()) {
+ ui_thread_ref_ = base::PlatformThread::CurrentRef();
connector->BindInterface(ui::mojom::kServiceName, &main_cursor_ptr_);
}
-void CursorProxyMojo::InitializeOnEvdev() {
- evdev_ref_ = base::PlatformThread::CurrentRef();
- connector_->BindInterface(ui::mojom::kServiceName, &evdev_cursor_ptr_);
-}
-
CursorProxyMojo::~CursorProxyMojo() {}
void CursorProxyMojo::CursorSet(gfx::AcceleratedWidget widget,
const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location,
int frame_delay_ms) {
- if (evdev_ref_ == base::PlatformThread::CurrentRef()) {
- evdev_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms);
- } else {
+ InitializeOnEvdevIfNecessary();
+ if (ui_thread_ref_ == base::PlatformThread::CurrentRef()) {
main_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms);
+ } else {
+ evdev_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms);
}
}
void CursorProxyMojo::Move(gfx::AcceleratedWidget widget,
const gfx::Point& location) {
- if (evdev_ref_ == base::PlatformThread::CurrentRef()) {
- evdev_cursor_ptr_->MoveCursor(widget, location);
- } else {
+ InitializeOnEvdevIfNecessary();
+ if (ui_thread_ref_ == base::PlatformThread::CurrentRef()) {
main_cursor_ptr_->MoveCursor(widget, location);
+ } else {
+ evdev_cursor_ptr_->MoveCursor(widget, location);
+ }
+}
+
+// Evdev runs this method on starting. But if a CursorProxyMojo is created long
+// after Evdev has started (e.g. if the Viz process crashes (and the
+// |CursorProxyMojo| self-destructs and then a new |CursorProxyMojo| is built
+// when the GpuThread/DrmThread pair are once again running), we need to run it
+// on cursor motions.
+void CursorProxyMojo::InitializeOnEvdevIfNecessary() {
+ if (ui_thread_ref_ != base::PlatformThread::CurrentRef()) {
+ connector_->BindInterface(ui::mojom::kServiceName, &evdev_cursor_ptr_);
}
}
« no previous file with comments | « ui/ozone/platform/drm/cursor_proxy_mojo.h ('k') | ui/ozone/platform/drm/host/drm_cursor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698