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

Side by Side Diff: ui/events/blink/input_handler_proxy.h

Issue 2429953002: Implement compositor thread VSync aligned event queue (Closed)
Patch Set: dtapuska's review: Non-template CompositorThreadEventQueue; Added blink_features.h; UMA only when e… Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_ 5 #ifndef UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_
6 #define UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_ 6 #define UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "cc/input/input_handler.h" 12 #include "cc/input/input_handler.h"
13 #include "third_party/WebKit/public/platform/WebGestureCurve.h" 13 #include "third_party/WebKit/public/platform/WebGestureCurve.h"
14 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" 14 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h"
15 #include "third_party/WebKit/public/platform/WebInputEvent.h" 15 #include "third_party/WebKit/public/platform/WebInputEvent.h"
16 #include "third_party/WebKit/public/web/WebActiveWheelFlingParameters.h" 16 #include "third_party/WebKit/public/web/WebActiveWheelFlingParameters.h"
17 #include "ui/events/blink/blink_features.h"
17 #include "ui/events/blink/input_scroll_elasticity_controller.h" 18 #include "ui/events/blink/input_scroll_elasticity_controller.h"
18 #include "ui/events/blink/scoped_web_input_event.h" 19 #include "ui/events/blink/scoped_web_input_event.h"
19 #include "ui/events/blink/synchronous_input_handler_proxy.h" 20 #include "ui/events/blink/synchronous_input_handler_proxy.h"
20 21
21 namespace ui { 22 namespace ui {
22 23
23 namespace test { 24 namespace test {
24 class InputHandlerProxyTest; 25 class InputHandlerProxyTest;
26 class InputHandlerProxyEventQueueTest;
25 } 27 }
26 28
29 class CompositorThreadEventQueue;
30 class EventWithCallback;
27 class InputHandlerProxyClient; 31 class InputHandlerProxyClient;
28 class InputScrollElasticityController; 32 class InputScrollElasticityController;
29 class SynchronousInputHandler; 33 class SynchronousInputHandler;
30 class SynchronousInputHandlerProxy; 34 class SynchronousInputHandlerProxy;
31 struct DidOverscrollParams; 35 struct DidOverscrollParams;
32 36
33 // This class is a proxy between the blink web input events for a WebWidget and 37 // This class is a proxy between the blink web input events for a WebWidget and
34 // the compositor's input handling logic. InputHandlerProxy instances live 38 // the compositor's input handling logic. InputHandlerProxy instances live
35 // entirely on the compositor thread. Each InputHandler instance handles input 39 // entirely on the compositor thread. Each InputHandler instance handles input
36 // events intended for a specific WebWidget. 40 // events intended for a specific WebWidget.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void Animate(base::TimeTicks time) override; 76 void Animate(base::TimeTicks time) override;
73 void MainThreadHasStoppedFlinging() override; 77 void MainThreadHasStoppedFlinging() override;
74 void ReconcileElasticOverscrollAndRootScroll() override; 78 void ReconcileElasticOverscrollAndRootScroll() override;
75 void UpdateRootLayerStateForSynchronousInputHandler( 79 void UpdateRootLayerStateForSynchronousInputHandler(
76 const gfx::ScrollOffset& total_scroll_offset, 80 const gfx::ScrollOffset& total_scroll_offset,
77 const gfx::ScrollOffset& max_scroll_offset, 81 const gfx::ScrollOffset& max_scroll_offset,
78 const gfx::SizeF& scrollable_size, 82 const gfx::SizeF& scrollable_size,
79 float page_scale_factor, 83 float page_scale_factor,
80 float min_page_scale_factor, 84 float min_page_scale_factor,
81 float max_page_scale_factor) override; 85 float max_page_scale_factor) override;
86 void DeliverInputForBeginFrame() override;
82 87
83 // SynchronousInputHandlerProxy implementation. 88 // SynchronousInputHandlerProxy implementation.
84 void SetOnlySynchronouslyAnimateRootFlings( 89 void SetOnlySynchronouslyAnimateRootFlings(
85 SynchronousInputHandler* synchronous_input_handler) override; 90 SynchronousInputHandler* synchronous_input_handler) override;
86 void SynchronouslyAnimate(base::TimeTicks time) override; 91 void SynchronouslyAnimate(base::TimeTicks time) override;
87 void SynchronouslySetRootScrollOffset( 92 void SynchronouslySetRootScrollOffset(
88 const gfx::ScrollOffset& root_offset) override; 93 const gfx::ScrollOffset& root_offset) override;
89 void SynchronouslyZoomBy(float magnify_delta, 94 void SynchronouslyZoomBy(float magnify_delta,
90 const gfx::Point& anchor) override; 95 const gfx::Point& anchor) override;
91 96
92 // blink::WebGestureCurveTarget implementation. 97 // blink::WebGestureCurveTarget implementation.
93 bool scrollBy(const blink::WebFloatSize& offset, 98 bool scrollBy(const blink::WebFloatSize& offset,
94 const blink::WebFloatSize& velocity) override; 99 const blink::WebFloatSize& velocity) override;
95 100
96 bool gesture_scroll_on_impl_thread_for_testing() const { 101 bool gesture_scroll_on_impl_thread_for_testing() const {
97 return gesture_scroll_on_impl_thread_; 102 return gesture_scroll_on_impl_thread_;
98 } 103 }
99 104
100 protected: 105 protected:
101 void RecordMainThreadScrollingReasons(blink::WebGestureDevice device, 106 void RecordMainThreadScrollingReasons(blink::WebGestureDevice device,
102 uint32_t reasons); 107 uint32_t reasons);
103 108
104 private: 109 private:
105 friend class test::InputHandlerProxyTest; 110 friend class test::InputHandlerProxyTest;
111 friend class test::InputHandlerProxyEventQueueTest;
112
113 void DispatchSingleInputEvent(std::unique_ptr<EventWithCallback>);
114 void DispatchQueuedInputEvent();
106 115
107 // Helper functions for handling more complicated input events. 116 // Helper functions for handling more complicated input events.
108 EventDisposition HandleMouseWheel( 117 EventDisposition HandleMouseWheel(
109 const blink::WebMouseWheelEvent& event); 118 const blink::WebMouseWheelEvent& event);
110 EventDisposition ScrollByMouseWheel( 119 EventDisposition ScrollByMouseWheel(
111 const blink::WebMouseWheelEvent& event, 120 const blink::WebMouseWheelEvent& event,
112 cc::EventListenerProperties listener_properties); 121 cc::EventListenerProperties listener_properties);
113 EventDisposition HandleGestureScrollBegin( 122 EventDisposition HandleGestureScrollBegin(
114 const blink::WebGestureEvent& event); 123 const blink::WebGestureEvent& event);
115 EventDisposition HandleGestureScrollUpdate( 124 EventDisposition HandleGestureScrollUpdate(
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 int32_t touch_start_result_; 229 int32_t touch_start_result_;
221 230
222 base::TimeTicks last_fling_animate_time_; 231 base::TimeTicks last_fling_animate_time_;
223 232
224 // Used to record overscroll notifications while an event is being 233 // Used to record overscroll notifications while an event is being
225 // dispatched. If the event causes overscroll, the overscroll metadata can be 234 // dispatched. If the event causes overscroll, the overscroll metadata can be
226 // bundled in the event ack, saving an IPC. Note that we must continue 235 // bundled in the event ack, saving an IPC. Note that we must continue
227 // supporting overscroll IPC notifications due to fling animation updates. 236 // supporting overscroll IPC notifications due to fling animation updates.
228 std::unique_ptr<DidOverscrollParams> current_overscroll_params_; 237 std::unique_ptr<DidOverscrollParams> current_overscroll_params_;
229 238
239 std::unique_ptr<CompositorThreadEventQueue> event_queue_;
240 bool has_ongoing_compositor_scroll_pinch;
tdresser 2016/11/01 18:12:44 Missing trailing _
chongz 2016/11/02 21:29:33 Done.
241 bool compositor_event_queue_enabled_;
242
230 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy); 243 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy);
231 }; 244 };
232 245
233 } // namespace ui 246 } // namespace ui
234 247
235 #endif // UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_ 248 #endif // UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698