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 fe58023f5777bb8923b5138e8354f21a29ba6b8d..9d3335160a68689b02619765a913b7e6610f7851 100644 |
| --- a/content/renderer/input/main_thread_event_queue.h |
| +++ b/content/renderer/input/main_thread_event_queue.h |
| @@ -6,6 +6,7 @@ |
| #define CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ |
| #include <deque> |
| +#include "base/memory/ref_counted.h" |
|
tdresser
2016/07/22 19:13:41
Not used (yet).
dtapuska
2016/07/22 20:14:08
Done.
|
| #include "content/common/content_export.h" |
| #include "content/common/input/event_with_latency_info.h" |
| #include "content/common/input/input_event_ack_state.h" |
| @@ -17,41 +18,23 @@ |
| 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_; |
| + std::deque<uint32_t> eventsToAck_; |
|
tdresser
2016/07/22 19:13:41
Indicate that this is touch specific.
dtapuska
2016/07/22 20:14:08
I think that is a specialization just in the insta
tdresser
2016/07/25 14:01:40
I guess that's reasonable. Maybe add a comment ind
|
| +}; |
| class CONTENT_EXPORT MainThreadEventQueueClient { |
| public: |
| @@ -128,14 +111,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); |
| }; |