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 modified_dispatch_type_event = | |
52 PendingTouchEvent(*static_cast<const blink::WebTouchEvent*>(event), | |
53 latency, dispatch_type); | |
54 | |
55 // Adjust the |dispatchType| on the event since it was | |
56 // adjusted by the compositor. | |
tdresser
2016/04/20 13:20:21
Maybe "since the compositor determined all event l
dtapuska
2016/04/20 13:56:34
Done.
| |
57 if (non_blocking) { | |
58 modified_dispatch_type_event.event.dispatchType = | |
59 blink::WebInputEvent::ListenersNonBlockingPassive; | |
60 } | |
61 | |
51 if (touch_events_.state() == WebInputEventQueueState::ITEM_PENDING) { | 62 if (touch_events_.state() == WebInputEventQueueState::ITEM_PENDING) { |
52 touch_events_.Queue( | 63 touch_events_.Queue(modified_dispatch_type_event); |
53 PendingTouchEvent(*static_cast<const blink::WebTouchEvent*>(event), | |
54 latency, dispatch_type)); | |
55 } else { | 64 } else { |
56 if (non_blocking) { | 65 if (non_blocking) { |
57 touch_events_.set_state(WebInputEventQueueState::ITEM_PENDING); | 66 touch_events_.set_state(WebInputEventQueueState::ITEM_PENDING); |
58 client_->SendEventToMainThread(routing_id_, event, latency, | 67 client_->SendEventToMainThread(routing_id_, |
59 dispatch_type); | 68 &modified_dispatch_type_event.event, |
69 latency, dispatch_type); | |
60 } else { | 70 } else { |
61 // If there is nothing in the event queue and the event is | 71 // If there is nothing in the event queue and the event is |
62 // blocking pass the |original_dispatch_type| to avoid | 72 // blocking pass the |original_dispatch_type| to avoid |
63 // having the main thread call us back as an optimization. | 73 // having the main thread call us back as an optimization. |
64 client_->SendEventToMainThread(routing_id_, event, latency, | 74 client_->SendEventToMainThread(routing_id_, |
65 original_dispatch_type); | 75 &modified_dispatch_type_event.event, |
76 latency, original_dispatch_type); | |
66 } | 77 } |
67 } | 78 } |
68 } else { | 79 } else { |
69 client_->SendEventToMainThread(routing_id_, event, latency, | 80 client_->SendEventToMainThread(routing_id_, event, latency, |
70 original_dispatch_type); | 81 original_dispatch_type); |
71 } | 82 } |
72 | 83 |
73 // send an ack when we are non-blocking. | 84 // send an ack when we are non-blocking. |
74 return non_blocking; | 85 return non_blocking; |
75 } | 86 } |
(...skipping 14 matching lines...) Expand all Loading... | |
90 event->type); | 101 event->type); |
91 } else { | 102 } else { |
92 touch_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); | 103 touch_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); |
93 } | 104 } |
94 } else { | 105 } else { |
95 NOTREACHED() << "Invalid passive event type"; | 106 NOTREACHED() << "Invalid passive event type"; |
96 } | 107 } |
97 } | 108 } |
98 | 109 |
99 } // namespace content | 110 } // namespace content |
OLD | NEW |