Adds debugging to track down why mouse_moved_handler_ is bogus

Crash data indicates RootWindow::mouse_moved_handler_ may become
bogus. This patch adds some code in hopes of tracking how that is
happening.

BUG=275760
TEST=none
[email protected]

Review URL: https://codereview.chromium.org/24072020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225207 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h
index e8d9f65..945072d 100644
--- a/ui/aura/root_window.h
+++ b/ui/aura/root_window.h
@@ -46,11 +46,12 @@
 }
 
 namespace aura {
-class TestScreen;
+class MouseMovedTracker;
 class RootWindow;
 class RootWindowHost;
 class RootWindowObserver;
 class RootWindowTransformer;
+class TestScreen;
 
 // RootWindow is responsible for hosting a set of windows.
 class AURA_EXPORT RootWindow : public ui::CompositorDelegate,
@@ -301,6 +302,26 @@
                        // across root windows.
   };
 
+  // TODO(sky): nuke; used for debugging 275760.
+  // Used for debugging.
+  enum MouseMovedHandlerSetReason {
+    // |mouse_moved_handler_| set during capture.
+    MOUSE_MOVED_HANDLER_SET_REASON_CAPTURE = 1,
+
+    // |mouse_moved_handler_| set from a mouse event.
+    MOUSE_MOVED_HANDLER_SET_REASON_MOUSE_MOVED = 2,
+
+    // |mouse_moved_handler_| set from a synthesized mouse event.
+    MOUSE_MOVED_HANDLER_SET_REASON_MOUSE_MOVED_SYNTHESIZED = 3,
+
+    // |mouse_moved_handler_| set to NULL.
+    MOUSE_MOVED_HANDLER_SET_REASON_NULL = 4,
+  };
+
+  // TODO(sky): nuke; used for debugging 275760.
+  void SetMouseMovedHandler(aura::Window* window,
+                            MouseMovedHandlerSetReason reason);
+
   // Updates the event with the appropriate transform for the device scale
   // factor. The RootWindowHostDelegate dispatches events in the physical pixel
   // coordinate. But the event processing from RootWindow onwards happen in
@@ -430,6 +451,10 @@
 
   bool defer_draw_scheduling_;
 
+  // TODO(sky): nuke; used for debugging 275760.
+  MouseMovedHandlerSetReason mouse_moved_handler_set_reason_;
+  scoped_ptr<MouseMovedTracker> mouse_moved_handler_tracker_;
+
   // How many move holds are outstanding. We try to defer dispatching
   // touch/mouse moves while the count is > 0.
   int move_hold_count_;