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 "components/latency_tracker/latency_tracker.h" |
13 #include "content/browser/renderer_host/event_with_latency_info.h" | 14 #include "content/browser/renderer_host/event_with_latency_info.h" |
14 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
15 #include "content/common/input/input_event_ack_state.h" | 16 #include "content/common/input/input_event_ack_state.h" |
16 #include "ui/events/latency_info.h" | 17 #include "ui/events/latency_info.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 class RenderWidgetHostDelegate; | 21 class RenderWidgetHostDelegate; |
21 | 22 |
22 // Utility class for tracking the latency of events passing through | 23 // Utility class for tracking the latency of events passing through |
23 // a given RenderWidgetHost. | 24 // a given RenderWidgetHost. |
24 class CONTENT_EXPORT RenderWidgetHostLatencyTracker { | 25 class CONTENT_EXPORT RenderWidgetHostLatencyTracker |
| 26 : latency_tracker::LatencyTracker { |
25 public: | 27 public: |
26 explicit RenderWidgetHostLatencyTracker(); | 28 explicit RenderWidgetHostLatencyTracker(); |
27 ~RenderWidgetHostLatencyTracker(); | 29 ~RenderWidgetHostLatencyTracker(); |
28 | 30 |
29 // Associates the latency tracker with a given route and process. | 31 // Associates the latency tracker with a given route and process. |
30 // Called once after the RenderWidgetHost is fully initialized. | 32 // Called once after the RenderWidgetHost is fully initialized. |
31 void Initialize(int routing_id, int process_id); | 33 void Initialize(int routing_id, int process_id); |
32 | 34 |
33 void ComputeInputLatencyHistograms(blink::WebInputEvent::Type type, | 35 void ComputeInputLatencyHistograms(blink::WebInputEvent::Type type, |
34 int64_t latency_component_id, | 36 int64_t latency_component_id, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 70 |
69 // Returns the ID that uniquely describes this component to the latency | 71 // Returns the ID that uniquely describes this component to the latency |
70 // subsystem. | 72 // subsystem. |
71 int64_t latency_component_id() const { return latency_component_id_; } | 73 int64_t latency_component_id() const { return latency_component_id_; } |
72 | 74 |
73 // A delegate is used to get the url to be stored in Rappor Sample. | 75 // A delegate is used to get the url to be stored in Rappor Sample. |
74 // If delegate is null no Rappor sample will be reported. | 76 // If delegate is null no Rappor sample will be reported. |
75 void SetDelegate(RenderWidgetHostDelegate*); | 77 void SetDelegate(RenderWidgetHostDelegate*); |
76 | 78 |
77 private: | 79 private: |
| 80 // latency_tracker::LatencyTracker: |
| 81 void ReportRapporScrollLatency( |
| 82 const std::string& name, |
| 83 const ui::LatencyInfo::LatencyComponent& start_component, |
| 84 const ui::LatencyInfo::LatencyComponent& end_component) override; |
| 85 |
78 int64_t last_event_id_; | 86 int64_t last_event_id_; |
79 int64_t latency_component_id_; | 87 int64_t latency_component_id_; |
80 float device_scale_factor_; | 88 float device_scale_factor_; |
81 bool has_seen_first_gesture_scroll_update_; | 89 bool has_seen_first_gesture_scroll_update_; |
82 // Whether the current stream of touch events has ever included more than one | 90 // Whether the current stream of touch events has ever included more than one |
83 // touch point. | 91 // touch point. |
84 bool multi_finger_gesture_; | 92 bool multi_finger_gesture_; |
85 // Whether the touch start for the current stream of touch events had its | 93 // Whether the touch start for the current stream of touch events had its |
86 // default action prevented. Only valid for single finger gestures. | 94 // default action prevented. Only valid for single finger gestures. |
87 bool touch_start_default_prevented_; | 95 bool touch_start_default_prevented_; |
88 | 96 |
89 RenderWidgetHostDelegate* render_widget_host_delegate_; | 97 RenderWidgetHostDelegate* render_widget_host_delegate_; |
90 | 98 |
91 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker); | 99 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker); |
92 }; | 100 }; |
93 | 101 |
94 } // namespace content | 102 } // namespace content |
95 | 103 |
96 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKE
R_H_ | 104 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKE
R_H_ |
OLD | NEW |