Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: content/browser/renderer_host/input/render_widget_host_latency_tracker.h

Issue 2814483002: Splitting up RenderWidgetHostLatencyTracker and some renames. (Closed)
Patch Set: [Moving OnGpuSwapBuffersCompleted() back up. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/latency/latency_info.h" 16 #include "ui/latency/latency_info.h"
17 #include "ui/latency/latency_tracker.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 : NON_EXPORTED_BASE(public ui::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 12 matching lines...) Expand all
47 // to the RenderWidgetHost (from the InputRouter). 49 // to the RenderWidgetHost (from the InputRouter).
48 void OnInputEventAck(const blink::WebInputEvent& event, 50 void OnInputEventAck(const blink::WebInputEvent& event,
49 ui::LatencyInfo* latency, 51 ui::LatencyInfo* latency,
50 InputEventAckState ack_result); 52 InputEventAckState ack_result);
51 53
52 // Populates renderer-created LatencyInfo entries with the appropriate latency 54 // Populates renderer-created LatencyInfo entries with the appropriate latency
53 // component id. Called when the RenderWidgetHost receives a compositor swap 55 // component id. Called when the RenderWidgetHost receives a compositor swap
54 // update from the renderer. 56 // update from the renderer.
55 void OnSwapCompositorFrame(std::vector<ui::LatencyInfo>* latencies); 57 void OnSwapCompositorFrame(std::vector<ui::LatencyInfo>* latencies);
56 58
57 // Terminates latency tracking for events that triggered rendering, also
58 // performing relevant UMA latency reporting.
59 // Called when the RenderWidgetHost receives a swap update from the GPU.
60 void OnGpuSwapBuffersCompleted(const ui::LatencyInfo& latency);
61
62 // WebInputEvent coordinates are in DPIs, while LatencyInfo expects 59 // WebInputEvent coordinates are in DPIs, while LatencyInfo expects
63 // coordinates in device pixels. 60 // coordinates in device pixels.
64 void set_device_scale_factor(float device_scale_factor) { 61 void set_device_scale_factor(float device_scale_factor) {
65 device_scale_factor_ = device_scale_factor; 62 device_scale_factor_ = device_scale_factor;
66 } 63 }
67 64
68 // Returns the ID that uniquely describes this component to the latency 65 // Returns the ID that uniquely describes this component to the latency
69 // subsystem. 66 // subsystem.
70 int64_t latency_component_id() const { return latency_component_id_; } 67 int64_t latency_component_id() const { return latency_component_id_; }
71 68
72 // A delegate is used to get the url to be stored in Rappor Sample. 69 // A delegate is used to get the url to be stored in Rappor Sample.
73 // If delegate is null no Rappor sample will be reported. 70 // If delegate is null no Rappor sample will be reported.
74 void SetDelegate(RenderWidgetHostDelegate*); 71 void SetDelegate(RenderWidgetHostDelegate*);
75 72
76 private: 73 private:
74 // ui::LatencyTracker:
75 void ReportRapporScrollLatency(
76 const std::string& name,
77 const ui::LatencyInfo::LatencyComponent& start_component,
78 const ui::LatencyInfo::LatencyComponent& end_component) override;
79
77 int64_t last_event_id_; 80 int64_t last_event_id_;
78 int64_t latency_component_id_; 81 int64_t latency_component_id_;
79 float device_scale_factor_; 82 float device_scale_factor_;
80 bool has_seen_first_gesture_scroll_update_; 83 bool has_seen_first_gesture_scroll_update_;
81 // Whether the current stream of touch events includes more than one active 84 // Whether the current stream of touch events includes more than one active
82 // touch point. This is set in OnInputEvent, and cleared in OnInputEventAck. 85 // touch point. This is set in OnInputEvent, and cleared in OnInputEventAck.
83 bool active_multi_finger_gesture_; 86 bool active_multi_finger_gesture_;
84 // Whether the touch start for the current stream of touch events had its 87 // Whether the touch start for the current stream of touch events had its
85 // default action prevented. Only valid for single finger gestures. 88 // default action prevented. Only valid for single finger gestures.
86 bool touch_start_default_prevented_; 89 bool touch_start_default_prevented_;
87 90
88 RenderWidgetHostDelegate* render_widget_host_delegate_; 91 RenderWidgetHostDelegate* render_widget_host_delegate_;
89 92
90 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker); 93 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker);
91 }; 94 };
92 95
93 } // namespace content 96 } // namespace content
94 97
95 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKE R_H_ 98 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698