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_RENDER_WIDGET_HOST_LATENCY_TRACKER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_LATENCY_TRACKER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_LATENCY_TRACKER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_LATENCY_TRACKER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "cc/base/rolling_time_delta_history.h" |
11 #include "content/browser/renderer_host/event_with_latency_info.h" | 12 #include "content/browser/renderer_host/event_with_latency_info.h" |
12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
13 #include "ui/events/latency_info.h" | 14 #include "ui/events/latency_info.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 // Utility class for tracking the latency of events passing through | 18 // Utility class for tracking the latency of events passing through |
18 // a given RenderWidgetHost. | 19 // a given RenderWidgetHost. |
19 class CONTENT_EXPORT RenderWidgetHostLatencyTracker { | 20 class CONTENT_EXPORT RenderWidgetHostLatencyTracker { |
20 public: | 21 public: |
(...skipping 20 matching lines...) Expand all Loading... |
41 // Populates renderer-created LatencyInfo entries with the appropriate latency | 42 // Populates renderer-created LatencyInfo entries with the appropriate latency |
42 // component id. Called when the RenderWidgetHost receives a compositor swap | 43 // component id. Called when the RenderWidgetHost receives a compositor swap |
43 // update from the renderer. | 44 // update from the renderer. |
44 void OnSwapCompositorFrame(std::vector<ui::LatencyInfo>* latencies); | 45 void OnSwapCompositorFrame(std::vector<ui::LatencyInfo>* latencies); |
45 | 46 |
46 // Terminates latency tracking for events that triggered rendering, also | 47 // Terminates latency tracking for events that triggered rendering, also |
47 // performing relevant UMA latency reporting. | 48 // performing relevant UMA latency reporting. |
48 // Called when the RenderWidgetHost receives a swap update from the GPU. | 49 // Called when the RenderWidgetHost receives a swap update from the GPU. |
49 void OnFrameSwapped(const ui::LatencyInfo& latency); | 50 void OnFrameSwapped(const ui::LatencyInfo& latency); |
50 | 51 |
| 52 // Produces an estimate of the time between browser composite and GPU swap, |
| 53 // as informed by historical latency values. |
| 54 base::TimeDelta GetEstimatedBrowserCompositeTime() const; |
| 55 |
51 // WebInputEvent coordinates are in DPIs, while LatencyInfo expects | 56 // WebInputEvent coordinates are in DPIs, while LatencyInfo expects |
52 // coordinates in device pixels. | 57 // coordinates in device pixels. |
53 void set_device_scale_factor(float device_scale_factor) { | 58 void set_device_scale_factor(float device_scale_factor) { |
54 device_scale_factor_ = device_scale_factor; | 59 device_scale_factor_ = device_scale_factor; |
55 } | 60 } |
56 | 61 |
57 // Returns the ID that uniquely describes this component to the latency | 62 // Returns the ID that uniquely describes this component to the latency |
58 // subsystem. | 63 // subsystem. |
59 int64 latency_component_id() const { return latency_component_id_; } | 64 int64 latency_component_id() const { return latency_component_id_; } |
60 | 65 |
61 private: | 66 private: |
62 int64 last_event_id_; | 67 int64 last_event_id_; |
63 int64 latency_component_id_; | 68 int64 latency_component_id_; |
64 float device_scale_factor_; | 69 float device_scale_factor_; |
| 70 cc::RollingTimeDeltaHistory browser_composite_latency_history_; |
65 | 71 |
66 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker); | 72 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker); |
67 }; | 73 }; |
68 | 74 |
69 } // namespace content | 75 } // namespace content |
70 | 76 |
71 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_LATENCY_TRACKER_H_ | 77 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_LATENCY_TRACKER_H_ |
OLD | NEW |