Index: content/browser/renderer_host/smooth_scroll_gesture_controller.h |
diff --git a/content/browser/renderer_host/smooth_scroll_gesture_controller.h b/content/browser/renderer_host/smooth_scroll_gesture_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..34ff67104354cbd8af7ab0a4e9bd4d565d32bc34 |
--- /dev/null |
+++ b/content/browser/renderer_host/smooth_scroll_gesture_controller.h |
@@ -0,0 +1,62 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_RENDERER_HOST_SMOOTH_GESTURE_CONTROLLER_H_ |
+#define CONTENT_BROWSER_RENDERER_HOST_SMOOTH_GESTURE_CONTROLLER_H_ |
+ |
+#include <map> |
+ |
+#include "base/memory/weak_ptr.h" |
+#include "base/time.h" |
+#include "content/common/content_export.h" |
+ |
+struct ViewHostMsg_BeginSmoothScroll_Params; |
+ |
+namespace content { |
+ |
+class RenderWidgetHost; |
+class RenderWidgetHostViewPort; |
+class SmoothScrollGesture; |
+ |
+// Controls SmoothScrollGestures, used to inject synthetic events |
+// for performance test harness. |
+class CONTENT_EXPORT SmoothScrollGestureController { |
+ public: |
+ SmoothScrollGestureController(); |
+ ~SmoothScrollGestureController(); |
+ |
+ // Initiates a synthetic event stream. |
+ void OnBeginSmoothScroll( |
+ RenderWidgetHostViewPort* view, |
+ int gesture_id, const ViewHostMsg_BeginSmoothScroll_Params& params); |
+ |
+ // Called when an input event is going to be forwarded to the renderer. |
+ void OnForwardInputEvent(); |
+ |
+ // Called when the |rwh| received an ACK for an input event. |
+ void OnInputEventACK(RenderWidgetHost* rwh); |
+ |
+ int SyntheticScrollMessageInterval() const; |
+ |
+ private: |
+ // Called periodically to advance the active scroll gesture after being |
+ // initiated by OnBeginSmoothScroll. |
+ void TickActiveSmoothScrollGesture(RenderWidgetHost* rwh); |
+ |
+ base::WeakPtrFactory<SmoothScrollGestureController> weak_factory_; |
+ |
+ int pending_input_event_count_; |
+ |
+ typedef std::map<int, scoped_refptr<SmoothScrollGesture> > |
+ SmoothScrollGestureMap; |
+ SmoothScrollGestureMap active_smooth_scroll_gestures_; |
+ base::TimeTicks last_smooth_scroll_gestures_tick_time_; |
+ bool tick_active_smooth_scroll_gestures_task_posted_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SmoothScrollGestureController); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_RENDERER_HOST_SMOOTH_GESTURE_CONTROLLER_H_ |