OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/browser/renderer_host/input/gesture_event_queue.h" | 5 #include "content/browser/renderer_host/input/gesture_event_queue.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" | 8 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" |
9 #include "content/browser/renderer_host/input/touchscreen_tap_suppression_contro
ller.h" | 9 #include "content/browser/renderer_host/input/touchscreen_tap_suppression_contro
ller.h" |
10 | 10 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 const ui::LatencyInfo& latency) { | 200 const ui::LatencyInfo& latency) { |
201 TRACE_EVENT0("input", "GestureEventQueue::ProcessGestureAck"); | 201 TRACE_EVENT0("input", "GestureEventQueue::ProcessGestureAck"); |
202 | 202 |
203 if (coalesced_gesture_events_.empty()) { | 203 if (coalesced_gesture_events_.empty()) { |
204 DLOG(ERROR) << "Received unexpected ACK for event type " << type; | 204 DLOG(ERROR) << "Received unexpected ACK for event type " << type; |
205 return; | 205 return; |
206 } | 206 } |
207 | 207 |
208 // It's possible that the ack for the second event in an in-flight, coalesced | 208 // It's possible that the ack for the second event in an in-flight, coalesced |
209 // Gesture{Scroll,Pinch}Update pair is received prior to the first event ack. | 209 // Gesture{Scroll,Pinch}Update pair is received prior to the first event ack. |
210 // TODO(jdduke): Unify GSU/GPU pairs into a single event, crbug.com/359115. | |
211 size_t event_index = 0; | 210 size_t event_index = 0; |
212 if (ignore_next_ack_ && | 211 if (ignore_next_ack_ && |
213 coalesced_gesture_events_.size() > 1 && | 212 coalesced_gesture_events_.size() > 1 && |
214 coalesced_gesture_events_[0].event.type != type && | 213 coalesced_gesture_events_[0].event.type != type && |
215 coalesced_gesture_events_[1].event.type == type) { | 214 coalesced_gesture_events_[1].event.type == type) { |
216 event_index = 1; | 215 event_index = 1; |
217 } | 216 } |
218 GestureEventWithLatencyInfo event_with_latency = | 217 GestureEventWithLatencyInfo event_with_latency = |
219 coalesced_gesture_events_[event_index]; | 218 coalesced_gesture_events_[event_index]; |
220 DCHECK_EQ(event_with_latency.event.type, type); | 219 DCHECK_EQ(event_with_latency.event.type, type); |
(...skipping 20 matching lines...) Expand all Loading... |
241 ignore_next_ack_ = false; | 240 ignore_next_ack_ = false; |
242 return; | 241 return; |
243 } | 242 } |
244 | 243 |
245 if (coalesced_gesture_events_.empty()) | 244 if (coalesced_gesture_events_.empty()) |
246 return; | 245 return; |
247 | 246 |
248 const GestureEventWithLatencyInfo& first_gesture_event = | 247 const GestureEventWithLatencyInfo& first_gesture_event = |
249 coalesced_gesture_events_.front(); | 248 coalesced_gesture_events_.front(); |
250 | 249 |
251 // TODO(jdduke): Unify GSU/GPU pairs into a single event, crbug.com/359115. | |
252 // Check for the coupled GesturePinchUpdate before sending either event, | 250 // Check for the coupled GesturePinchUpdate before sending either event, |
253 // handling the case where the first GestureScrollUpdate ack is synchronous. | 251 // handling the case where the first GestureScrollUpdate ack is synchronous. |
254 GestureEventWithLatencyInfo second_gesture_event; | 252 GestureEventWithLatencyInfo second_gesture_event; |
255 if (first_gesture_event.event.type == WebInputEvent::GestureScrollUpdate && | 253 if (first_gesture_event.event.type == WebInputEvent::GestureScrollUpdate && |
256 coalesced_gesture_events_.size() > 1 && | 254 coalesced_gesture_events_.size() > 1 && |
257 coalesced_gesture_events_[1].event.type == | 255 coalesced_gesture_events_[1].event.type == |
258 WebInputEvent::GesturePinchUpdate) { | 256 WebInputEvent::GesturePinchUpdate) { |
259 second_gesture_event = coalesced_gesture_events_[1]; | 257 second_gesture_event = coalesced_gesture_events_[1]; |
260 ignore_next_ack_ = true; | 258 ignore_next_ack_ = true; |
261 } | 259 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 return 0; | 388 return 0; |
391 | 389 |
392 if (!ignore_next_ack_) | 390 if (!ignore_next_ack_) |
393 return 1; | 391 return 1; |
394 | 392 |
395 DCHECK_GT(coalesced_gesture_events_.size(), 1U); | 393 DCHECK_GT(coalesced_gesture_events_.size(), 1U); |
396 return 2; | 394 return 2; |
397 } | 395 } |
398 | 396 |
399 } // namespace content | 397 } // namespace content |
OLD | NEW |