Chromium Code Reviews| Index: content/renderer/input/main_thread_event_queue.h |
| diff --git a/content/renderer/input/main_thread_event_queue.h b/content/renderer/input/main_thread_event_queue.h |
| index 1417771c141d33893bfbcd89b39305136263fb9b..62350cfa0c68ad243954024abaf05a95259a1968 100644 |
| --- a/content/renderer/input/main_thread_event_queue.h |
| +++ b/content/renderer/input/main_thread_event_queue.h |
| @@ -42,13 +42,14 @@ class EventWithDispatchType : public ScopedWebInputEventWithLatencyInfo { |
| class CONTENT_EXPORT MainThreadEventQueueClient { |
| public: |
| - // Send an |event| that was previously queued (possibly |
| + // Handle an |event| that was previously queued (possibly |
| // coalesced with another event) to the |routing_id|'s |
| // channel. Implementors must implement this callback. |
| - virtual void SendEventToMainThread(int routing_id, |
| - const blink::WebInputEvent* event, |
| - const ui::LatencyInfo& latency, |
| - InputEventDispatchType dispatch_type) = 0; |
| + virtual void HandleEventOnMainThread( |
| + int routing_id, |
| + const blink::WebInputEvent* event, |
| + const ui::LatencyInfo& latency, |
| + InputEventDispatchType dispatch_type) = 0; |
| virtual void SendInputEventAck(int routing_id, |
| blink::WebInputEvent::Type type, |
| @@ -92,10 +93,13 @@ class CONTENT_EXPORT MainThreadEventQueueClient { |
| // <--(PT)--- // Notify from BL event. |
| // <-------(ACK)------ |
|
tdresser
2016/07/27 13:51:51
This comment needs updating, doesn't it?
dtapuska
2016/08/03 20:20:54
Done.
|
| // |
| -class CONTENT_EXPORT MainThreadEventQueue { |
| +class CONTENT_EXPORT MainThreadEventQueue |
| + : public base::RefCountedThreadSafe<MainThreadEventQueue> { |
| public: |
| - MainThreadEventQueue(int routing_id, MainThreadEventQueueClient* client); |
| - ~MainThreadEventQueue(); |
| + MainThreadEventQueue( |
| + int routing_id, |
| + MainThreadEventQueueClient* client, |
| + const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner); |
| // Called once the compositor has handled |event| and indicated that it is |
| // a non-blocking event to be queued to the main thread. |
| @@ -112,6 +116,15 @@ class CONTENT_EXPORT MainThreadEventQueue { |
| void set_is_flinging(bool is_flinging) { is_flinging_ = is_flinging; } |
| private: |
| + friend class base::RefCountedThreadSafe<MainThreadEventQueue>; |
| + ~MainThreadEventQueue(); |
| + void QueueEvent(std::unique_ptr<EventWithDispatchType>&& event); |
| + void SendEventNotificationToMainThread(); |
| + void PopEventOnMainThread(); |
| + void SendEventToMainThread(const blink::WebInputEvent* event, |
| + const ui::LatencyInfo& latency, |
| + InputEventDispatchType original_dispatch_type); |
| + |
| friend class MainThreadEventQueueTest; |
| int routing_id_; |
| MainThreadEventQueueClient* client_; |
| @@ -120,6 +133,9 @@ class CONTENT_EXPORT MainThreadEventQueue { |
| bool is_flinging_; |
| bool sent_notification_to_main_; |
| + base::Lock event_queue_mutex_; |
|
tdresser
2016/07/27 13:51:51
Looks like event_queue_lock_ would be better in li
dtapuska
2016/08/03 20:20:54
Done.
|
| + scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue); |
| }; |