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

Side by Side Diff: content/browser/renderer_host/touch_event_queue.cc

Issue 17757002: Add UMA/Telemetry stats for touch event latency (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: move ACKED_COMPONENT && ComputeTouchLatency() to TouchEventQueue ; Merge FindLatency() with ToT Has… Created 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/renderer_host/touch_event_queue.h" 5 #include "content/browser/renderer_host/touch_event_queue.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "content/browser/renderer_host/render_widget_host_impl.h" 9 #include "content/browser/renderer_host/render_widget_host_impl.h"
10 #include "content/public/browser/render_widget_host_view.h" 10 #include "content/public/browser/render_widget_host_view.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void TouchEventQueue::PopTouchEventToView(InputEventAckState ack_result) { 180 void TouchEventQueue::PopTouchEventToView(InputEventAckState ack_result) {
181 if (touch_queue_.empty()) 181 if (touch_queue_.empty())
182 return; 182 return;
183 scoped_ptr<CoalescedWebTouchEvent> acked_event(touch_queue_.front()); 183 scoped_ptr<CoalescedWebTouchEvent> acked_event(touch_queue_.front());
184 touch_queue_.pop_front(); 184 touch_queue_.pop_front();
185 185
186 // Note that acking the touch-event may result in multiple gestures being sent 186 // Note that acking the touch-event may result in multiple gestures being sent
187 // to the renderer. 187 // to the renderer.
188 RenderWidgetHostViewPort* view = RenderWidgetHostViewPort::FromRWHV( 188 RenderWidgetHostViewPort* view = RenderWidgetHostViewPort::FromRWHV(
189 render_widget_host_->GetView()); 189 render_widget_host_->GetView());
190 for (WebTouchEventWithLatencyList::const_iterator iter = acked_event->begin(), 190 for (WebTouchEventWithLatencyList::const_iterator iter = acked_event->begin(),
sadrul 2013/06/27 22:40:12 You probably can just use an iterator here instead
Yufeng Shen (Slow to review) 2013/06/27 23:44:07 begin() only returns const_iterator so we have to
191 end = acked_event->end(); 191 end = acked_event->end();
192 iter != end; ++iter) { 192 iter != end; ++iter) {
193 ui::LatencyInfo* latency = const_cast<ui::LatencyInfo*>(&(iter->latency));
194 latency->AddLatencyNumber(
195 ui::INPUT_EVENT_LATENCY_ACKED_COMPONENT, 0, 0);
196 render_widget_host_->ComputeTouchLatency(*latency);
193 view->ProcessAckedTouchEvent((*iter), ack_result); 197 view->ProcessAckedTouchEvent((*iter), ack_result);
194 } 198 }
195 } 199 }
196 200
197 bool TouchEventQueue::ShouldForwardToRenderer( 201 bool TouchEventQueue::ShouldForwardToRenderer(
198 const WebKit::WebTouchEvent& event) const { 202 const WebKit::WebTouchEvent& event) const {
199 // Touch press events should always be forwarded to the renderer. 203 // Touch press events should always be forwarded to the renderer.
200 if (event.type == WebKit::WebInputEvent::TouchStart) 204 if (event.type == WebKit::WebInputEvent::TouchStart)
201 return true; 205 return true;
202 206
(...skipping 11 matching lines...) Expand all
214 // If the ACK status of a point is unknown, then the event should be 218 // If the ACK status of a point is unknown, then the event should be
215 // forwarded to the renderer. 219 // forwarded to the renderer.
216 return true; 220 return true;
217 } 221 }
218 } 222 }
219 223
220 return false; 224 return false;
221 } 225 }
222 226
223 } // namespace content 227 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698