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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 16213002: Add telemetry to track the time an event spent waiting for the main thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index edd21fe5987575faff070ae5dc9e50fd355d00f0..30ec7961820af78dbf831ef02897370e739eed09 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -2100,14 +2100,16 @@ void RenderWidgetHostImpl::OnWheelEventAck(
}
void RenderWidgetHostImpl::OnGestureEventAck(
- const WebKit::WebGestureEvent& event,
+ const GestureEventWithLatencyInfo& event,
InputEventAckState ack_result) {
const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result);
if (overscroll_controller_)
- overscroll_controller_->ReceivedEventACK(event, processed);
+ overscroll_controller_->ReceivedEventACK(event.event, processed);
if (view_)
- view_->GestureEventAck(event.type, ack_result);
+ view_->GestureEventAck(event.event.type, ack_result);
+
+ UpdateRenderingStatsForImplThreadLatency(event.event.type, event.latency);
}
void RenderWidgetHostImpl::OnTouchEventAck(
@@ -2364,6 +2366,39 @@ void RenderWidgetHostImpl::DelayedAutoResized() {
OnRenderAutoResized(new_size);
}
+void RenderWidgetHostImpl::UpdateRenderingStatsForImplThreadLatency(
nduca 2013/08/15 01:41:04 I'd like to see you modify enough of the input rou
+ WebKit::WebInputEvent::Type type,
+ const ui::LatencyInfo& latency_info) {
+ ui::LatencyInfo::LatencyComponent dispatch_component;
+ ui::LatencyInfo::LatencyComponent receive_component;
+ if (!latency_info.FindLatency(
+ ui::INPUT_EVENT_LATENCY_EVENT_SENT_FROM_IMPL_THREAD_COMPONENT,
+ routing_id_, &dispatch_component) ||
+ !latency_info.FindLatency(
+ ui::INPUT_EVENT_LATENCY_EVENT_RECEIVED_ON_MAIN_THREAD_COMPONENT,
+ routing_id_, &receive_component))
+ return;
+
+ bool stats_changed = false;
+ if (WebKit::WebInputEvent::isTouchEventType(type)) {
+ rendering_stats_.total_impl_to_main_touch_event_latency +=
+ (receive_component.event_time - dispatch_component.event_time);
+ rendering_stats_.impl_to_main_touch_event_count++;
+ stats_changed = true;
+ } else if (type == WebKit::WebInputEvent::GestureScrollBegin ||
+ type == WebKit::WebInputEvent::GestureScrollUpdate ||
+ type == WebKit::WebInputEvent::GestureScrollUpdateWithoutPropagation) {
+ rendering_stats_.total_impl_to_main_gesture_scroll_event_latency +=
+ (receive_component.event_time - dispatch_component.event_time);
+ rendering_stats_.impl_to_main_gesture_scroll_event_count++;
+ stats_changed = true;
+ }
+
+ if (stats_changed && CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableGpuBenchmarking))
+ Send(new ViewMsg_SetBrowserRenderingStats(routing_id_, rendering_stats_));
+}
+
void RenderWidgetHostImpl::DetachDelegate() {
delegate_ = NULL;
}

Powered by Google App Engine
This is Rietveld 408576698