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

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

Issue 2265393002: Refactor compositor event handling path to be callback-based (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: creis's review, rebase Created 4 years, 3 months 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/input_scroll_elasticity_controller.h" 17 #include "ui/events/blink/input_scroll_elasticity_controller.h"
18 #include "ui/events/blink/scoped_web_input_event.h"
18 #include "ui/events/blink/synchronous_input_handler_proxy.h" 19 #include "ui/events/blink/synchronous_input_handler_proxy.h"
19 20
20 namespace ui { 21 namespace ui {
21 22
22 namespace test { 23 namespace test {
23 class InputHandlerProxyTest; 24 class InputHandlerProxyTest;
24 } 25 }
25 26
26 class InputHandlerProxyClient; 27 class InputHandlerProxyClient;
27 class InputScrollElasticityController; 28 class InputScrollElasticityController;
(...skipping 20 matching lines...) Expand all
48 } 49 }
49 50
50 void set_smooth_scroll_enabled(bool value) { smooth_scroll_enabled_ = value; } 51 void set_smooth_scroll_enabled(bool value) { smooth_scroll_enabled_ = value; }
51 52
52 enum EventDisposition { 53 enum EventDisposition {
53 DID_HANDLE, 54 DID_HANDLE,
54 DID_NOT_HANDLE, 55 DID_NOT_HANDLE,
55 DID_HANDLE_NON_BLOCKING, 56 DID_HANDLE_NON_BLOCKING,
56 DROP_EVENT 57 DROP_EVENT
57 }; 58 };
58 EventDisposition HandleInputEventWithLatencyInfo( 59 using EventDispositionCallback =
59 const blink::WebInputEvent& event, 60 base::Callback<void(EventDisposition,
60 ui::LatencyInfo* latency_info); 61 ScopedWebInputEvent WebInputEvent,
62 const LatencyInfo&,
63 std::unique_ptr<ui::DidOverscrollParams>)>;
64 void HandleInputEventWithLatencyInfo(
65 ScopedWebInputEvent event,
66 const LatencyInfo& latency_info,
67 const EventDispositionCallback& callback);
61 EventDisposition HandleInputEvent(const blink::WebInputEvent& event); 68 EventDisposition HandleInputEvent(const blink::WebInputEvent& event);
62 69
63 // cc::InputHandlerClient implementation. 70 // cc::InputHandlerClient implementation.
64 void WillShutdown() override; 71 void WillShutdown() override;
65 void Animate(base::TimeTicks time) override; 72 void Animate(base::TimeTicks time) override;
66 void MainThreadHasStoppedFlinging() override; 73 void MainThreadHasStoppedFlinging() override;
67 void ReconcileElasticOverscrollAndRootScroll() override; 74 void ReconcileElasticOverscrollAndRootScroll() override;
68 void UpdateRootLayerStateForSynchronousInputHandler( 75 void UpdateRootLayerStateForSynchronousInputHandler(
69 const gfx::ScrollOffset& total_scroll_offset, 76 const gfx::ScrollOffset& total_scroll_offset,
70 const gfx::ScrollOffset& max_scroll_offset, 77 const gfx::ScrollOffset& max_scroll_offset,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 bool CancelCurrentFling(); 138 bool CancelCurrentFling();
132 139
133 // Returns true if we actually had an active fling to cancel. 140 // Returns true if we actually had an active fling to cancel.
134 bool CancelCurrentFlingWithoutNotifyingClient(); 141 bool CancelCurrentFlingWithoutNotifyingClient();
135 142
136 // Request a frame of animation from the InputHandler or 143 // Request a frame of animation from the InputHandler or
137 // SynchronousInputHandler. They can provide that by calling Animate(). 144 // SynchronousInputHandler. They can provide that by calling Animate().
138 void RequestAnimation(); 145 void RequestAnimation();
139 146
140 // Used to send overscroll messages to the browser. 147 // Used to send overscroll messages to the browser.
141 void HandleOverscroll( 148 // |bundle_overscroll_params_with_ack| means overscroll message should be
142 const gfx::Point& causal_event_viewport_point, 149 // bundled with triggering event response, and won't fire |DidOverscroll|.
143 const cc::InputHandlerScrollResult& scroll_result); 150 void HandleOverscroll(const gfx::Point& causal_event_viewport_point,
151 const cc::InputHandlerScrollResult& scroll_result,
152 bool bundle_overscroll_params_with_ack);
144 153
145 // Whether to use a smooth scroll animation for this event. 154 // Whether to use a smooth scroll animation for this event.
146 bool ShouldAnimate(bool has_precise_scroll_deltas) const; 155 bool ShouldAnimate(bool has_precise_scroll_deltas) const;
147 156
148 // Update the elastic overscroll controller with |gesture_event|. 157 // Update the elastic overscroll controller with |gesture_event|.
149 void HandleScrollElasticityOverscroll( 158 void HandleScrollElasticityOverscroll(
150 const blink::WebGestureEvent& gesture_event, 159 const blink::WebGestureEvent& gesture_event,
151 const cc::InputHandlerScrollResult& scroll_result); 160 const cc::InputHandlerScrollResult& scroll_result);
152 161
153 std::unique_ptr<blink::WebGestureCurve> fling_curve_; 162 std::unique_ptr<blink::WebGestureCurve> fling_curve_;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 bool smooth_scroll_enabled_; 212 bool smooth_scroll_enabled_;
204 bool uma_latency_reporting_enabled_; 213 bool uma_latency_reporting_enabled_;
205 214
206 // The merged result of the last touch start with previous touch starts. 215 // The merged result of the last touch start with previous touch starts.
207 // This value will get returned for subsequent TouchMove events to allow 216 // This value will get returned for subsequent TouchMove events to allow
208 // passive events not to block scrolling. 217 // passive events not to block scrolling.
209 int32_t touch_start_result_; 218 int32_t touch_start_result_;
210 219
211 base::TimeTicks last_fling_animate_time_; 220 base::TimeTicks last_fling_animate_time_;
212 221
222 // Used to record overscroll notifications while an event is being
223 // dispatched. If the event causes overscroll, the overscroll metadata can be
224 // bundled in the event ack, saving an IPC. Note that we must continue
225 // supporting overscroll IPC notifications due to fling animation updates.
226 std::unique_ptr<DidOverscrollParams> current_overscroll_params_;
227
213 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy); 228 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy);
214 }; 229 };
215 230
216 } // namespace ui 231 } // namespace ui
217 232
218 #endif // UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_ 233 #endif // UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_
OLDNEW
« no previous file with comments | « content/renderer/mus/render_widget_mus_connection.cc ('k') | ui/events/blink/input_handler_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698