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

Unified Diff: ui/ozone/platform/drm/host/drm_cursor.cc

Issue 2903353002: Make ozone/drm/mojo more immune to startup races (Closed)
Patch Set: cursor setup independent of evdev / drm startup and timing of PlatformWindow creation. Created 3 years, 7 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
Index: ui/ozone/platform/drm/host/drm_cursor.cc
diff --git a/ui/ozone/platform/drm/host/drm_cursor.cc b/ui/ozone/platform/drm/host/drm_cursor.cc
index 0dc9ae53704110228670e2087b8f89db860da8bc..50fe20c77c9f2cfe7a693ff7c8c56c8ba5ccd803 100644
--- a/ui/ozone/platform/drm/host/drm_cursor.cc
+++ b/ui/ozone/platform/drm/host/drm_cursor.cc
@@ -27,7 +27,8 @@ class NullProxy : public DrmCursorProxy {
const gfx::Point& point,
int frame_delay_ms) override {}
void Move(gfx::AcceleratedWidget window, const gfx::Point& point) override {}
- void InitializeOnEvdev() override {}
+ void InitializeOnEvdevIfNecessary() override {}
+ void SendToDelegate(DrmCursorProxy* delegate) override {}
private:
DISALLOW_COPY_AND_ASSIGN(NullProxy);
@@ -44,11 +45,13 @@ DrmCursor::DrmCursor(DrmWindowHostManager* window_manager)
DrmCursor::~DrmCursor() {}
-void DrmCursor::SetDrmCursorProxy(DrmCursorProxy* proxy) {
+std::unique_ptr<DrmCursorProxy> DrmCursor::SetDrmCursorProxy(
+ std::unique_ptr<DrmCursorProxy> proxy) {
TRACE_EVENT0("drmcursor", "DrmCursor::SetDrmCursorProxy");
DCHECK(thread_checker_.CalledOnValidThread());
base::AutoLock lock(lock_);
- proxy_.reset(proxy);
+ std::swap(proxy, proxy_);
+ return proxy;
}
void DrmCursor::ResetDrmCursorProxy() {
@@ -216,7 +219,7 @@ gfx::Rect DrmCursor::GetCursorConfinedBounds() {
void DrmCursor::InitializeOnEvdev() {
DCHECK(evdev_thread_checker_.CalledOnValidThread());
- proxy_->InitializeOnEvdev();
+ proxy_->InitializeOnEvdevIfNecessary();
}
void DrmCursor::SetCursorLocationLocked(const gfx::PointF& location) {

Powered by Google App Engine
This is Rietveld 408576698