OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_HOST_DRM_CURSOR_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ |
6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ | 6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 // processes. The proxy implementation must satisfy DrmCursorProxy. | 23 // processes. The proxy implementation must satisfy DrmCursorProxy. |
24 class DrmCursorProxy { | 24 class DrmCursorProxy { |
25 public: | 25 public: |
26 virtual ~DrmCursorProxy() {} | 26 virtual ~DrmCursorProxy() {} |
27 | 27 |
28 // Sets the cursor |bitmaps| on |window| at |point| with |frame_delay_ms|. | 28 // Sets the cursor |bitmaps| on |window| at |point| with |frame_delay_ms|. |
29 virtual void CursorSet(gfx::AcceleratedWidget window, | 29 virtual void CursorSet(gfx::AcceleratedWidget window, |
30 const std::vector<SkBitmap>& bitmaps, | 30 const std::vector<SkBitmap>& bitmaps, |
31 const gfx::Point& point, | 31 const gfx::Point& point, |
32 int frame_delay_ms) = 0; | 32 int frame_delay_ms) = 0; |
33 // Moves the cursor in |window| to |point| | 33 // Moves the cursor in |window| to |point|, callable from the ui thread. |
34 virtual void Move(gfx::AcceleratedWidget window, const gfx::Point& point) = 0; | 34 virtual void Move(gfx::AcceleratedWidget window, const gfx::Point& point) = 0; |
35 | 35 |
| 36 // Moves the cursor in |window| to |point|, callable from the EvdevThread. |
| 37 virtual void MoveEvdev(gfx::AcceleratedWidget window, |
| 38 const gfx::Point& point) = 0; |
36 // Initialize EvdevThread-specific state. | 39 // Initialize EvdevThread-specific state. |
37 virtual void InitializeOnEvdev() = 0; | 40 virtual void InitializeOnEvdev() = 0; |
38 }; | 41 }; |
39 | 42 |
40 // DrmCursor manages all cursor state and semantics. | 43 // DrmCursor manages all cursor state and semantics. |
41 class DrmCursor : public CursorDelegateEvdev { | 44 class DrmCursor : public CursorDelegateEvdev { |
42 public: | 45 public: |
43 explicit DrmCursor(DrmWindowHostManager* window_manager); | 46 explicit DrmCursor(DrmWindowHostManager* window_manager); |
44 ~DrmCursor() override; | 47 ~DrmCursor() override; |
45 | 48 |
(...skipping 20 matching lines...) Expand all Loading... |
66 void MoveCursorTo(gfx::AcceleratedWidget window, | 69 void MoveCursorTo(gfx::AcceleratedWidget window, |
67 const gfx::PointF& location) override; | 70 const gfx::PointF& location) override; |
68 void MoveCursorTo(const gfx::PointF& screen_location) override; | 71 void MoveCursorTo(const gfx::PointF& screen_location) override; |
69 void MoveCursor(const gfx::Vector2dF& delta) override; | 72 void MoveCursor(const gfx::Vector2dF& delta) override; |
70 bool IsCursorVisible() override; | 73 bool IsCursorVisible() override; |
71 gfx::PointF GetLocation() override; | 74 gfx::PointF GetLocation() override; |
72 gfx::Rect GetCursorConfinedBounds() override; | 75 gfx::Rect GetCursorConfinedBounds() override; |
73 void InitializeOnEvdev() override; | 76 void InitializeOnEvdev() override; |
74 | 77 |
75 private: | 78 private: |
| 79 enum ThreadType { UI, EVDEV }; |
| 80 |
76 void SetCursorLocationLocked(const gfx::PointF& location); | 81 void SetCursorLocationLocked(const gfx::PointF& location); |
77 void SendCursorShowLocked(); | 82 void SendCursorShowLocked(); |
78 void SendCursorHideLocked(); | 83 void SendCursorHideLocked(); |
79 void SendCursorMoveLocked(); | 84 void SendCursorMoveLocked(ThreadType tt); |
80 | 85 |
81 // Lock-testing helpers. | 86 // Lock-testing helpers. |
82 void CursorSetLockTested(gfx::AcceleratedWidget window, | 87 void CursorSetLockTested(gfx::AcceleratedWidget window, |
83 const std::vector<SkBitmap>& bitmaps, | 88 const std::vector<SkBitmap>& bitmaps, |
84 const gfx::Point& point, | 89 const gfx::Point& point, |
85 int frame_delay_ms); | 90 int frame_delay_ms); |
86 void MoveLockTested(gfx::AcceleratedWidget window, const gfx::Point& point); | 91 void MoveLockTested(ThreadType thread_type, |
| 92 gfx::AcceleratedWidget window, |
| 93 const gfx::Point& point); |
87 | 94 |
88 // The mutex synchronizing this object. | 95 // The mutex synchronizing this object. |
89 base::Lock lock_; | 96 base::Lock lock_; |
90 | 97 |
91 // Enforce our threading constraints. | 98 // Enforce our threading constraints. |
92 base::ThreadChecker thread_checker_; | 99 base::ThreadChecker thread_checker_; |
93 base::ThreadChecker evdev_thread_checker_; | 100 base::ThreadChecker evdev_thread_checker_; |
94 | 101 |
95 // The location of the bitmap (the cursor location is the hotspot location). | 102 // The location of the bitmap (the cursor location is the hotspot location). |
96 gfx::Point GetBitmapLocationLocked(); | 103 gfx::Point GetBitmapLocationLocked(); |
(...skipping 16 matching lines...) Expand all Loading... |
113 DrmWindowHostManager* window_manager_; // Not owned. | 120 DrmWindowHostManager* window_manager_; // Not owned. |
114 | 121 |
115 std::unique_ptr<DrmCursorProxy> proxy_; | 122 std::unique_ptr<DrmCursorProxy> proxy_; |
116 | 123 |
117 DISALLOW_COPY_AND_ASSIGN(DrmCursor); | 124 DISALLOW_COPY_AND_ASSIGN(DrmCursor); |
118 }; | 125 }; |
119 | 126 |
120 } // namespace ui | 127 } // namespace ui |
121 | 128 |
122 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ | 129 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ |
OLD | NEW |