| 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 #include "services/ui/ws/cursor_location_manager.h" | 5 #include "services/ui/ws/cursor_location_manager.h" |
| 6 | 6 |
| 7 #include "ui/gfx/geometry/point.h" | 7 #include "ui/gfx/geometry/point.h" |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 namespace ws { | 10 namespace ws { |
| 11 | 11 |
| 12 CursorLocationManager::CursorLocationManager() {} | 12 CursorLocationManager::CursorLocationManager() {} |
| 13 | 13 |
| 14 CursorLocationManager::~CursorLocationManager() {} | 14 CursorLocationManager::~CursorLocationManager() {} |
| 15 | 15 |
| 16 void CursorLocationManager::OnMouseCursorLocationChanged( | 16 void CursorLocationManager::OnMouseCursorLocationChanged( |
| 17 const gfx::Point& point) { | 17 const gfx::Point& point_in_dip) { |
| 18 current_cursor_location_ = static_cast<base::subtle::Atomic32>( | 18 current_cursor_location_ = static_cast<base::subtle::Atomic32>( |
| 19 (point.x() & 0xFFFF) << 16 | (point.y() & 0xFFFF)); | 19 (point_in_dip.x() & 0xFFFF) << 16 | (point_in_dip.y() & 0xFFFF)); |
| 20 if (cursor_location_memory()) { | 20 if (cursor_location_memory()) { |
| 21 base::subtle::NoBarrier_Store(cursor_location_memory(), | 21 base::subtle::NoBarrier_Store(cursor_location_memory(), |
| 22 current_cursor_location_); | 22 current_cursor_location_); |
| 23 } | 23 } |
| 24 } | 24 } |
| 25 | 25 |
| 26 mojo::ScopedSharedBufferHandle | 26 mojo::ScopedSharedBufferHandle |
| 27 CursorLocationManager::GetCursorLocationMemory() { | 27 CursorLocationManager::GetCursorLocationMemory() { |
| 28 if (!cursor_location_handle_.is_valid()) { | 28 if (!cursor_location_handle_.is_valid()) { |
| 29 // Create our shared memory segment to share the cursor state with our | 29 // Create our shared memory segment to share the cursor state with our |
| (...skipping 11 matching lines...) Expand all Loading... |
| 41 base::subtle::NoBarrier_Store(cursor_location_memory(), | 41 base::subtle::NoBarrier_Store(cursor_location_memory(), |
| 42 current_cursor_location_); | 42 current_cursor_location_); |
| 43 } | 43 } |
| 44 | 44 |
| 45 return cursor_location_handle_->Clone( | 45 return cursor_location_handle_->Clone( |
| 46 mojo::SharedBufferHandle::AccessMode::READ_ONLY); | 46 mojo::SharedBufferHandle::AccessMode::READ_ONLY); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace ws | 49 } // namespace ws |
| 50 } // namespace ui | 50 } // namespace ui |
| OLD | NEW |