| 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 "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 void QueueClosure(const base::Closure& closure); | 94 void QueueClosure(const base::Closure& closure); |
| 95 | 95 |
| 96 void ClearClient(); | 96 void ClearClient(); |
| 97 | 97 |
| 98 protected: | 98 protected: |
| 99 friend class base::RefCountedThreadSafe<MainThreadEventQueue>; | 99 friend class base::RefCountedThreadSafe<MainThreadEventQueue>; |
| 100 virtual ~MainThreadEventQueue(); | 100 virtual ~MainThreadEventQueue(); |
| 101 void QueueEvent(std::unique_ptr<MainThreadEventQueueTask> event); | 101 void QueueEvent(std::unique_ptr<MainThreadEventQueueTask> event); |
| 102 void PostTaskToMainThread(); | 102 void PostTaskToMainThread(); |
| 103 void DispatchEvents(); | 103 void DispatchEvents(); |
| 104 void DispatchInFlightEvent(); | |
| 105 void PossiblyScheduleMainFrame(); | 104 void PossiblyScheduleMainFrame(); |
| 106 void SetNeedsMainFrame(); | 105 void SetNeedsMainFrame(); |
| 107 InputEventAckState HandleEventOnMainThread( | 106 InputEventAckState HandleEventOnMainThread( |
| 108 const blink::WebCoalescedInputEvent& event, | 107 const blink::WebCoalescedInputEvent& event, |
| 109 const ui::LatencyInfo& latency, | 108 const ui::LatencyInfo& latency, |
| 110 InputEventDispatchType dispatch_type); | 109 InputEventDispatchType dispatch_type); |
| 111 void SendInputEventAck(const blink::WebInputEvent& event, | 110 void SendInputEventAck(const blink::WebInputEvent& event, |
| 112 InputEventAckState ack_result, | 111 InputEventAckState ack_result, |
| 113 uint32_t touch_event_id); | 112 uint32_t touch_event_id); |
| 114 | 113 |
| 115 void SendEventToMainThread(const blink::WebInputEvent* event, | 114 void SendEventToMainThread(const blink::WebInputEvent* event, |
| 116 const ui::LatencyInfo& latency, | 115 const ui::LatencyInfo& latency, |
| 117 InputEventDispatchType original_dispatch_type); | 116 InputEventDispatchType original_dispatch_type); |
| 118 | 117 |
| 119 bool IsRafAlignedInputDisabled() const; | 118 bool IsRafAlignedInputDisabled() const; |
| 120 bool IsRafAlignedEvent( | 119 bool IsRafAlignedEvent( |
| 121 const std::unique_ptr<MainThreadEventQueueTask>& item) const; | 120 const std::unique_ptr<MainThreadEventQueueTask>& item) const; |
| 122 | 121 |
| 123 friend class QueuedWebInputEvent; | 122 friend class QueuedWebInputEvent; |
| 124 friend class MainThreadEventQueueTest; | 123 friend class MainThreadEventQueueTest; |
| 125 friend class MainThreadEventQueueInitializationTest; | 124 friend class MainThreadEventQueueInitializationTest; |
| 126 MainThreadEventQueueClient* client_; | 125 MainThreadEventQueueClient* client_; |
| 127 std::unique_ptr<MainThreadEventQueueTask> in_flight_event_; | |
| 128 bool last_touch_start_forced_nonblocking_due_to_fling_; | 126 bool last_touch_start_forced_nonblocking_due_to_fling_; |
| 129 bool enable_fling_passive_listener_flag_; | 127 bool enable_fling_passive_listener_flag_; |
| 130 bool enable_non_blocking_due_to_main_thread_responsiveness_flag_; | 128 bool enable_non_blocking_due_to_main_thread_responsiveness_flag_; |
| 131 base::TimeDelta main_thread_responsiveness_threshold_; | 129 base::TimeDelta main_thread_responsiveness_threshold_; |
| 132 bool handle_raf_aligned_touch_input_; | 130 bool handle_raf_aligned_touch_input_; |
| 133 bool handle_raf_aligned_mouse_input_; | 131 bool handle_raf_aligned_mouse_input_; |
| 134 | 132 |
| 135 // Contains data to be shared between main thread and compositor thread. | 133 // Contains data to be shared between main thread and compositor thread. |
| 136 struct SharedState { | 134 struct SharedState { |
| 137 SharedState(); | 135 SharedState(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 151 | 149 |
| 152 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 150 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 153 blink::scheduler::RendererScheduler* renderer_scheduler_; | 151 blink::scheduler::RendererScheduler* renderer_scheduler_; |
| 154 | 152 |
| 155 DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue); | 153 DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue); |
| 156 }; | 154 }; |
| 157 | 155 |
| 158 } // namespace content | 156 } // namespace content |
| 159 | 157 |
| 160 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ | 158 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ |
| OLD | NEW |