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" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "content/browser/renderer_host/input/timeout_monitor.h" | 14 #include "content/browser/renderer_host/input/timeout_monitor.h" |
15 #include "content/common/input/web_touch_event_traits.h" | 15 #include "content/common/input/web_touch_event_traits.h" |
16 #include "ui/events/base_event_utils.h" | |
16 #include "ui/gfx/geometry/point_f.h" | 17 #include "ui/gfx/geometry/point_f.h" |
17 | 18 |
18 using blink::WebInputEvent; | 19 using blink::WebInputEvent; |
19 using blink::WebTouchEvent; | 20 using blink::WebTouchEvent; |
20 using blink::WebTouchPoint; | 21 using blink::WebTouchPoint; |
21 using ui::LatencyInfo; | 22 using ui::LatencyInfo; |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 namespace { | 25 namespace { |
25 | 26 |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 // triggered by TouchEventQueue::AckTouchEventToClient, which has just | 498 // triggered by TouchEventQueue::AckTouchEventToClient, which has just |
498 // received an ack for the in-flight event. We leave the head of the queue | 499 // received an ack for the in-flight event. We leave the head of the queue |
499 // untouched since it is the in-flight event. | 500 // untouched since it is the in-flight event. |
500 // | 501 // |
501 // However, for the (integration) tests in RenderWidgetHostTest that trigger | 502 // However, for the (integration) tests in RenderWidgetHostTest that trigger |
502 // this method indirectly, they push the TouchScrollStarted event into | 503 // this method indirectly, they push the TouchScrollStarted event into |
503 // TouchEventQueue without any way to dispatch it. Below we added a check for | 504 // TouchEventQueue without any way to dispatch it. Below we added a check for |
504 // non-empty queue to keep those tests as-is w/o exposing internals of this | 505 // non-empty queue to keep those tests as-is w/o exposing internals of this |
505 // class all the way up. | 506 // class all the way up. |
506 if (!touch_queue_.empty()) { | 507 if (!touch_queue_.empty()) { |
507 TouchEventWithLatencyInfo touch; | 508 TouchEventWithLatencyInfo touch( |
508 touch.event.type = WebInputEvent::TouchScrollStarted; | 509 WebInputEvent::TouchScrollStarted, WebInputEvent::NoModifiers, |
509 touch.event.uniqueTouchEventId = 0; | 510 ui::EventTimeStampToSeconds(base::TimeTicks::Now()), LatencyInfo()); |
majidvp
2016/12/19 20:09:52
nit: s/base::TimeTicks::Now()/ui::EventTimeForNow(
dtapuska
2016/12/20 19:49:21
Done.
| |
510 touch.event.touchesLength = 0; | |
511 touch.event.dispatchType = WebInputEvent::EventNonBlocking; | 511 touch.event.dispatchType = WebInputEvent::EventNonBlocking; |
512 | 512 |
513 auto it = touch_queue_.begin(); | 513 auto it = touch_queue_.begin(); |
514 DCHECK(it != touch_queue_.end()); | 514 DCHECK(it != touch_queue_.end()); |
515 touch_queue_.insert(++it, | 515 touch_queue_.insert(++it, |
516 base::MakeUnique<CoalescedWebTouchEvent>(touch, false)); | 516 base::MakeUnique<CoalescedWebTouchEvent>(touch, false)); |
517 } | 517 } |
518 } | 518 } |
519 | 519 |
520 void TouchEventQueue::ProcessTouchAck(InputEventAckState ack_result, | 520 void TouchEventQueue::ProcessTouchAck(InputEventAckState ack_result, |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
936 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) | 936 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) |
937 send_touch_events_async_ = false; | 937 send_touch_events_async_ = false; |
938 has_handler_for_current_sequence_ |= | 938 has_handler_for_current_sequence_ |= |
939 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 939 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
940 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { | 940 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { |
941 has_handler_for_current_sequence_ = false; | 941 has_handler_for_current_sequence_ = false; |
942 } | 942 } |
943 } | 943 } |
944 | 944 |
945 } // namespace content | 945 } // namespace content |
OLD | NEW |