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

Side by Side Diff: ui/ozone/platform/drm/mus_thread_proxy.h

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
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 #ifndef UI_OZONE_PLATFORM_DRM_MUS_THREAD_PROXY_H_ 5 #ifndef UI_OZONE_PLATFORM_DRM_MUS_THREAD_PROXY_H_
6 #define UI_OZONE_PLATFORM_DRM_MUS_THREAD_PROXY_H_ 6 #define UI_OZONE_PLATFORM_DRM_MUS_THREAD_PROXY_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/ozone/platform/drm/gpu/inter_thread_messaging_proxy.h" 14 #include "ui/ozone/platform/drm/gpu/inter_thread_messaging_proxy.h"
15 #include "ui/ozone/platform/drm/host/drm_cursor.h" 15 #include "ui/ozone/platform/drm/host/drm_cursor.h"
16 #include "ui/ozone/platform/drm/host/gpu_thread_adapter.h" 16 #include "ui/ozone/platform/drm/host/gpu_thread_adapter.h"
17 #include "ui/ozone/public/interfaces/device_cursor.mojom.h" 17 #include "ui/ozone/public/interfaces/device_cursor.mojom.h"
18 18
19 namespace base { 19 namespace base {
20 class SingleThreadTaskRunner; 20 class SingleThreadTaskRunner;
21 } 21 }
22 22
23 namespace service_manager {
24 class Connector;
25 }
26
23 namespace ui { 27 namespace ui {
24 28
25 class DrmDisplayHostManager; 29 class DrmDisplayHostManager;
26 class DrmOverlayManager; 30 class DrmOverlayManager;
27 class DrmThread; 31 class DrmThread;
28 class GpuThreadObserver; 32 class GpuThreadObserver;
29 class MusThreadProxy; 33 class MusThreadProxy;
30 34
31 // Forwarding proxy to handle ownership semantics.
32 class CursorProxyThread : public DrmCursorProxy {
33 public:
34 explicit CursorProxyThread(MusThreadProxy* mus_thread_proxy);
35 ~CursorProxyThread() override;
36
37 private:
38 // DrmCursorProxy.
39 void CursorSet(gfx::AcceleratedWidget window,
40 const std::vector<SkBitmap>& bitmaps,
41 const gfx::Point& point,
42 int frame_delay_ms) override;
43 void Move(gfx::AcceleratedWidget window, const gfx::Point& point) override;
44 void InitializeOnEvdev() override;
45 MusThreadProxy* const mus_thread_proxy_; // Not owned.
46 };
47
48 // In Mus, the window server thread (analogous to Chrome's UI thread), GPU and 35 // In Mus, the window server thread (analogous to Chrome's UI thread), GPU and
49 // DRM threads coexist in a single Mus process. The |MusThreadProxy| connects 36 // DRM threads coexist in a single Mus process. The |MusThreadProxy| connects
50 // these threads together via cross-thread calls. 37 // these threads together via cross-thread calls.
51 class MusThreadProxy : public GpuThreadAdapter, 38 class MusThreadProxy : public GpuThreadAdapter,
52 public InterThreadMessagingProxy, 39 public InterThreadMessagingProxy,
53 public DrmCursorProxy { 40 public DrmCursorProxy {
54 public: 41 public:
55 MusThreadProxy(); 42 MusThreadProxy(DrmCursor* cursor, service_manager::Connector* connector);
56 ~MusThreadProxy() override; 43 ~MusThreadProxy() override;
57 44
58 void StartDrmThread(); 45 void StartDrmThread();
59 void ProvideManagers(DrmDisplayHostManager* display_manager, 46 void ProvideManagers(DrmDisplayHostManager* display_manager,
60 DrmOverlayManager* overlay_manager); 47 DrmOverlayManager* overlay_manager);
61 48
62 // InterThreadMessagingProxy. 49 // InterThreadMessagingProxy.
63 void SetDrmThread(DrmThread* thread) override; 50 void SetDrmThread(DrmThread* thread) override;
64 51
65 // This is the core functionality. They are invoked when we have a main 52 // This is the core functionality. They are invoked when we have a main
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bool GpuCreateWindow(gfx::AcceleratedWidget widget) override; 93 bool GpuCreateWindow(gfx::AcceleratedWidget widget) override;
107 bool GpuWindowBoundsChanged(gfx::AcceleratedWidget widget, 94 bool GpuWindowBoundsChanged(gfx::AcceleratedWidget widget,
108 const gfx::Rect& bounds) override; 95 const gfx::Rect& bounds) override;
109 96
110 // DrmCursorProxy. 97 // DrmCursorProxy.
111 void CursorSet(gfx::AcceleratedWidget window, 98 void CursorSet(gfx::AcceleratedWidget window,
112 const std::vector<SkBitmap>& bitmaps, 99 const std::vector<SkBitmap>& bitmaps,
113 const gfx::Point& point, 100 const gfx::Point& point,
114 int frame_delay_ms) override; 101 int frame_delay_ms) override;
115 void Move(gfx::AcceleratedWidget window, const gfx::Point& point) override; 102 void Move(gfx::AcceleratedWidget window, const gfx::Point& point) override;
116 void InitializeOnEvdev() override; 103 void InitializeOnEvdevIfNecessary() override;
117 104
118 private: 105 private:
119 void RunObservers(); 106 void RunObservers();
120 void DispatchObserversFromDrmThread(); 107 void DispatchObserversFromDrmThread();
121 108
122 void GpuCheckOverlayCapabilitiesCallback( 109 void GpuCheckOverlayCapabilitiesCallback(
123 gfx::AcceleratedWidget widget, 110 gfx::AcceleratedWidget widget,
124 const std::vector<OverlayCheck_Params>& overlays) const; 111 const std::vector<OverlayCheck_Params>& overlays) const;
125 112
126 void GpuConfigureNativeDisplayCallback(int64_t display_id, 113 void GpuConfigureNativeDisplayCallback(int64_t display_id,
(...skipping 11 matching lines...) Expand all
138 125
139 scoped_refptr<base::SingleThreadTaskRunner> ws_task_runner_; 126 scoped_refptr<base::SingleThreadTaskRunner> ws_task_runner_;
140 127
141 DrmThread* drm_thread_; // Not owned. 128 DrmThread* drm_thread_; // Not owned.
142 129
143 // Guards for multi-theaded access to drm_thread_. 130 // Guards for multi-theaded access to drm_thread_.
144 base::Lock lock_; 131 base::Lock lock_;
145 132
146 DrmDisplayHostManager* display_manager_; // Not owned. 133 DrmDisplayHostManager* display_manager_; // Not owned.
147 DrmOverlayManager* overlay_manager_; // Not owned. 134 DrmOverlayManager* overlay_manager_; // Not owned.
135 DrmCursor* cursor_; // Not owned.
136
137 service_manager::Connector* connector_;
148 138
149 base::ObserverList<GpuThreadObserver> gpu_thread_observers_; 139 base::ObserverList<GpuThreadObserver> gpu_thread_observers_;
150 140
151 base::ThreadChecker on_window_server_thread_; 141 base::ThreadChecker on_window_server_thread_;
152 142
153 base::WeakPtrFactory<MusThreadProxy> weak_ptr_factory_; 143 base::WeakPtrFactory<MusThreadProxy> weak_ptr_factory_;
154 144
155 DISALLOW_COPY_AND_ASSIGN(MusThreadProxy); 145 DISALLOW_COPY_AND_ASSIGN(MusThreadProxy);
156 }; 146 };
157 147
158 } // namespace ui 148 } // namespace ui
159 149
160 #endif // UI_OZONE_PLATFORM_DRM_MUS_THREAD_PROXY_H_ 150 #endif // UI_OZONE_PLATFORM_DRM_MUS_THREAD_PROXY_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc ('k') | ui/ozone/platform/drm/mus_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698