Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / content / browser / renderer_host / smooth_scroll_gesture_controller.h
blob6e25cd72de8ce2cde3bf0a312df3f019e7b9fbbc
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_SMOOTH_SCROLL_GESTURE_CONTROLLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_SMOOTH_SCROLL_GESTURE_CONTROLLER_H_
8 #include <map>
10 #include "base/memory/weak_ptr.h"
11 #include "base/time.h"
12 #include "base/timer.h"
13 #include "content/common/content_export.h"
15 struct ViewHostMsg_BeginSmoothScroll_Params;
17 namespace content {
19 class RenderWidgetHost;
20 class RenderWidgetHostViewPort;
21 class SmoothScrollGesture;
23 // Controls SmoothScrollGestures, used to inject synthetic events
24 // for performance test harness.
25 class CONTENT_EXPORT SmoothScrollGestureController {
26 public:
27 SmoothScrollGestureController();
28 ~SmoothScrollGestureController();
30 // Initiates a synthetic event stream.
31 void BeginSmoothScroll(RenderWidgetHostViewPort* view,
32 const ViewHostMsg_BeginSmoothScroll_Params& params);
34 base::TimeDelta GetSyntheticScrollMessageInterval() const;
36 private:
37 // Called periodically to advance the active scroll gesture after being
38 // initiated by OnBeginSmoothScroll.
39 void OnTimer();
41 base::RepeatingTimer<SmoothScrollGestureController> timer_;
43 RenderWidgetHost* rwh_;
45 scoped_refptr<SmoothScrollGesture> pending_smooth_scroll_gesture_;
47 DISALLOW_COPY_AND_ASSIGN(SmoothScrollGestureController);
50 } // namespace content
52 #endif // CONTENT_BROWSER_RENDERER_HOST_SMOOTH_SCROLL_GESTURE_CONTROLLER_H_