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 "base/feature_list.h" | 9 #include "base/feature_list.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 const ui::LatencyInfo& latency, | 120 const ui::LatencyInfo& latency, |
121 InputEventDispatchType dispatch_type, | 121 InputEventDispatchType dispatch_type, |
122 InputEventAckState ack_result); | 122 InputEventAckState ack_result); |
123 void DispatchRafAlignedInput(); | 123 void DispatchRafAlignedInput(); |
124 | 124 |
125 // Call once the main thread has handled an outstanding |type| event | 125 // Call once the main thread has handled an outstanding |type| event |
126 // in flight. | 126 // in flight. |
127 void EventHandled(blink::WebInputEvent::Type type, | 127 void EventHandled(blink::WebInputEvent::Type type, |
128 InputEventAckState ack_result); | 128 InputEventAckState ack_result); |
129 | 129 |
130 void set_is_flinging(bool is_flinging) { is_flinging_ = is_flinging; } | |
131 | |
132 private: | 130 private: |
133 friend class base::RefCountedThreadSafe<MainThreadEventQueue>; | 131 friend class base::RefCountedThreadSafe<MainThreadEventQueue>; |
134 ~MainThreadEventQueue(); | 132 ~MainThreadEventQueue(); |
135 void QueueEvent(std::unique_ptr<EventWithDispatchType> event); | 133 void QueueEvent(std::unique_ptr<EventWithDispatchType> event); |
136 void SendEventNotificationToMainThread(); | 134 void SendEventNotificationToMainThread(); |
137 void DispatchSingleEvent(); | 135 void DispatchSingleEvent(); |
138 void DispatchInFlightEvent(); | 136 void DispatchInFlightEvent(); |
139 void PossiblyScheduleMainFrame(); | 137 void PossiblyScheduleMainFrame(); |
140 | 138 |
141 void SendEventToMainThread(const blink::WebInputEvent* event, | 139 void SendEventToMainThread(const blink::WebInputEvent* event, |
142 const ui::LatencyInfo& latency, | 140 const ui::LatencyInfo& latency, |
143 InputEventDispatchType original_dispatch_type); | 141 InputEventDispatchType original_dispatch_type); |
144 | 142 |
145 bool IsRafAlignedInputDisabled(); | 143 bool IsRafAlignedInputDisabled(); |
146 bool IsRafAlignedEvent(const std::unique_ptr<EventWithDispatchType>& event); | 144 bool IsRafAlignedEvent(const std::unique_ptr<EventWithDispatchType>& event); |
147 | 145 |
148 friend class MainThreadEventQueueTest; | 146 friend class MainThreadEventQueueTest; |
149 int routing_id_; | 147 int routing_id_; |
150 MainThreadEventQueueClient* client_; | 148 MainThreadEventQueueClient* client_; |
151 std::unique_ptr<EventWithDispatchType> in_flight_event_; | 149 std::unique_ptr<EventWithDispatchType> in_flight_event_; |
152 bool is_flinging_; | |
153 bool last_touch_start_forced_nonblocking_due_to_fling_; | 150 bool last_touch_start_forced_nonblocking_due_to_fling_; |
154 bool enable_fling_passive_listener_flag_; | 151 bool enable_fling_passive_listener_flag_; |
155 bool handle_raf_aligned_touch_input_; | 152 bool handle_raf_aligned_touch_input_; |
156 bool handle_raf_aligned_mouse_input_; | 153 bool handle_raf_aligned_mouse_input_; |
157 | 154 |
158 // Contains data to be shared between main thread and compositor thread. | 155 // Contains data to be shared between main thread and compositor thread. |
159 struct SharedState { | 156 struct SharedState { |
160 SharedState(); | 157 SharedState(); |
161 ~SharedState(); | 158 ~SharedState(); |
162 | 159 |
163 WebInputEventQueue<EventWithDispatchType> events_; | 160 WebInputEventQueue<EventWithDispatchType> events_; |
164 bool sent_main_frame_request_; | 161 bool sent_main_frame_request_; |
165 }; | 162 }; |
166 | 163 |
167 // Lock used to serialize |shared_state_|. | 164 // Lock used to serialize |shared_state_|. |
168 base::Lock shared_state_lock_; | 165 base::Lock shared_state_lock_; |
169 SharedState shared_state_; | 166 SharedState shared_state_; |
170 | 167 |
171 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 168 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
172 blink::scheduler::RendererScheduler* renderer_scheduler_; | 169 blink::scheduler::RendererScheduler* renderer_scheduler_; |
173 | 170 |
174 DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue); | 171 DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue); |
175 }; | 172 }; |
176 | 173 |
177 } // namespace content | 174 } // namespace content |
178 | 175 |
179 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ | 176 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ |
OLD | NEW |