| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/render_widget_host_latency_tracker.h" | 5 #include "content/browser/renderer_host/render_widget_host_latency_tracker.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "content/browser/renderer_host/render_widget_host_impl.h" | 9 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 10 | 10 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 void RenderWidgetHostLatencyTracker::OnInputEventAck( | 213 void RenderWidgetHostLatencyTracker::OnInputEventAck( |
| 214 const blink::WebInputEvent& event, | 214 const blink::WebInputEvent& event, |
| 215 LatencyInfo* latency) { | 215 LatencyInfo* latency) { |
| 216 DCHECK(latency); | 216 DCHECK(latency); |
| 217 | 217 |
| 218 // Latency ends when it is acked but does not cause render scheduling. | 218 // Latency ends when it is acked but does not cause render scheduling. |
| 219 bool rendering_scheduled = latency->FindLatency( | 219 bool rendering_scheduled = latency->FindLatency( |
| 220 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL); | 220 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL); |
| 221 | 221 |
| 222 if (WebInputEvent::isGestureEventType(event.type)) { | 222 if (WebInputEvent::isGestureEventType(event.type)) { |
| 223 if (rendering_scheduled) { | 223 if (!rendering_scheduled) { |
| 224 latency->AddLatencyNumber( | 224 latency->AddLatencyNumber( |
| 225 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, 0); | 225 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, 0); |
| 226 // TODO(jdduke): Consider exposing histograms for gesture event types. | 226 // TODO(jdduke): Consider exposing histograms for gesture event types. |
| 227 } | 227 } |
| 228 return; | 228 return; |
| 229 } | 229 } |
| 230 | 230 |
| 231 if (WebInputEvent::isTouchEventType(event.type)) { | 231 if (WebInputEvent::isTouchEventType(event.type)) { |
| 232 latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0); | 232 latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0); |
| 233 if (rendering_scheduled) { | 233 if (!rendering_scheduled) { |
| 234 latency->AddLatencyNumber( | 234 latency->AddLatencyNumber( |
| 235 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); | 235 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); |
| 236 ComputeInputLatencyHistograms(WebInputEvent::TouchTypeFirst, | |
| 237 latency_component_id_, *latency); | |
| 238 } | 236 } |
| 237 ComputeInputLatencyHistograms(WebInputEvent::TouchTypeFirst, |
| 238 latency_component_id_, *latency); |
| 239 return; | 239 return; |
| 240 } | 240 } |
| 241 | 241 |
| 242 if (event.type == WebInputEvent::MouseWheel) { | 242 if (event.type == WebInputEvent::MouseWheel) { |
| 243 latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0); | 243 latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0); |
| 244 if (rendering_scheduled) { | 244 if (!rendering_scheduled) { |
| 245 latency->AddLatencyNumber( | 245 latency->AddLatencyNumber( |
| 246 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0); | 246 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0); |
| 247 ComputeInputLatencyHistograms(WebInputEvent::MouseWheel, | |
| 248 latency_component_id_, *latency); | |
| 249 } | 247 } |
| 248 ComputeInputLatencyHistograms(WebInputEvent::MouseWheel, |
| 249 latency_component_id_, *latency); |
| 250 return; | 250 return; |
| 251 } | 251 } |
| 252 | 252 |
| 253 // TODO(jdduke): Determine if mouse and keyboard events are worth hooking | 253 // TODO(jdduke): Determine if mouse and keyboard events are worth hooking |
| 254 // into LatencyInfo. | 254 // into LatencyInfo. |
| 255 } | 255 } |
| 256 | 256 |
| 257 void RenderWidgetHostLatencyTracker::OnSwapCompositorFrame( | 257 void RenderWidgetHostLatencyTracker::OnSwapCompositorFrame( |
| 258 std::vector<LatencyInfo>* latencies) { | 258 std::vector<LatencyInfo>* latencies) { |
| 259 DCHECK(latencies); | 259 DCHECK(latencies); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 (swap_component.event_time - original_component.event_time) | 299 (swap_component.event_time - original_component.event_time) |
| 300 .InMicroseconds(), | 300 .InMicroseconds(), |
| 301 1, | 301 1, |
| 302 1000000, | 302 1000000, |
| 303 100); | 303 100); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace content | 308 } // namespace content |
| OLD | NEW |