Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: content/renderer/input/main_thread_event_queue.h

Issue 2007413002: [POC; Not for Review] Don't use PostTask queueing between compositor and main thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve mouse move by making it non blocking Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6a99636a9a0d2f0851d7404b89778eb676a733a8..3284bbbe62a1271d837f8fa2736ead7451cab0d8 100644
--- a/content/renderer/input/main_thread_event_queue.h
+++ b/content/renderer/input/main_thread_event_queue.h
@@ -11,6 +11,7 @@
#include "content/common/input/input_event_ack_state.h"
#include "content/common/input/input_event_dispatch_type.h"
#include "content/common/input/web_input_event_queue.h"
+#include "ipc/message_filter.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/events/latency_info.h"
@@ -43,15 +44,19 @@ using PendingMouseWheelEvent =
using PendingTouchEvent =
EventWithDispatchType<TouchEventWithLatencyInfo, blink::WebTouchEvent>;
+using PendingMouseEvent =
+ EventWithDispatchType<MouseEventWithLatencyInfo, blink::WebMouseEvent>;
+
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;
};
// MainThreadEventQueue implements a series of queues (one touch
@@ -92,7 +97,11 @@ class CONTENT_EXPORT MainThreadEventQueueClient {
//
class CONTENT_EXPORT MainThreadEventQueue {
public:
- MainThreadEventQueue(int routing_id, MainThreadEventQueueClient* client);
+ MainThreadEventQueue(
+ int routing_id,
+ MainThreadEventQueueClient* client,
+ const base::Callback<void(const IPC::Message&)>& main_listener,
+ const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner);
~MainThreadEventQueue();
// Called once the compositor has handled |event| and indicated that it is
@@ -109,12 +118,29 @@ class CONTENT_EXPORT MainThreadEventQueue {
void set_is_flinging(bool is_flinging) { is_flinging_ = is_flinging; }
private:
+ void QueueWheelEvent(const PendingMouseWheelEvent& event);
+ void QueueTouchEvent(const PendingTouchEvent& event);
+ void QueueMouseEvent(const PendingMouseEvent& event);
+ void SendWheelEventNotificationToMainThread();
+ void SendTouchEventNotificationToMainThread();
+ void SendMouseEventNotificationToMainThread();
+ void PopTouchEventOnMainThread();
+ void PopWheelEventOnMainThread();
+ void PopMouseEventOnMainThread();
+ void SendEventToMainThread(const blink::WebInputEvent* event,
+ const ui::LatencyInfo& latency,
+ InputEventDispatchType original_dispatch_type);
+
friend class MainThreadEventQueueTest;
int routing_id_;
MainThreadEventQueueClient* client_;
WebInputEventQueue<PendingMouseWheelEvent> wheel_events_;
WebInputEventQueue<PendingTouchEvent> touch_events_;
+ WebInputEventQueue<PendingMouseEvent> mouse_events_;
bool is_flinging_;
+ base::Lock event_queue_mutex_;
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
+ base::Callback<void(const IPC::Message&)> main_listener_;
tdresser 2016/05/30 14:05:32 Eventually we'll want a couple ThreadChecker's in
dtapuska 2016/06/01 18:22:54 Acknowledged.
DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue);
};

Powered by Google App Engine
This is Rietveld 408576698