Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 dispatch_type); | 41 dispatch_type); |
| 42 } else { | 42 } else { |
| 43 // If there is nothing in the event queue and the event is | 43 // If there is nothing in the event queue and the event is |
| 44 // blocking pass the |original_dispatch_type| to avoid | 44 // blocking pass the |original_dispatch_type| to avoid |
| 45 // having the main thread call us back as an optimization. | 45 // having the main thread call us back as an optimization. |
| 46 client_->SendEventToMainThread(routing_id_, event, latency, | 46 client_->SendEventToMainThread(routing_id_, event, latency, |
| 47 original_dispatch_type); | 47 original_dispatch_type); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 } else if (blink::WebInputEvent::isTouchEventType(event->type)) { | 50 } else if (blink::WebInputEvent::isTouchEventType(event->type)) { |
| 51 PendingTouchEvent new_touch_event = | |
|
dtapuska
2016/04/18 20:10:37
err this is a poorly name variable. I thought I ch
| |
| 52 PendingTouchEvent(*static_cast<const blink::WebTouchEvent*>(event), | |
| 53 latency, dispatch_type); | |
| 54 if (non_blocking) { | |
| 55 new_touch_event.event.dispatchType = | |
| 56 blink::WebInputEvent::ListenersNonBlockingPassive; | |
|
tdresser
2016/04/18 20:22:40
Hrm, this is a bit confusing, as a non-blocking ev
| |
| 57 } | |
| 51 if (touch_events_.state() == WebInputEventQueueState::ITEM_PENDING) { | 58 if (touch_events_.state() == WebInputEventQueueState::ITEM_PENDING) { |
| 52 touch_events_.Queue( | 59 touch_events_.Queue(new_touch_event); |
| 53 PendingTouchEvent(*static_cast<const blink::WebTouchEvent*>(event), | |
| 54 latency, dispatch_type)); | |
| 55 } else { | 60 } else { |
| 56 if (non_blocking) { | 61 if (non_blocking) { |
| 57 touch_events_.set_state(WebInputEventQueueState::ITEM_PENDING); | 62 touch_events_.set_state(WebInputEventQueueState::ITEM_PENDING); |
| 58 client_->SendEventToMainThread(routing_id_, event, latency, | 63 client_->SendEventToMainThread(routing_id_, &new_touch_event.event, |
| 59 dispatch_type); | 64 latency, dispatch_type); |
| 60 } else { | 65 } else { |
| 61 // If there is nothing in the event queue and the event is | 66 // If there is nothing in the event queue and the event is |
| 62 // blocking pass the |original_dispatch_type| to avoid | 67 // blocking pass the |original_dispatch_type| to avoid |
| 63 // having the main thread call us back as an optimization. | 68 // having the main thread call us back as an optimization. |
| 64 client_->SendEventToMainThread(routing_id_, event, latency, | 69 client_->SendEventToMainThread(routing_id_, &new_touch_event.event, |
| 65 original_dispatch_type); | 70 latency, original_dispatch_type); |
| 66 } | 71 } |
| 67 } | 72 } |
| 68 } else { | 73 } else { |
| 69 client_->SendEventToMainThread(routing_id_, event, latency, | 74 client_->SendEventToMainThread(routing_id_, event, latency, |
| 70 original_dispatch_type); | 75 original_dispatch_type); |
| 71 } | 76 } |
| 72 | 77 |
| 73 // send an ack when we are non-blocking. | 78 // send an ack when we are non-blocking. |
| 74 return non_blocking; | 79 return non_blocking; |
| 75 } | 80 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 90 event->type); | 95 event->type); |
| 91 } else { | 96 } else { |
| 92 touch_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); | 97 touch_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); |
| 93 } | 98 } |
| 94 } else { | 99 } else { |
| 95 NOTREACHED() << "Invalid passive event type"; | 100 NOTREACHED() << "Invalid passive event type"; |
| 96 } | 101 } |
| 97 } | 102 } |
| 98 | 103 |
| 99 } // namespace content | 104 } // namespace content |
| OLD | NEW |