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 "ui/events/gesture_detection/touch_disposition_gesture_filter.h" | 5 #include "ui/events/gesture_detection/touch_disposition_gesture_filter.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 return INVALID_PACKET_ORDER; | 161 return INVALID_PACKET_ORDER; |
162 | 162 |
163 if (packet.gesture_source() == GestureEventDataPacket::TOUCH_TIMEOUT && | 163 if (packet.gesture_source() == GestureEventDataPacket::TOUCH_TIMEOUT && |
164 Tail().empty()) { | 164 Tail().empty()) { |
165 // Handle the timeout packet immediately if the packet preceding the timeout | 165 // Handle the timeout packet immediately if the packet preceding the timeout |
166 // has already been dispatched. | 166 // has already been dispatched. |
167 FilterAndSendPacket(packet); | 167 FilterAndSendPacket(packet); |
168 return SUCCESS; | 168 return SUCCESS; |
169 } | 169 } |
170 | 170 |
171 // Check the packet's unique_touch_event_id is valid and unique. | 171 // Check the packet's unique_touch_event_id is valid and unique with the |
172 // exception of TOUCH_TIMEOUT packets which have the unique_touch_event_id_ | |
173 // of 0. | |
tdresser
2016/01/14 15:35:40
Add to this comment something along the lines of:
ananta
2016/01/14 20:09:30
Done.
| |
172 if (!Tail().empty()) { | 174 if (!Tail().empty()) { |
173 DCHECK_NE(packet.unique_touch_event_id(), | 175 DCHECK((packet.gesture_source() == GestureEventDataPacket::TOUCH_TIMEOUT) |
174 Tail().back().unique_touch_event_id()); | 176 || (packet.unique_touch_event_id() != |
177 Tail().back().unique_touch_event_id())); | |
175 } | 178 } |
176 if (!Head().empty()) { | 179 if (!Head().empty()) { |
177 DCHECK_NE(packet.unique_touch_event_id(), | 180 DCHECK((packet.gesture_source() == GestureEventDataPacket::TOUCH_TIMEOUT) |
178 Head().front().unique_touch_event_id()); | 181 || (packet.unique_touch_event_id() != |
182 Head().front().unique_touch_event_id())); | |
tdresser
2016/01/14 15:35:40
I don't think we should ever reach this code with
ananta
2016/01/14 20:09:30
No. I just changed the DCHECK for consistency. The
tdresser
2016/01/14 20:14:10
Yeah, it makes sense that the first would fire. Le
ananta
2016/01/14 20:21:14
Done.
| |
179 } | 183 } |
180 | 184 |
181 Tail().push(packet); | 185 Tail().push(packet); |
182 return SUCCESS; | 186 return SUCCESS; |
183 } | 187 } |
184 | 188 |
185 void TouchDispositionGestureFilter::OnTouchEventAck(uint32_t unique_event_id, | 189 void TouchDispositionGestureFilter::OnTouchEventAck(uint32_t unique_event_id, |
186 bool event_consumed) { | 190 bool event_consumed) { |
187 // Spurious asynchronous acks should not trigger a crash. | 191 // Spurious asynchronous acks should not trigger a crash. |
188 if (IsEmpty() || (Head().empty() && sequences_.size() == 1)) | 192 if (IsEmpty() || (Head().empty() && sequences_.size() == 1)) |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 return false; | 471 return false; |
468 } | 472 } |
469 | 473 |
470 bool TouchDispositionGestureFilter::GestureHandlingState:: | 474 bool TouchDispositionGestureFilter::GestureHandlingState:: |
471 HasFilteredGestureType(EventType gesture_type) const { | 475 HasFilteredGestureType(EventType gesture_type) const { |
472 return any_gesture_of_type_dropped_.has_bit( | 476 return any_gesture_of_type_dropped_.has_bit( |
473 GetGestureTypeIndex(gesture_type)); | 477 GetGestureTypeIndex(gesture_type)); |
474 } | 478 } |
475 | 479 |
476 } // namespace content | 480 } // namespace content |
OLD | NEW |