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 12 matching lines...) Expand all Loading... | |
23 ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 23 ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
24 | 24 |
25 bool non_blocking = original_dispatch_type == DISPATCH_TYPE_NON_BLOCKING || | 25 bool non_blocking = original_dispatch_type == DISPATCH_TYPE_NON_BLOCKING || |
26 ack_result == INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING; | 26 ack_result == INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING; |
27 | 27 |
28 InputEventDispatchType dispatch_type = | 28 InputEventDispatchType dispatch_type = |
29 non_blocking ? DISPATCH_TYPE_NON_BLOCKING_NOTIFY_MAIN | 29 non_blocking ? DISPATCH_TYPE_NON_BLOCKING_NOTIFY_MAIN |
30 : DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN; | 30 : DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN; |
31 | 31 |
32 if (event->type == blink::WebInputEvent::MouseWheel) { | 32 if (event->type == blink::WebInputEvent::MouseWheel) { |
33 PendingMouseWheelEvent modified_dispatch_type_event = | |
34 PendingMouseWheelEvent( | |
35 *static_cast<const blink::WebMouseWheelEvent*>(event), latency, | |
36 dispatch_type); | |
37 | |
38 // Adjust the |dispatchType| on the event since it was | |
39 // adjusted by the compositor. | |
tdresser
2016/04/20 13:20:10
Maybe "since the compositor determined all event l
dtapuska
2016/04/20 14:03:23
Done.
| |
40 if (non_blocking) { | |
41 modified_dispatch_type_event.event.dispatchType = | |
42 blink::WebInputEvent::ListenersNonBlockingPassive; | |
43 } | |
44 | |
33 if (wheel_events_.state() == WebInputEventQueueState::ITEM_PENDING) { | 45 if (wheel_events_.state() == WebInputEventQueueState::ITEM_PENDING) { |
34 wheel_events_.Queue(PendingMouseWheelEvent( | 46 wheel_events_.Queue(modified_dispatch_type_event); |
35 *static_cast<const blink::WebMouseWheelEvent*>(event), latency, | |
36 dispatch_type)); | |
37 } else { | 47 } else { |
38 if (non_blocking) { | 48 if (non_blocking) { |
39 wheel_events_.set_state(WebInputEventQueueState::ITEM_PENDING); | 49 wheel_events_.set_state(WebInputEventQueueState::ITEM_PENDING); |
40 client_->SendEventToMainThread(routing_id_, event, latency, | 50 client_->SendEventToMainThread(routing_id_, |
41 dispatch_type); | 51 &modified_dispatch_type_event.event, |
52 latency, dispatch_type); | |
42 } else { | 53 } else { |
43 // If there is nothing in the event queue and the event is | 54 // If there is nothing in the event queue and the event is |
44 // blocking pass the |original_dispatch_type| to avoid | 55 // blocking pass the |original_dispatch_type| to avoid |
45 // having the main thread call us back as an optimization. | 56 // having the main thread call us back as an optimization. |
46 client_->SendEventToMainThread(routing_id_, event, latency, | 57 client_->SendEventToMainThread(routing_id_, |
47 original_dispatch_type); | 58 &modified_dispatch_type_event.event, |
59 latency, original_dispatch_type); | |
48 } | 60 } |
49 } | 61 } |
50 } else if (blink::WebInputEvent::isTouchEventType(event->type)) { | 62 } else if (blink::WebInputEvent::isTouchEventType(event->type)) { |
51 PendingTouchEvent modified_dispatch_type_event = | 63 PendingTouchEvent modified_dispatch_type_event = |
52 PendingTouchEvent(*static_cast<const blink::WebTouchEvent*>(event), | 64 PendingTouchEvent(*static_cast<const blink::WebTouchEvent*>(event), |
53 latency, dispatch_type); | 65 latency, dispatch_type); |
54 | 66 |
55 // Adjust the |dispatchType| on the event since it was | 67 // Adjust the |dispatchType| on the event since it was |
56 // adjusted by the compositor. | 68 // adjusted by the compositor. |
57 if (non_blocking) { | 69 if (non_blocking) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 event->type); | 113 event->type); |
102 } else { | 114 } else { |
103 touch_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); | 115 touch_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING); |
104 } | 116 } |
105 } else { | 117 } else { |
106 NOTREACHED() << "Invalid passive event type"; | 118 NOTREACHED() << "Invalid passive event type"; |
107 } | 119 } |
108 } | 120 } |
109 | 121 |
110 } // namespace content | 122 } // namespace content |
OLD | NEW |