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

Unified Diff: content/browser/renderer_host/render_widget_host_view_win.h

Issue 8791001: Fix mouse lock perf issue on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes in response to Brett's suggestion. Created 9 years 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_win.h
diff --git a/content/browser/renderer_host/render_widget_host_view_win.h b/content/browser/renderer_host/render_widget_host_view_win.h
index 0424f7a18b9b08fc4fd193b60d5619c35496c73f..89e54f584f464674695adac5b7ed3a42dc33ad31 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.h
+++ b/content/browser/renderer_host/render_widget_host_view_win.h
@@ -335,7 +335,9 @@ class RenderWidgetHostViewWin
DWORD ex_style);
CPoint GetClientCenter() const;
- void MoveCursorToCenter() const;
+ // In mouse lock mode, moves the mouse cursor to the center of the view if it
+ // is too close to the border.
+ void MoveCursorToCenterIfNecessary();
void HandleLockedMouseEvent(UINT message, WPARAM wparam, LPARAM lparam);
@@ -479,12 +481,26 @@ class RenderWidgetHostViewWin
bool is_fullscreen_;
// Used to record the last position of the mouse.
- // While the mouse is locked, they store the last known position just as mouse
- // lock was entered.
- // Relative to the upper-left corner of the view.
- gfx::Point last_mouse_position_;
- // Relative to the upper-left corner of the screen.
- gfx::Point last_global_mouse_position_;
+ struct {
+ // While the mouse is locked, |unlocked| and |unlocked_global| store the
+ // last known position just as mouse lock was entered.
+ // Relative to the upper-left corner of the view.
+ gfx::Point unlocked;
+ // Relative to the upper-left corner of the screen.
+ gfx::Point unlocked_global;
+
+ // Only valid while the mouse is locked.
+ gfx::Point locked_global;
+ } last_mouse_position_;
+
+ // When the mouse cursor is moved to the center of the view by
+ // MoveCursorToCenterIfNecessary(), we ignore the resulting WM_MOUSEMOVE
+ // message.
+ struct {
+ bool pending;
+ // Relative to the upper-left corner of the screen.
+ gfx::Point target;
+ } move_to_center_request_;
// In the case of the mouse being moved away from the view and then moved
// back, we regard the mouse movement as (0, 0).
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698