OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/renderer/input/main_thread_event_queue.h" | 5 #include "content/renderer/input/main_thread_event_queue.h" |
6 | 6 |
7 namespace content { | 7 namespace content { |
8 | 8 |
9 MainThreadEventQueue::MainThreadEventQueue(int routing_id, | 9 MainThreadEventQueue::MainThreadEventQueue(int routing_id, |
10 MainThreadEventQueueClient* client) | 10 MainThreadEventQueueClient* client) |
11 : routing_id_(routing_id), client_(client) {} | 11 : routing_id_(routing_id), client_(client), is_flinging_(false) {} |
12 | 12 |
13 MainThreadEventQueue::~MainThreadEventQueue() {} | 13 MainThreadEventQueue::~MainThreadEventQueue() {} |
14 | 14 |
15 bool MainThreadEventQueue::HandleEvent( | 15 bool MainThreadEventQueue::HandleEvent( |
16 const blink::WebInputEvent* event, | 16 const blink::WebInputEvent* event, |
17 const ui::LatencyInfo& latency, | 17 const ui::LatencyInfo& latency, |
18 InputEventDispatchType original_dispatch_type, | 18 InputEventDispatchType original_dispatch_type, |
19 InputEventAckState ack_result) { | 19 InputEventAckState ack_result) { |
20 DCHECK(original_dispatch_type == DISPATCH_TYPE_BLOCKING || | 20 DCHECK(original_dispatch_type == DISPATCH_TYPE_BLOCKING || |
21 original_dispatch_type == DISPATCH_TYPE_NON_BLOCKING); | 21 original_dispatch_type == DISPATCH_TYPE_NON_BLOCKING); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // having the main thread call us back as an optimization. | 56 // having the main thread call us back as an optimization. |
57 client_->SendEventToMainThread(routing_id_, | 57 client_->SendEventToMainThread(routing_id_, |
58 &modified_dispatch_type_event.event, | 58 &modified_dispatch_type_event.event, |
59 latency, original_dispatch_type); | 59 latency, original_dispatch_type); |
60 } | 60 } |
61 } | 61 } |
62 } else if (blink::WebInputEvent::isTouchEventType(event->type)) { | 62 } else if (blink::WebInputEvent::isTouchEventType(event->type)) { |
63 PendingTouchEvent modified_dispatch_type_event = | 63 PendingTouchEvent modified_dispatch_type_event = |
64 PendingTouchEvent(*static_cast<const blink::WebTouchEvent*>(event), | 64 PendingTouchEvent(*static_cast<const blink::WebTouchEvent*>(event), |
65 latency, dispatch_type); | 65 latency, dispatch_type); |
| 66 modified_dispatch_type_event.event.dispatchedDuringFling = is_flinging_; |
66 | 67 |
67 // Adjust the |dispatchType| on the event since the compositor | 68 // Adjust the |dispatchType| on the event since the compositor |
68 // determined all event listeners are passive. | 69 // determined all event listeners are passive. |
69 if (non_blocking) { | 70 if (non_blocking) { |
70 modified_dispatch_type_event.event.dispatchType = | 71 modified_dispatch_type_event.event.dispatchType = |
71 blink::WebInputEvent::ListenersNonBlockingPassive; | 72 blink::WebInputEvent::ListenersNonBlockingPassive; |
72 } | 73 } |
73 | 74 |
74 if (touch_events_.state() == WebInputEventQueueState::ITEM_PENDING) { | 75 if (touch_events_.state() == WebInputEventQueueState::ITEM_PENDING) { |
75 touch_events_.Queue(modified_dispatch_type_event); | 76 touch_events_.Queue(modified_dispatch_type_event); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 event->type); | 114 event->type); |
114 } else { | 115 } else { |
115 touch_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); | 116 touch_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); |
116 } | 117 } |
117 } else { | 118 } else { |
118 NOTREACHED() << "Invalid passive event type"; | 119 NOTREACHED() << "Invalid passive event type"; |
119 } | 120 } |
120 } | 121 } |
121 | 122 |
122 } // namespace content | 123 } // namespace content |
OLD | NEW |