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 #ifndef CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ | 5 #ifndef CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ |
6 #define CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ | 6 #define CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "content/common/input/event_with_latency_info.h" | 10 #include "content/common/input/event_with_latency_info.h" |
11 #include "content/common/input/input_event_ack_state.h" | 11 #include "content/common/input/input_event_ack_state.h" |
12 #include "content/common/input/input_event_dispatch_type.h" | 12 #include "content/common/input/input_event_dispatch_type.h" |
13 #include "content/common/input/web_input_event_queue.h" | 13 #include "content/common/input/web_input_event_queue.h" |
14 #include "content/common/input/web_input_event_traits.h" | |
15 #include "third_party/WebKit/public/web/WebInputEvent.h" | 14 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 15 #include "ui/events/blink/web_input_event_traits.h" |
16 #include "ui/events/latency_info.h" | 16 #include "ui/events/latency_info.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class EventWithDispatchType : public ScopedWebInputEventWithLatencyInfo { | 20 class EventWithDispatchType : public ScopedWebInputEventWithLatencyInfo { |
21 public: | 21 public: |
22 EventWithDispatchType(ScopedWebInputEvent event, | 22 EventWithDispatchType(ui::ScopedWebInputEvent event, |
23 const ui::LatencyInfo& latency, | 23 const ui::LatencyInfo& latency, |
24 InputEventDispatchType dispatch_type); | 24 InputEventDispatchType dispatch_type); |
25 ~EventWithDispatchType(); | 25 ~EventWithDispatchType(); |
26 bool CanCoalesceWith(const EventWithDispatchType& other) const | 26 bool CanCoalesceWith(const EventWithDispatchType& other) const |
27 WARN_UNUSED_RESULT; | 27 WARN_UNUSED_RESULT; |
28 void CoalesceWith(const EventWithDispatchType& other); | 28 void CoalesceWith(const EventWithDispatchType& other); |
29 | 29 |
30 const std::deque<uint32_t>& eventsToAck() const { return eventsToAck_; } | 30 const std::deque<uint32_t>& eventsToAck() const { return eventsToAck_; } |
31 InputEventDispatchType dispatchType() const { return dispatch_type_; } | 31 InputEventDispatchType dispatchType() const { return dispatch_type_; } |
32 | 32 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 class CONTENT_EXPORT MainThreadEventQueue | 96 class CONTENT_EXPORT MainThreadEventQueue |
97 : public base::RefCountedThreadSafe<MainThreadEventQueue> { | 97 : public base::RefCountedThreadSafe<MainThreadEventQueue> { |
98 public: | 98 public: |
99 MainThreadEventQueue( | 99 MainThreadEventQueue( |
100 int routing_id, | 100 int routing_id, |
101 MainThreadEventQueueClient* client, | 101 MainThreadEventQueueClient* client, |
102 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner); | 102 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner); |
103 | 103 |
104 // Called once the compositor has handled |event| and indicated that it is | 104 // Called once the compositor has handled |event| and indicated that it is |
105 // a non-blocking event to be queued to the main thread. | 105 // a non-blocking event to be queued to the main thread. |
106 bool HandleEvent(ScopedWebInputEvent event, | 106 bool HandleEvent(ui::ScopedWebInputEvent event, |
107 const ui::LatencyInfo& latency, | 107 const ui::LatencyInfo& latency, |
108 InputEventDispatchType dispatch_type, | 108 InputEventDispatchType dispatch_type, |
109 InputEventAckState ack_result); | 109 InputEventAckState ack_result); |
110 | 110 |
111 // Call once the main thread has handled an outstanding |type| event | 111 // Call once the main thread has handled an outstanding |type| event |
112 // in flight. | 112 // in flight. |
113 void EventHandled(blink::WebInputEvent::Type type, | 113 void EventHandled(blink::WebInputEvent::Type type, |
114 InputEventAckState ack_result); | 114 InputEventAckState ack_result); |
115 | 115 |
116 void set_is_flinging(bool is_flinging) { is_flinging_ = is_flinging; } | 116 void set_is_flinging(bool is_flinging) { is_flinging_ = is_flinging; } |
(...skipping 17 matching lines...) Expand all Loading... |
134 | 134 |
135 base::Lock event_queue_lock_; | 135 base::Lock event_queue_lock_; |
136 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 136 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
137 | 137 |
138 DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue); | 138 DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue); |
139 }; | 139 }; |
140 | 140 |
141 } // namespace content | 141 } // namespace content |
142 | 142 |
143 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ | 143 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ |
OLD | NEW |