| OLD | NEW |
| 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 #include "content/browser/renderer_host/input/touch_event_queue.h" | 5 #include "content/browser/renderer_host/input/touch_event_queue.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 | 10 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 | 196 |
| 197 void TouchEventQueue::FlushQueue() { | 197 void TouchEventQueue::FlushQueue() { |
| 198 DCHECK(!dispatching_touch_ack_); | 198 DCHECK(!dispatching_touch_ack_); |
| 199 while (!touch_queue_.empty()) | 199 while (!touch_queue_.empty()) |
| 200 PopTouchEventToClient(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, | 200 PopTouchEventToClient(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, |
| 201 ui::LatencyInfo()); | 201 ui::LatencyInfo()); |
| 202 } | 202 } |
| 203 | 203 |
| 204 bool TouchEventQueue::IsTouchStartPendingAck(int touch_id) |
| 205 { |
| 206 if (touch_queue_.empty()) |
| 207 return false; |
| 208 |
| 209 const WebKit::WebTouchEvent& event = |
| 210 touch_queue_.front()->coalesced_event().event; |
| 211 if (event.type == WebKit::WebInputEvent::TouchStart) { |
| 212 for (unsigned i = 0; i < event.touchesLength; ++i) { |
| 213 const WebKit::WebTouchPoint& point = event.touches[i]; |
| 214 if (point.state == WebKit::WebTouchPoint::StatePressed && |
| 215 point.id == touch_id) |
| 216 return true; |
| 217 } |
| 218 } |
| 219 |
| 220 return false; |
| 221 } |
| 222 |
| 204 size_t TouchEventQueue::GetQueueSize() const { | 223 size_t TouchEventQueue::GetQueueSize() const { |
| 205 return touch_queue_.size(); | 224 return touch_queue_.size(); |
| 206 } | 225 } |
| 207 | 226 |
| 208 const TouchEventWithLatencyInfo& TouchEventQueue::GetLatestEvent() const { | 227 const TouchEventWithLatencyInfo& TouchEventQueue::GetLatestEvent() const { |
| 209 return touch_queue_.back()->coalesced_event(); | 228 return touch_queue_.back()->coalesced_event(); |
| 210 } | 229 } |
| 211 | 230 |
| 212 void TouchEventQueue::PopTouchEventToClient( | 231 void TouchEventQueue::PopTouchEventToClient( |
| 213 InputEventAckState ack_result, | 232 InputEventAckState ack_result, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // If the ACK status of a point is unknown, then the event should be | 276 // If the ACK status of a point is unknown, then the event should be |
| 258 // forwarded to the renderer. | 277 // forwarded to the renderer. |
| 259 return true; | 278 return true; |
| 260 } | 279 } |
| 261 } | 280 } |
| 262 | 281 |
| 263 return false; | 282 return false; |
| 264 } | 283 } |
| 265 | 284 |
| 266 } // namespace content | 285 } // namespace content |
| OLD | NEW |