Index: content/renderer/input/main_thread_event_queue.cc |
diff --git a/content/renderer/input/main_thread_event_queue.cc b/content/renderer/input/main_thread_event_queue.cc |
index 45e12e3efbdd72400d2eed6d41c77d13327b5c3d..94d1d49ea111c0c446852a4f64f44468014625ba 100644 |
--- a/content/renderer/input/main_thread_event_queue.cc |
+++ b/content/renderer/input/main_thread_event_queue.cc |
@@ -344,13 +344,6 @@ void MainThreadEventQueue::QueueClosure(const base::Closure& closure) { |
PostTaskToMainThread(); |
} |
-void MainThreadEventQueue::DispatchInFlightEvent() { |
- if (in_flight_event_) { |
- in_flight_event_->Dispatch(this); |
- in_flight_event_.reset(); |
- } |
-} |
- |
void MainThreadEventQueue::PossiblyScheduleMainFrame() { |
if (IsRafAlignedInputDisabled()) |
return; |
@@ -386,15 +379,16 @@ void MainThreadEventQueue::DispatchEvents() { |
} |
while (events_to_process--) { |
+ std::unique_ptr<MainThreadEventQueueTask> task; |
{ |
base::AutoLock lock(shared_state_lock_); |
if (shared_state_.events_.empty()) |
return; |
- in_flight_event_ = shared_state_.events_.Pop(); |
+ task = shared_state_.events_.Pop(); |
} |
// Dispatching the event is outside of critical section. |
- DispatchInFlightEvent(); |
+ task->Dispatch(this); |
} |
PossiblyScheduleMainFrame(); |
} |
@@ -427,6 +421,7 @@ void MainThreadEventQueue::DispatchRafAlignedInput(base::TimeTicks frame_time) { |
} |
while (queue_size_at_start--) { |
+ std::unique_ptr<MainThreadEventQueueTask> task; |
{ |
base::AutoLock lock(shared_state_lock_); |
@@ -445,11 +440,10 @@ void MainThreadEventQueue::DispatchRafAlignedInput(base::TimeTicks frame_time) { |
shared_state_.last_async_touch_move_timestamp_ = frame_time; |
} |
} |
- in_flight_event_ = shared_state_.events_.Pop(); |
+ task = shared_state_.events_.Pop(); |
} |
- |
// Dispatching the event is outside of critical section. |
- DispatchInFlightEvent(); |
+ task->Dispatch(this); |
} |
PossiblyScheduleMainFrame(); |