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> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 // WebInputEvent coordinates are in DPIs, while LatencyInfo expects | 53 // WebInputEvent coordinates are in DPIs, while LatencyInfo expects |
54 // coordinates in device pixels. | 54 // coordinates in device pixels. |
55 void set_device_scale_factor(float device_scale_factor) { | 55 void set_device_scale_factor(float device_scale_factor) { |
56 device_scale_factor_ = device_scale_factor; | 56 device_scale_factor_ = device_scale_factor; |
57 } | 57 } |
58 | 58 |
59 // Returns the ID that uniquely describes this component to the latency | 59 // Returns the ID that uniquely describes this component to the latency |
60 // subsystem. | 60 // subsystem. |
61 int64_t latency_component_id() const { return latency_component_id_; } | 61 int64_t latency_component_id() const { return latency_component_id_; } |
62 | 62 |
63 // Add/remove a callback that can handle input events routed to latency | |
64 // tracker. | |
65 typedef base::Callback<bool(const blink::WebInputEvent&)> InputEventCallback; | |
66 void AddInputEventCallback(const InputEventCallback& callback); | |
67 void RemoveInputEventCallback(const InputEventCallback& callback); | |
68 | |
63 private: | 69 private: |
64 int64_t last_event_id_; | 70 int64_t last_event_id_; |
65 int64_t latency_component_id_; | 71 int64_t latency_component_id_; |
66 float device_scale_factor_; | 72 float device_scale_factor_; |
67 bool has_seen_first_gesture_scroll_update_; | 73 bool has_seen_first_gesture_scroll_update_; |
74 std::vector<InputEventCallback> input_event_callbacks_; | |
Bryan McQuade
2016/05/25 21:32:30
can you use base::ObserverList here? the comments
| |
68 | 75 |
69 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker); | 76 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTracker); |
70 }; | 77 }; |
71 | 78 |
72 } // namespace content | 79 } // namespace content |
73 | 80 |
74 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKE R_H_ | 81 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_RENDER_WIDGET_HOST_LATENCY_TRACKE R_H_ |
OLD | NEW |