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) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 } | 91 } |
92 } else { | 92 } else { |
93 client_->SendEventToMainThread(routing_id_, event, latency, | 93 client_->SendEventToMainThread(routing_id_, event, latency, |
94 original_dispatch_type); | 94 original_dispatch_type); |
95 } | 95 } |
96 | 96 |
97 // send an ack when we are non-blocking. | 97 // send an ack when we are non-blocking. |
98 return non_blocking; | 98 return non_blocking; |
99 } | 99 } |
100 | 100 |
101 void MainThreadEventQueue::EventHandled(blink::WebInputEvent::Type type) { | 101 void MainThreadEventQueue::EventHandled(blink::WebInputEvent::Type type, |
102 InputEventAckState ack_result) { | |
102 if (type == blink::WebInputEvent::MouseWheel) { | 103 if (type == blink::WebInputEvent::MouseWheel) { |
104 if (in_flight_wheel_event_) { | |
105 // Send acks for blocking wheel events. | |
106 for (const auto id : in_flight_wheel_event_->eventsToAck) | |
tdresser
2016/06/28 14:04:49
eventsToAck is just a list of zeroes, which is pre
dtapuska
2016/06/28 17:30:21
Changed to be a dcheck.
| |
107 client_->SendInputEventAck(routing_id_, type, ack_result, id); | |
108 } | |
109 | |
103 if (!wheel_events_.empty()) { | 110 if (!wheel_events_.empty()) { |
104 std::unique_ptr<PendingMouseWheelEvent> event = wheel_events_.Pop(); | 111 in_flight_wheel_event_ = wheel_events_.Pop(); |
105 client_->SendEventToMainThread(routing_id_, &event->event, event->latency, | 112 client_->SendEventToMainThread( |
106 event->type); | 113 routing_id_, &in_flight_wheel_event_->event, |
114 in_flight_wheel_event_->latency, in_flight_wheel_event_->type); | |
107 } else { | 115 } else { |
116 in_flight_wheel_event_.reset(); | |
108 wheel_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); | 117 wheel_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); |
109 } | 118 } |
110 } else if (blink::WebInputEvent::isTouchEventType(type)) { | 119 } else if (blink::WebInputEvent::isTouchEventType(type)) { |
120 if (in_flight_touch_event_) { | |
121 // Send acks for blocking touch events. | |
122 for (const auto id : in_flight_touch_event_->eventsToAck) | |
123 client_->SendInputEventAck(routing_id_, type, ack_result, id); | |
124 } | |
125 | |
111 if (!touch_events_.empty()) { | 126 if (!touch_events_.empty()) { |
112 std::unique_ptr<PendingTouchEvent> event = touch_events_.Pop(); | 127 in_flight_touch_event_ = touch_events_.Pop(); |
113 client_->SendEventToMainThread(routing_id_, &event->event, event->latency, | 128 client_->SendEventToMainThread( |
114 event->type); | 129 routing_id_, &in_flight_touch_event_->event, |
130 in_flight_touch_event_->latency, in_flight_touch_event_->type); | |
115 } else { | 131 } else { |
132 in_flight_touch_event_.reset(); | |
116 touch_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); | 133 touch_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); |
117 } | 134 } |
118 } else { | 135 } else { |
119 NOTREACHED() << "Invalid passive event type"; | 136 NOTREACHED() << "Invalid passive event type"; |
120 } | 137 } |
121 } | 138 } |
122 | 139 |
123 } // namespace content | 140 } // namespace content |
OLD | NEW |