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