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 "ui/events/latency_info.h" | 16 #include "ui/events/latency_info.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
| 20 class RenderWidgetHostDelegate; |
| 21 |
20 // Utility class for tracking the latency of events passing through | 22 // Utility class for tracking the latency of events passing through |
21 // a given RenderWidgetHost. | 23 // a given RenderWidgetHost. |
22 class CONTENT_EXPORT RenderWidgetHostLatencyTracker { | 24 class CONTENT_EXPORT RenderWidgetHostLatencyTracker { |
23 public: | 25 public: |
24 RenderWidgetHostLatencyTracker(); | 26 explicit RenderWidgetHostLatencyTracker(); |
25 ~RenderWidgetHostLatencyTracker(); | 27 ~RenderWidgetHostLatencyTracker(); |
26 | 28 |
27 // Associates the latency tracker with a given route and process. | 29 // Associates the latency tracker with a given route and process. |
28 // Called once after the RenderWidgetHost is fully initialized. | 30 // Called once after the RenderWidgetHost is fully initialized. |
29 void Initialize(int routing_id, int process_id); | 31 void Initialize(int routing_id, int process_id); |
30 | 32 |
31 void ComputeInputLatencyHistograms(blink::WebInputEvent::Type type, | 33 void ComputeInputLatencyHistograms(blink::WebInputEvent::Type type, |
32 int64_t latency_component_id, | 34 int64_t latency_component_id, |
33 const ui::LatencyInfo& latency, | 35 const ui::LatencyInfo& latency, |
34 InputEventAckState ack_result); | 36 InputEventAckState ack_result); |
(...skipping 26 matching lines...) Expand all Loading... |
61 // WebInputEvent coordinates are in DPIs, while LatencyInfo expects | 63 // WebInputEvent coordinates are in DPIs, while LatencyInfo expects |
62 // coordinates in device pixels. | 64 // coordinates in device pixels. |
63 void set_device_scale_factor(float device_scale_factor) { | 65 void set_device_scale_factor(float device_scale_factor) { |
64 device_scale_factor_ = device_scale_factor; | 66 device_scale_factor_ = device_scale_factor; |
65 } | 67 } |
66 | 68 |
67 // Returns the ID that uniquely describes this component to the latency | 69 // Returns the ID that uniquely describes this component to the latency |
68 // subsystem. | 70 // subsystem. |
69 int64_t latency_component_id() const { return latency_component_id_; } | 71 int64_t latency_component_id() const { return latency_component_id_; } |
70 | 72 |
| 73 // 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. |
| 75 void SetDelegate(RenderWidgetHostDelegate*); |
| 76 |
71 private: | 77 private: |
72 int64_t last_event_id_; | 78 int64_t last_event_id_; |
73 int64_t latency_component_id_; | 79 int64_t latency_component_id_; |
74 float device_scale_factor_; | 80 float device_scale_factor_; |
75 bool has_seen_first_gesture_scroll_update_; | 81 bool has_seen_first_gesture_scroll_update_; |
76 // Whether the current stream of touch events has ever included more than one | 82 // Whether the current stream of touch events has ever included more than one |
77 // touch point. | 83 // touch point. |
78 bool multi_finger_gesture_; | 84 bool multi_finger_gesture_; |
79 // Whether the touch start for the current stream of touch events had its | 85 // Whether the touch start for the current stream of touch events had its |
80 // default action prevented. Only valid for single finger gestures. | 86 // default action prevented. Only valid for single finger gestures. |
81 bool touch_start_default_prevented_; | 87 bool touch_start_default_prevented_; |
82 | 88 |
| 89 RenderWidgetHostDelegate* render_widget_host_delegate_; |
| 90 |
83 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker); | 91 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker); |
84 }; | 92 }; |
85 | 93 |
86 } // namespace content | 94 } // namespace content |
87 | 95 |
88 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKE
R_H_ | 96 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKE
R_H_ |
OLD | NEW |