| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 return true; | 64 return true; |
| 65 } | 65 } |
| 66 | 66 |
| 67 return false; | 67 return false; |
| 68 } | 68 } |
| 69 | 69 |
| 70 const TouchEventWithLatencyInfo& coalesced_event() const { | 70 const TouchEventWithLatencyInfo& coalesced_event() const { |
| 71 return coalesced_event_; | 71 return coalesced_event_; |
| 72 } | 72 } |
| 73 | 73 |
| 74 WebTouchEventWithLatencyList::const_iterator begin() const { | 74 WebTouchEventWithLatencyList::iterator begin() { |
| 75 return events_.begin(); | 75 return events_.begin(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 WebTouchEventWithLatencyList::const_iterator end() const { | 78 WebTouchEventWithLatencyList::iterator end() { |
| 79 return events_.end(); | 79 return events_.end(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 size_t size() const { return events_.size(); } | 82 size_t size() const { return events_.size(); } |
| 83 | 83 |
| 84 bool ignore_ack() const { return ignore_ack_; } | 84 bool ignore_ack() const { return ignore_ack_; } |
| 85 void set_ignore_ack(bool value) { ignore_ack_ = value; } | 85 void set_ignore_ack(bool value) { ignore_ack_ = value; } |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 // This is the event that is forwarded to the renderer. | 88 // This is the event that is forwarded to the renderer. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 touch_queue_.pop_front(); | 236 touch_queue_.pop_front(); |
| 237 | 237 |
| 238 if (acked_event->ignore_ack()) | 238 if (acked_event->ignore_ack()) |
| 239 return; | 239 return; |
| 240 | 240 |
| 241 // Note that acking the touch-event may result in multiple gestures being sent | 241 // Note that acking the touch-event may result in multiple gestures being sent |
| 242 // to the renderer, or touch-events being queued. | 242 // to the renderer, or touch-events being queued. |
| 243 base::AutoReset<CoalescedWebTouchEvent*> | 243 base::AutoReset<CoalescedWebTouchEvent*> |
| 244 dispatching_touch_ack(&dispatching_touch_ack_, acked_event.get()); | 244 dispatching_touch_ack(&dispatching_touch_ack_, acked_event.get()); |
| 245 | 245 |
| 246 base::TimeTicks now = base::TimeTicks::HighResNow(); | 246 for (WebTouchEventWithLatencyList::iterator iter = acked_event->begin(), |
| 247 for (WebTouchEventWithLatencyList::const_iterator iter = acked_event->begin(), | |
| 248 end = acked_event->end(); | 247 end = acked_event->end(); |
| 249 iter != end; ++iter) { | 248 iter != end; ++iter) { |
| 250 ui::LatencyInfo* latency = const_cast<ui::LatencyInfo*>(&(iter->latency)); | 249 iter->latency.AddNewLatencyFrom(renderer_latency_info); |
| 251 latency->AddNewLatencyFrom(renderer_latency_info); | |
| 252 latency->AddLatencyNumberWithTimestamp( | |
| 253 ui::INPUT_EVENT_LATENCY_ACKED_COMPONENT, 0, 0, now, 1); | |
| 254 client_->OnTouchEventAck((*iter), ack_result); | 250 client_->OnTouchEventAck((*iter), ack_result); |
| 255 } | 251 } |
| 256 } | 252 } |
| 257 | 253 |
| 258 bool TouchEventQueue::ShouldForwardToRenderer( | 254 bool TouchEventQueue::ShouldForwardToRenderer( |
| 259 const WebKit::WebTouchEvent& event) const { | 255 const WebKit::WebTouchEvent& event) const { |
| 260 if (no_touch_to_renderer_ && | 256 if (no_touch_to_renderer_ && |
| 261 event.type != WebKit::WebInputEvent::TouchCancel) | 257 event.type != WebKit::WebInputEvent::TouchCancel) |
| 262 return false; | 258 return false; |
| 263 | 259 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 279 // If the ACK status of a point is unknown, then the event should be | 275 // If the ACK status of a point is unknown, then the event should be |
| 280 // forwarded to the renderer. | 276 // forwarded to the renderer. |
| 281 return true; | 277 return true; |
| 282 } | 278 } |
| 283 } | 279 } |
| 284 | 280 |
| 285 return false; | 281 return false; |
| 286 } | 282 } |
| 287 | 283 |
| 288 } // namespace content | 284 } // namespace content |
| OLD | NEW |