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

Side by Side Diff: content/browser/renderer_host/input/input_router_impl.h

Issue 997283002: Coalesce async touch move events until the ack back from render (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change the unittests Created 5 years, 7 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 CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "content/browser/renderer_host/input/gesture_event_queue.h" 13 #include "content/browser/renderer_host/input/gesture_event_queue.h"
14 #include "content/browser/renderer_host/input/input_router.h" 14 #include "content/browser/renderer_host/input/input_router.h"
15 #include "content/browser/renderer_host/input/touch_action_filter.h" 15 #include "content/browser/renderer_host/input/touch_action_filter.h"
16 #include "content/browser/renderer_host/input/touch_event_queue.h" 16 #include "content/browser/renderer_host/input/touch_event_queue.h"
17 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h" 17 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h"
18 #include "content/common/input/input_event_stream_validator.h" 18 #include "content/common/input/input_event_stream_validator.h"
19 #include "content/public/browser/native_web_keyboard_event.h" 19 #include "content/public/browser/native_web_keyboard_event.h"
20 20
21 struct InputHostMsg_HandleInputEvent_ACK_Params;
22
23 namespace IPC { 21 namespace IPC {
24 class Sender; 22 class Sender;
25 } 23 }
26 24
27 namespace ui { 25 namespace ui {
28 struct LatencyInfo; 26 struct LatencyInfo;
29 } 27 }
30 28
31 namespace content { 29 namespace content {
32 30
33 class InputAckHandler; 31 class InputAckHandler;
34 class InputRouterClient; 32 class InputRouterClient;
35 class OverscrollController; 33 class OverscrollController;
36 struct DidOverscrollParams; 34 struct DidOverscrollParams;
35 struct InputEventAck;
37 36
38 // A default implementation for browser input event routing. 37 // A default implementation for browser input event routing.
39 class CONTENT_EXPORT InputRouterImpl 38 class CONTENT_EXPORT InputRouterImpl
40 : public NON_EXPORTED_BASE(InputRouter), 39 : public NON_EXPORTED_BASE(InputRouter),
41 public NON_EXPORTED_BASE(GestureEventQueueClient), 40 public NON_EXPORTED_BASE(GestureEventQueueClient),
42 public NON_EXPORTED_BASE(TouchEventQueueClient), 41 public NON_EXPORTED_BASE(TouchEventQueueClient),
43 public NON_EXPORTED_BASE(TouchpadTapSuppressionControllerClient) { 42 public NON_EXPORTED_BASE(TouchpadTapSuppressionControllerClient) {
44 public: 43 public:
45 struct CONTENT_EXPORT Config { 44 struct CONTENT_EXPORT Config {
46 Config(); 45 Config();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 bool OfferToClient(const blink::WebInputEvent& input_event, 116 bool OfferToClient(const blink::WebInputEvent& input_event,
118 const ui::LatencyInfo& latency_info); 117 const ui::LatencyInfo& latency_info);
119 118
120 // Returns true if |input_event| was successfully sent to the renderer 119 // Returns true if |input_event| was successfully sent to the renderer
121 // as an async IPC Message. 120 // as an async IPC Message.
122 bool OfferToRenderer(const blink::WebInputEvent& input_event, 121 bool OfferToRenderer(const blink::WebInputEvent& input_event,
123 const ui::LatencyInfo& latency_info, 122 const ui::LatencyInfo& latency_info,
124 bool is_keyboard_shortcut); 123 bool is_keyboard_shortcut);
125 124
126 // IPC message handlers 125 // IPC message handlers
127 void OnInputEventAck(const InputHostMsg_HandleInputEvent_ACK_Params& ack); 126 void OnInputEventAck(const InputEventAck& ack);
128 void OnDidOverscroll(const DidOverscrollParams& params); 127 void OnDidOverscroll(const DidOverscrollParams& params);
129 void OnMsgMoveCaretAck(); 128 void OnMsgMoveCaretAck();
130 void OnSelectMessageAck(); 129 void OnSelectMessageAck();
131 void OnHasTouchEventHandlers(bool has_handlers); 130 void OnHasTouchEventHandlers(bool has_handlers);
132 void OnSetTouchAction(TouchAction touch_action); 131 void OnSetTouchAction(TouchAction touch_action);
133 void OnDidStopFlinging(); 132 void OnDidStopFlinging();
134 133
135 // Indicates the source of an ack provided to |ProcessInputEventAck()|. 134 // Indicates the source of an ack provided to |ProcessInputEventAck()|.
136 // The source is tracked by |current_ack_source_|, which aids in ack routing. 135 // The source is tracked by |current_ack_source_|, which aids in ack routing.
137 enum AckSource { 136 enum AckSource {
138 RENDERER, 137 RENDERER,
139 CLIENT, 138 CLIENT,
140 IGNORING_DISPOSITION, 139 IGNORING_DISPOSITION,
141 ACK_SOURCE_NONE 140 ACK_SOURCE_NONE
142 }; 141 };
143 // Note: This function may result in |this| being deleted, and as such 142 // Note: This function may result in |this| being deleted, and as such
144 // should be the last method called in any internal chain of event handling. 143 // should be the last method called in any internal chain of event handling.
145 void ProcessInputEventAck(blink::WebInputEvent::Type event_type, 144 void ProcessInputEventAck(blink::WebInputEvent::Type event_type,
146 InputEventAckState ack_result, 145 InputEventAckState ack_result,
147 const ui::LatencyInfo& latency_info, 146 const ui::LatencyInfo& latency_info,
147 uint32 unique_touch_event_id,
148 AckSource ack_source); 148 AckSource ack_source);
149 149
150 // Dispatches the ack'ed event to |ack_handler_|. 150 // Dispatches the ack'ed event to |ack_handler_|.
151 void ProcessKeyboardAck(blink::WebInputEvent::Type type, 151 void ProcessKeyboardAck(blink::WebInputEvent::Type type,
152 InputEventAckState ack_result); 152 InputEventAckState ack_result);
153 153
154 // Forwards a valid |next_mouse_move_| if |type| is MouseMove. 154 // Forwards a valid |next_mouse_move_| if |type| is MouseMove.
155 void ProcessMouseAck(blink::WebInputEvent::Type type, 155 void ProcessMouseAck(blink::WebInputEvent::Type type,
156 InputEventAckState ack_result); 156 InputEventAckState ack_result);
157 157
158 // Dispatches the ack'ed event to |ack_handler_|, forwarding queued events 158 // Dispatches the ack'ed event to |ack_handler_|, forwarding queued events
159 // from |coalesced_mouse_wheel_events_|. 159 // from |coalesced_mouse_wheel_events_|.
160 void ProcessWheelAck(InputEventAckState ack_result, 160 void ProcessWheelAck(InputEventAckState ack_result,
161 const ui::LatencyInfo& latency); 161 const ui::LatencyInfo& latency);
162 162
163 // Forwards the event ack to |gesture_event_queue|, potentially triggering 163 // Forwards the event ack to |gesture_event_queue|, potentially triggering
164 // dispatch of queued gesture events. 164 // dispatch of queued gesture events.
165 void ProcessGestureAck(blink::WebInputEvent::Type type, 165 void ProcessGestureAck(blink::WebInputEvent::Type type,
166 InputEventAckState ack_result, 166 InputEventAckState ack_result,
167 const ui::LatencyInfo& latency); 167 const ui::LatencyInfo& latency);
168 168
169 // Forwards the event ack to |touch_event_queue_|, potentially triggering 169 // Forwards the event ack to |touch_event_queue_|, potentially triggering
170 // dispatch of queued touch events, or the creation of gesture events. 170 // dispatch of queued touch events, or the creation of gesture events.
171 void ProcessTouchAck(InputEventAckState ack_result, 171 void ProcessTouchAck(InputEventAckState ack_result,
172 const ui::LatencyInfo& latency); 172 const ui::LatencyInfo& latency,
173 uint32 unique_touch_event_id);
173 174
174 // Called when a touch timeout-affecting bit has changed, in turn toggling the 175 // Called when a touch timeout-affecting bit has changed, in turn toggling the
175 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input 176 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input
176 // to that determination includes current view properties and the allowed 177 // to that determination includes current view properties and the allowed
177 // touch action. Note that this will only affect platforms that have a 178 // touch action. Note that this will only affect platforms that have a
178 // non-zero touch timeout configuration. 179 // non-zero touch timeout configuration.
179 void UpdateTouchAckTimeoutEnabled(); 180 void UpdateTouchAckTimeoutEnabled();
180 181
181 // If a flush has been requested, signals a completed flush to the client if 182 // If a flush has been requested, signals a completed flush to the client if
182 // all events have been dispatched (i.e., |HasPendingEvents()| is false). 183 // all events have been dispatched (i.e., |HasPendingEvents()| is false).
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 TouchActionFilter touch_action_filter_; 258 TouchActionFilter touch_action_filter_;
258 InputEventStreamValidator input_stream_validator_; 259 InputEventStreamValidator input_stream_validator_;
259 InputEventStreamValidator output_stream_validator_; 260 InputEventStreamValidator output_stream_validator_;
260 261
261 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); 262 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl);
262 }; 263 };
263 264
264 } // namespace content 265 } // namespace content
265 266
266 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ 267 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698