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

Side by Side Diff: content/renderer/input/main_thread_event_queue.cc

Issue 2259983002: Pending input event count can get thrown off by coalesced events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/input/main_thread_event_queue.h" 5 #include "content/renderer/input/main_thread_event_queue.h"
6
6 #include "content/common/input/event_with_latency_info.h" 7 #include "content/common/input/event_with_latency_info.h"
7 #include "content/common/input_messages.h" 8 #include "content/common/input_messages.h"
9 #include "content/renderer/render_thread_impl.h"
8 10
9 namespace content { 11 namespace content {
10 12
11 EventWithDispatchType::EventWithDispatchType( 13 EventWithDispatchType::EventWithDispatchType(
12 ui::ScopedWebInputEvent event, 14 ui::ScopedWebInputEvent event,
13 const ui::LatencyInfo& latency, 15 const ui::LatencyInfo& latency,
14 InputEventDispatchType dispatch_type) 16 InputEventDispatchType dispatch_type)
15 : ScopedWebInputEventWithLatencyInfo(std::move(event), latency), 17 : ScopedWebInputEventWithLatencyInfo(std::move(event), latency),
16 dispatch_type_(dispatch_type) {} 18 dispatch_type_(dispatch_type) {}
17 19
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 in_flight_event_->latencyInfo(), 111 in_flight_event_->latencyInfo(),
110 dispatch_type); 112 dispatch_type);
111 } 113 }
112 114
113 in_flight_event_.reset(); 115 in_flight_event_.reset();
114 } 116 }
115 117
116 void MainThreadEventQueue::EventHandled(blink::WebInputEvent::Type type, 118 void MainThreadEventQueue::EventHandled(blink::WebInputEvent::Type type,
117 InputEventAckState ack_result) { 119 InputEventAckState ack_result) {
118 if (in_flight_event_) { 120 if (in_flight_event_) {
121 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current();
119 // Send acks for blocking touch events. 122 // Send acks for blocking touch events.
120 for (const auto id : in_flight_event_->eventsToAck()) 123 for (const auto id : in_flight_event_->eventsToAck()) {
121 client_->SendInputEventAck(routing_id_, type, ack_result, id); 124 client_->SendInputEventAck(routing_id_, type, ack_result, id);
125 if (render_thread_impl)
tdresser 2016/08/18 20:58:38 {}
126 render_thread_impl->GetRendererScheduler()
127 ->DidHandleInputEventOnMainThread(in_flight_event_->event());
128 }
122 } 129 }
123 } 130 }
124 131
125 void MainThreadEventQueue::SendEventNotificationToMainThread() { 132 void MainThreadEventQueue::SendEventNotificationToMainThread() {
126 main_task_runner_->PostTask( 133 main_task_runner_->PostTask(
127 FROM_HERE, base::Bind(&MainThreadEventQueue::PopEventOnMainThread, 134 FROM_HERE, base::Bind(&MainThreadEventQueue::PopEventOnMainThread,
128 this)); 135 this));
129 } 136 }
130 137
131 void MainThreadEventQueue::QueueEvent( 138 void MainThreadEventQueue::QueueEvent(
132 std::unique_ptr<EventWithDispatchType> event) { 139 std::unique_ptr<EventWithDispatchType> event) {
133 bool send_notification = false; 140 bool send_notification = false;
134 { 141 {
135 base::AutoLock lock(event_queue_lock_); 142 base::AutoLock lock(event_queue_lock_);
136 size_t size_before = events_.size(); 143 size_t size_before = events_.size();
137 events_.Queue(std::move(event)); 144 events_.Queue(std::move(event));
138 send_notification = events_.size() != size_before; 145 send_notification = events_.size() != size_before;
139 } 146 }
140 if (send_notification) 147 if (send_notification)
141 SendEventNotificationToMainThread(); 148 SendEventNotificationToMainThread();
142 } 149 }
143 150
144 } // namespace content 151 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698