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 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKER_H
_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKER_H
_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKER_H
_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKER_H
_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "content/browser/renderer_host/event_with_latency_info.h" | 13 #include "content/browser/renderer_host/event_with_latency_info.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/common/input/input_event_ack_state.h" | 15 #include "content/common/input/input_event_ack_state.h" |
16 #include "services/metrics/public/cpp/ukm_recorder.h" | 16 #include "services/metrics/public/cpp/ukm_recorder.h" |
17 #include "ui/latency/latency_info.h" | 17 #include "ui/latency/latency_info.h" |
18 #include "ui/latency/latency_tracker.h" | 18 #include "ui/latency/latency_tracker.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 class RenderWidgetHostDelegate; | 22 class RenderWidgetHostDelegate; |
23 | 23 |
24 // Utility class for tracking the latency of events passing through | 24 // Utility class for tracking the latency of events passing through |
25 // a given RenderWidgetHost. | 25 // a given RenderWidgetHost. |
26 class CONTENT_EXPORT RenderWidgetHostLatencyTracker | 26 class CONTENT_EXPORT RenderWidgetHostLatencyTracker |
27 : NON_EXPORTED_BASE(public ui::LatencyTracker) { | 27 : NON_EXPORTED_BASE(public ui::LatencyTracker) { |
28 public: | 28 public: |
29 explicit RenderWidgetHostLatencyTracker(); | 29 explicit RenderWidgetHostLatencyTracker(bool metric_sampling); |
30 ~RenderWidgetHostLatencyTracker(); | 30 ~RenderWidgetHostLatencyTracker(); |
31 | 31 |
32 // Associates the latency tracker with a given route and process. | 32 // Associates the latency tracker with a given route and process. |
33 // Called once after the RenderWidgetHost is fully initialized. | 33 // Called once after the RenderWidgetHost is fully initialized. |
34 void Initialize(int routing_id, int process_id); | 34 void Initialize(int routing_id, int process_id); |
35 | 35 |
36 void ComputeInputLatencyHistograms(blink::WebInputEvent::Type type, | 36 void ComputeInputLatencyHistograms(blink::WebInputEvent::Type type, |
37 int64_t latency_component_id, | 37 int64_t latency_component_id, |
38 const ui::LatencyInfo& latency, | 38 const ui::LatencyInfo& latency, |
39 InputEventAckState ack_result); | 39 InputEventAckState ack_result); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 int64_t latency_component_id_; | 92 int64_t latency_component_id_; |
93 float device_scale_factor_; | 93 float device_scale_factor_; |
94 bool has_seen_first_gesture_scroll_update_; | 94 bool has_seen_first_gesture_scroll_update_; |
95 // Whether the current stream of touch events includes more than one active | 95 // Whether the current stream of touch events includes more than one active |
96 // touch point. This is set in OnInputEvent, and cleared in OnInputEventAck. | 96 // touch point. This is set in OnInputEvent, and cleared in OnInputEventAck. |
97 bool active_multi_finger_gesture_; | 97 bool active_multi_finger_gesture_; |
98 // Whether the touch start for the current stream of touch events had its | 98 // Whether the touch start for the current stream of touch events had its |
99 // default action prevented. Only valid for single finger gestures. | 99 // default action prevented. Only valid for single finger gestures. |
100 bool touch_start_default_prevented_; | 100 bool touch_start_default_prevented_; |
101 | 101 |
| 102 // Whether the sampling is needed for high volume metrics. This will be off |
| 103 // when we are in unit tests. This is a temporary field so we can come up with |
| 104 // a more permanent solution for crbug.com/739169. |
| 105 bool metric_sampling_; |
| 106 int metric_sampling_events_since_last_sample_; |
| 107 |
102 RenderWidgetHostDelegate* render_widget_host_delegate_; | 108 RenderWidgetHostDelegate* render_widget_host_delegate_; |
103 | 109 |
104 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker); | 110 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker); |
105 }; | 111 }; |
106 | 112 |
107 } // namespace content | 113 } // namespace content |
108 | 114 |
109 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKE
R_H_ | 115 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKE
R_H_ |
OLD | NEW |