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

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

Issue 2170913002: Generalize the main thread event queue into a common event queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 4 years, 5 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
« no previous file with comments | « content/common/input/web_input_event_queue.h ('k') | content/renderer/input/main_thread_event_queue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fe58023f5777bb8923b5138e8354f21a29ba6b8d..1417771c141d33893bfbcd89b39305136263fb9b 100644
--- a/content/renderer/input/main_thread_event_queue.h
+++ b/content/renderer/input/main_thread_event_queue.h
@@ -17,41 +17,28 @@
namespace content {
-template <typename BaseClass, typename BaseType>
-class EventWithDispatchType : public BaseClass {
+class EventWithDispatchType : public ScopedWebInputEventWithLatencyInfo {
public:
- EventWithDispatchType(const BaseType& e,
- const ui::LatencyInfo& l,
- InputEventDispatchType t)
- : BaseClass(e, l), type(t) {}
-
- InputEventDispatchType type;
- std::deque<uint32_t> eventsToAck;
-
+ EventWithDispatchType(const blink::WebInputEvent& event,
+ const ui::LatencyInfo& latency,
+ InputEventDispatchType dispatch_type);
+ ~EventWithDispatchType();
bool CanCoalesceWith(const EventWithDispatchType& other) const
- WARN_UNUSED_RESULT {
- return other.type == type && BaseClass::CanCoalesceWith(other);
- }
-
- void CoalesceWith(const EventWithDispatchType& other) {
- // If we are blocking and are coalescing touch, make sure to keep
- // the touch ids that need to be acked.
- if (type == DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN) {
- // We should only have blocking touch events that need coalescing.
- DCHECK(blink::WebInputEvent::isTouchEventType(other.event.type));
- eventsToAck.push_back(
- WebInputEventTraits::GetUniqueTouchEventId(other.event));
- }
- BaseClass::CoalesceWith(other);
- }
-};
+ WARN_UNUSED_RESULT;
+ void CoalesceWith(const EventWithDispatchType& other);
-using PendingMouseWheelEvent =
- EventWithDispatchType<MouseWheelEventWithLatencyInfo,
- blink::WebMouseWheelEvent>;
+ const std::deque<uint32_t>& eventsToAck() const { return eventsToAck_; }
+ InputEventDispatchType dispatchType() const { return dispatch_type_; }
-using PendingTouchEvent =
- EventWithDispatchType<TouchEventWithLatencyInfo, blink::WebTouchEvent>;
+ private:
+ InputEventDispatchType dispatch_type_;
+
+ // |eventsToAck_| contains the unique touch event id to be acked. If
+ // the events are TouchEvents the value will be 0. More importantly for
+ // those cases the deque ends up containing how many additional ACKs
+ // need to be sent.
+ std::deque<uint32_t> eventsToAck_;
+};
class CONTENT_EXPORT MainThreadEventQueueClient {
public:
@@ -128,14 +115,10 @@ class CONTENT_EXPORT MainThreadEventQueue {
friend class MainThreadEventQueueTest;
int routing_id_;
MainThreadEventQueueClient* client_;
- WebInputEventQueue<PendingMouseWheelEvent> wheel_events_;
- WebInputEventQueue<PendingTouchEvent> touch_events_;
+ WebInputEventQueue<EventWithDispatchType> events_;
+ std::unique_ptr<EventWithDispatchType> in_flight_event_;
bool is_flinging_;
-
- // TODO(dtapuska): These can be removed when the queues are dequeued
- // on the main thread. See crbug.com/624021
- std::unique_ptr<PendingMouseWheelEvent> in_flight_wheel_event_;
- std::unique_ptr<PendingTouchEvent> in_flight_touch_event_;
+ bool sent_notification_to_main_;
DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue);
};
« no previous file with comments | « content/common/input/web_input_event_queue.h ('k') | content/renderer/input/main_thread_event_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698