Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 SERVICES_UI_WS_CURSOR_LOCATION_MANAGER_H_ | 5 #ifndef SERVICES_UI_WS_CURSOR_LOCATION_MANAGER_H_ |
| 6 #define SERVICES_UI_WS_CURSOR_LOCATION_MANAGER_H_ | 6 #define SERVICES_UI_WS_CURSOR_LOCATION_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/atomicops.h" | 8 #include "base/atomicops.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "mojo/public/cpp/system/buffer.h" | 10 #include "mojo/public/cpp/system/buffer.h" |
| 11 | 11 |
| 12 namespace gfx { | 12 namespace gfx { |
| 13 class Point; | 13 class Point; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace ui { | 16 namespace ui { |
| 17 namespace ws { | 17 namespace ws { |
| 18 | 18 |
| 19 // Manages a shared memory buffer that stores the cursor location. | 19 // Manages a shared memory buffer that stores the cursor location. |
| 20 class CursorLocationManager { | 20 class CursorLocationManager { |
| 21 public: | 21 public: |
| 22 CursorLocationManager(); | 22 CursorLocationManager(); |
| 23 ~CursorLocationManager(); | 23 ~CursorLocationManager(); |
| 24 | 24 |
| 25 // Sets the current cursor location to |point|. Atomically writes the location | 25 // Sets the current cursor location to |point|. Atomically writes the location |
| 26 // to shared memory. | 26 // to shared memory. |point| should be in screen-coord and DIP. |
| 27 void OnMouseCursorLocationChanged(const gfx::Point& point); | 27 void OnMouseCursorLocationChanged(const gfx::Point& point); |
|
sky
2017/05/25 22:10:19
Please rename to point_in_dips to make that clear.
riajiang
2017/05/25 22:59:23
Renamed to point_in_dip?
| |
| 28 | 28 |
| 29 // Returns a read-only handle to the shared memory which contains the global | 29 // Returns a read-only handle to the shared memory which contains the global |
| 30 // mouse cursor position. Each call returns a new handle. | 30 // mouse cursor position. Each call returns a new handle. |
| 31 mojo::ScopedSharedBufferHandle GetCursorLocationMemory(); | 31 mojo::ScopedSharedBufferHandle GetCursorLocationMemory(); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 base::subtle::Atomic32* cursor_location_memory() { | 34 base::subtle::Atomic32* cursor_location_memory() { |
| 35 return reinterpret_cast<base::subtle::Atomic32*>( | 35 return reinterpret_cast<base::subtle::Atomic32*>( |
| 36 cursor_location_mapping_.get()); | 36 cursor_location_mapping_.get()); |
| 37 } | 37 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 50 // mojo connection, this data must be read atomically.) | 50 // mojo connection, this data must be read atomically.) |
| 51 mojo::ScopedSharedBufferMapping cursor_location_mapping_; | 51 mojo::ScopedSharedBufferMapping cursor_location_mapping_; |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(CursorLocationManager); | 53 DISALLOW_COPY_AND_ASSIGN(CursorLocationManager); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace ws | 56 } // namespace ws |
| 57 } // namespace ui | 57 } // namespace ui |
| 58 | 58 |
| 59 #endif // SERVICES_UI_WS_CURSOR_LOCATION_MANAGER_H_ | 59 #endif // SERVICES_UI_WS_CURSOR_LOCATION_MANAGER_H_ |
| OLD | NEW |