| 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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 int routing_id, | 96 int routing_id, |
| 97 MainThreadEventQueueClient* client, | 97 MainThreadEventQueueClient* client, |
| 98 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner); | 98 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner); |
| 99 | 99 |
| 100 // Called once the compositor has handled |event| and indicated that it is | 100 // Called once the compositor has handled |event| and indicated that it is |
| 101 // a non-blocking event to be queued to the main thread. | 101 // a non-blocking event to be queued to the main thread. |
| 102 bool HandleEvent(const blink::WebInputEvent* event, | 102 bool HandleEvent(const blink::WebInputEvent* event, |
| 103 const ui::LatencyInfo& latency, | 103 const ui::LatencyInfo& latency, |
| 104 InputEventDispatchType dispatch_type, | 104 InputEventDispatchType dispatch_type, |
| 105 InputEventAckState ack_result); | 105 InputEventAckState ack_result); |
| 106 void DispatchVSyncAlignedInput(); |
| 106 | 107 |
| 107 // Call once the main thread has handled an outstanding |type| event | 108 // Call once the main thread has handled an outstanding |type| event |
| 108 // in flight. | 109 // in flight. |
| 109 void EventHandled(blink::WebInputEvent::Type type, | 110 void EventHandled(blink::WebInputEvent::Type type, |
| 110 InputEventAckState ack_result); | 111 InputEventAckState ack_result); |
| 111 | 112 |
| 112 void set_is_flinging(bool is_flinging) { is_flinging_ = is_flinging; } | 113 void set_is_flinging(bool is_flinging) { is_flinging_ = is_flinging; } |
| 113 | 114 |
| 114 private: | 115 private: |
| 115 friend class base::RefCountedThreadSafe<MainThreadEventQueue>; | 116 friend class base::RefCountedThreadSafe<MainThreadEventQueue>; |
| 116 ~MainThreadEventQueue(); | 117 ~MainThreadEventQueue(); |
| 118 void DispatchInFlightEvent(); |
| 117 void QueueEvent(std::unique_ptr<EventWithDispatchType>&& event); | 119 void QueueEvent(std::unique_ptr<EventWithDispatchType>&& event); |
| 118 void SendEventNotificationToMainThread(); | 120 void SendEventNotificationToMainThread(); |
| 119 void PopEventOnMainThread(); | 121 void PopEventOnMainThread(); |
| 120 void SendEventToMainThread(const blink::WebInputEvent* event, | 122 void SendEventToMainThread(const blink::WebInputEvent* event, |
| 121 const ui::LatencyInfo& latency, | 123 const ui::LatencyInfo& latency, |
| 122 InputEventDispatchType original_dispatch_type); | 124 InputEventDispatchType original_dispatch_type); |
| 123 | 125 |
| 124 friend class MainThreadEventQueueTest; | 126 friend class MainThreadEventQueueTest; |
| 125 int routing_id_; | 127 int routing_id_; |
| 126 MainThreadEventQueueClient* client_; | 128 MainThreadEventQueueClient* client_; |
| 127 WebInputEventQueue<EventWithDispatchType> events_; | 129 WebInputEventQueue<EventWithDispatchType> events_; |
| 128 std::unique_ptr<EventWithDispatchType> in_flight_event_; | 130 std::unique_ptr<EventWithDispatchType> in_flight_event_; |
| 129 bool is_flinging_; | 131 bool is_flinging_; |
| 132 bool notification_sent_to_main_; |
| 130 base::Lock event_queue_mutex_; | 133 base::Lock event_queue_mutex_; |
| 131 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 134 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 132 | 135 |
| 133 DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue); | 136 DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue); |
| 134 }; | 137 }; |
| 135 | 138 |
| 136 } // namespace content | 139 } // namespace content |
| 137 | 140 |
| 138 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ | 141 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ |
| OLD | NEW |