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 c793bdd7efcc0a2b0fc580f5095e61eb3cba3f93..538e6177ac2e7493134815c9dd1312abe515b261 100644 |
--- a/content/renderer/input/main_thread_event_queue.h |
+++ b/content/renderer/input/main_thread_event_queue.h |
@@ -20,48 +20,24 @@ |
namespace content { |
-class EventWithDispatchType : public ScopedWebInputEventWithLatencyInfo { |
- public: |
- EventWithDispatchType(ui::WebScopedInputEvent event, |
- const ui::LatencyInfo& latency, |
- InputEventDispatchType dispatch_type, |
- bool originally_cancelable); |
- ~EventWithDispatchType(); |
- void CoalesceWith(const EventWithDispatchType& other); |
- |
- const std::deque<uint32_t>& blockingCoalescedEventIds() const { |
- return blocking_coalesced_event_ids_; |
- } |
- InputEventDispatchType dispatchType() const { return dispatch_type_; } |
- base::TimeTicks creationTimestamp() const { return creation_timestamp_; } |
- base::TimeTicks lastCoalescedTimestamp() const { |
- return last_coalesced_timestamp_; |
- } |
- |
- size_t coalescedCount() const { |
- return non_blocking_coalesced_count_ + blocking_coalesced_event_ids_.size(); |
- } |
- |
- bool originallyCancelable() const { return originally_cancelable_; } |
+class MainThreadEventQueueClient; |
- private: |
- InputEventDispatchType dispatch_type_; |
- |
- // Contains the unique touch event ids to be acked. If |
- // the events are not TouchEvents the values 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> blocking_coalesced_event_ids_; |
- // Contains the number of non-blocking events coalesced. |
- size_t non_blocking_coalesced_count_; |
- base::TimeTicks creation_timestamp_; |
- base::TimeTicks last_coalesced_timestamp_; |
- |
- // Whether the received event was originally cancelable or not. The compositor |
- // input handler can change the event based on presence of event handlers so |
- // this is the state at which the renderer received the event from the |
- // browser. |
- bool originally_cancelable_; |
+class QueuedItem { |
mustaq
2017/03/24 15:31:18
Since this is an exposed class, I would prefer a m
dtapuska
2017/03/24 20:16:34
Done.
|
+ public: |
+ virtual ~QueuedItem() {} |
+ |
+ virtual bool CanCoalesceWith(const QueuedItem&) = 0; |
+ virtual void CoalesceWith(const QueuedItem&) = 0; |
+ virtual bool IsSameEventClass(const QueuedItem&) const = 0; |
+ virtual bool IsEvent() const = 0; |
+ virtual void Dispatch(int routing_id, MainThreadEventQueueClient*) = 0; |
+ virtual void EventHandled( |
+ int routing_id, |
+ blink::scheduler::RendererScheduler* renderer_scheduler, |
+ MainThreadEventQueueClient* client, |
+ blink::WebInputEvent::Type type, |
+ blink::WebInputEventResult result, |
+ InputEventAckState ack_result) = 0; |
}; |
class CONTENT_EXPORT MainThreadEventQueueClient { |
@@ -134,6 +110,7 @@ class CONTENT_EXPORT MainThreadEventQueue |
InputEventDispatchType dispatch_type, |
InputEventAckState ack_result); |
void DispatchRafAlignedInput(base::TimeTicks frame_time); |
+ void QueueClosure(const base::Closure& closure); |
// Call once the main thread has handled an outstanding |type| event |
// in flight. |
@@ -144,9 +121,9 @@ class CONTENT_EXPORT MainThreadEventQueue |
private: |
friend class base::RefCountedThreadSafe<MainThreadEventQueue>; |
~MainThreadEventQueue(); |
- void QueueEvent(std::unique_ptr<EventWithDispatchType> event); |
+ void QueueEvent(std::unique_ptr<QueuedItem> event); |
void SendEventNotificationToMainThread(); |
- void DispatchSingleEvent(); |
+ void DispatchEvents(); |
void DispatchInFlightEvent(); |
void PossiblyScheduleMainFrame(); |
@@ -154,14 +131,14 @@ class CONTENT_EXPORT MainThreadEventQueue |
const ui::LatencyInfo& latency, |
InputEventDispatchType original_dispatch_type); |
- bool IsRafAlignedInputDisabled(); |
- bool IsRafAlignedEvent(const blink::WebInputEvent& event); |
+ bool IsRafAlignedInputDisabled() const; |
+ bool IsRafAlignedEvent(const std::unique_ptr<QueuedItem>& item) const; |
mustaq
2017/03/24 15:31:18
This seems to belong to the class |QueuedItem| (|M
dtapuska
2017/03/24 20:16:34
I agree. But it needs to check the variables store
|
friend class MainThreadEventQueueTest; |
friend class MainThreadEventQueueInitializationTest; |
int routing_id_; |
MainThreadEventQueueClient* client_; |
- std::unique_ptr<EventWithDispatchType> in_flight_event_; |
+ std::unique_ptr<QueuedItem> in_flight_event_; |
bool last_touch_start_forced_nonblocking_due_to_fling_; |
bool enable_fling_passive_listener_flag_; |
bool enable_non_blocking_due_to_main_thread_responsiveness_flag_; |
@@ -174,8 +151,9 @@ class CONTENT_EXPORT MainThreadEventQueue |
SharedState(); |
~SharedState(); |
- WebInputEventQueue<EventWithDispatchType> events_; |
+ WebInputEventQueue<QueuedItem> events_; |
bool sent_main_frame_request_; |
+ bool sent_post_task_; |
mustaq
2017/03/24 15:31:18
Could you please clarify what "sent" means here, t
dtapuska
2017/03/24 20:16:34
Done.
|
base::TimeTicks last_async_touch_move_timestamp_; |
}; |