| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 return; | 489 return; |
| 490 } | 490 } |
| 491 touch_queue_.push_back(new CoalescedWebTouchEvent(event, false)); | 491 touch_queue_.push_back(new CoalescedWebTouchEvent(event, false)); |
| 492 } | 492 } |
| 493 | 493 |
| 494 void TouchEventQueue::ProcessTouchAck(InputEventAckState ack_result, | 494 void TouchEventQueue::ProcessTouchAck(InputEventAckState ack_result, |
| 495 const LatencyInfo& latency_info, | 495 const LatencyInfo& latency_info, |
| 496 const uint32_t unique_touch_event_id) { | 496 const uint32_t unique_touch_event_id) { |
| 497 TRACE_EVENT0("input", "TouchEventQueue::ProcessTouchAck"); | 497 TRACE_EVENT0("input", "TouchEventQueue::ProcessTouchAck"); |
| 498 | 498 |
| 499 LOG(ERROR) << "======= mDebug " << __FUNCTION__ |
| 500 << " id=" << unique_touch_event_id |
| 501 << " |q| = " << touch_queue_.size(); |
| 502 |
| 499 // We receive an ack for async touchmove from render. | 503 // We receive an ack for async touchmove from render. |
| 500 if (!ack_pending_async_touchmove_ids_.empty() && | 504 if (!ack_pending_async_touchmove_ids_.empty() && |
| 501 ack_pending_async_touchmove_ids_.front() == unique_touch_event_id) { | 505 ack_pending_async_touchmove_ids_.front() == unique_touch_event_id) { |
| 502 // Remove the first touchmove from the ack_pending_async_touchmove queue. | 506 // Remove the first touchmove from the ack_pending_async_touchmove queue. |
| 503 ack_pending_async_touchmove_ids_.pop_front(); | 507 ack_pending_async_touchmove_ids_.pop_front(); |
| 504 // Send the next pending async touch move once we receive all acks back. | 508 // Send the next pending async touch move once we receive all acks back. |
| 505 if (pending_async_touchmove_ && ack_pending_async_touchmove_ids_.empty()) { | 509 if (pending_async_touchmove_ && ack_pending_async_touchmove_ids_.empty()) { |
| 506 DCHECK(touch_queue_.empty()); | 510 DCHECK(touch_queue_.empty()); |
| 507 | 511 |
| 508 // Dispatch the next pending async touch move when time expires. | 512 // Dispatch the next pending async touch move when time expires. |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 } | 776 } |
| 773 } | 777 } |
| 774 | 778 |
| 775 if (last_sent_touchevent_) | 779 if (last_sent_touchevent_) |
| 776 *last_sent_touchevent_ = touch->event; | 780 *last_sent_touchevent_ = touch->event; |
| 777 else | 781 else |
| 778 last_sent_touchevent_.reset(new WebTouchEvent(touch->event)); | 782 last_sent_touchevent_.reset(new WebTouchEvent(touch->event)); |
| 779 | 783 |
| 780 base::AutoReset<bool> dispatching_touch(&dispatching_touch_, true); | 784 base::AutoReset<bool> dispatching_touch(&dispatching_touch_, true); |
| 781 | 785 |
| 786 LOG(ERROR) << "======= mDebug " << __FUNCTION__ |
| 787 << " type=" << WebInputEventTraits::GetName(touch->event.type) |
| 788 << " id=" << touch->event.uniqueTouchEventId |
| 789 << " |q| = " << touch_queue_.size(); |
| 790 |
| 782 client_->SendTouchEventImmediately(*touch); | 791 client_->SendTouchEventImmediately(*touch); |
| 783 | 792 |
| 784 // A synchronous ack will reset |dispatching_touch_|, in which case the touch | 793 // A synchronous ack will reset |dispatching_touch_|, in which case the touch |
| 785 // timeout should not be started and the count also should not be increased. | 794 // timeout should not be started and the count also should not be increased. |
| 786 if (dispatching_touch_) { | 795 if (dispatching_touch_) { |
| 787 if (touch->event.type == WebInputEvent::TouchMove && | 796 if (touch->event.type == WebInputEvent::TouchMove && |
| 788 !touch->event.cancelable) { | 797 !touch->event.cancelable) { |
| 789 // When we send out a uncancelable touch move, we increase the count and | 798 // When we send out a uncancelable touch move, we increase the count and |
| 790 // we do not process input event ack any more, we will just ack to client | 799 // we do not process input event ack any more, we will just ack to client |
| 791 // and wait for the ack from render. Also we will remove it from the front | 800 // and wait for the ack from render. Also we will remove it from the front |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) | 889 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) |
| 881 send_touch_events_async_ = false; | 890 send_touch_events_async_ = false; |
| 882 has_handler_for_current_sequence_ |= | 891 has_handler_for_current_sequence_ |= |
| 883 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 892 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
| 884 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { | 893 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { |
| 885 has_handler_for_current_sequence_ = false; | 894 has_handler_for_current_sequence_ = false; |
| 886 } | 895 } |
| 887 } | 896 } |
| 888 | 897 |
| 889 } // namespace content | 898 } // namespace content |
| OLD | NEW |