OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 UI_LATENCY_LATENCY_INFO_H_ | 5 #ifndef UI_LATENCY_LATENCY_INFO_H_ |
6 #define UI_LATENCY_LATENCY_INFO_H_ | 6 #define UI_LATENCY_LATENCY_INFO_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT, | 68 INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT, |
69 // Timestamp when the event's ack is received by the RWH. | 69 // Timestamp when the event's ack is received by the RWH. |
70 INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, | 70 INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, |
71 // Frame number when a browser snapshot was requested. The snapshot | 71 // Frame number when a browser snapshot was requested. The snapshot |
72 // is taken when the rendering results actually reach the screen. | 72 // is taken when the rendering results actually reach the screen. |
73 BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT, | 73 BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT, |
74 // Timestamp when a tab is requested to be shown. | 74 // Timestamp when a tab is requested to be shown. |
75 TAB_SHOW_COMPONENT, | 75 TAB_SHOW_COMPONENT, |
76 // Timestamp when the frame is swapped in renderer. | 76 // Timestamp when the frame is swapped in renderer. |
77 INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, | 77 INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, |
78 // Timestamp of when the browser process receives a buffer swap notification | 78 // Timestamp of when the display compositor receives a compositor frame from |
79 // from the renderer. | 79 // the renderer. |
80 INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, | 80 // Display compositor can be either in the browser process or in Mus. |
| 81 DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, |
81 // Timestamp of when the gpu service began swap buffers, unlike | 82 // Timestamp of when the gpu service began swap buffers, unlike |
82 // INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT which measures after. | 83 // INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT which measures after. |
83 INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, | 84 INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, |
84 // Timestamp of when the gesture scroll update is generated from a mouse wheel | 85 // Timestamp of when the gesture scroll update is generated from a mouse wheel |
85 // event. | 86 // event. |
86 INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, | 87 INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, |
87 // ---------------------------TERMINAL COMPONENT----------------------------- | 88 // ---------------------------TERMINAL COMPONENT----------------------------- |
88 // Timestamp when the event is acked from renderer when it does not | 89 // Timestamp when the event is acked from renderer when it does not |
89 // cause any rendering to be scheduled. | 90 // cause any rendering to be scheduled. |
90 INPUT_EVENT_LATENCY_TERMINATED_NO_SWAP_COMPONENT, | 91 INPUT_EVENT_LATENCY_TERMINATED_NO_SWAP_COMPONENT, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 base::TimeTicks time, | 187 base::TimeTicks time, |
187 uint32_t event_count); | 188 uint32_t event_count); |
188 | 189 |
189 // Returns true if the a component with |type| and |id| is found in | 190 // Returns true if the a component with |type| and |id| is found in |
190 // the latency_components and the component is stored to |output| if | 191 // the latency_components and the component is stored to |output| if |
191 // |output| is not NULL. Returns false if no such component is found. | 192 // |output| is not NULL. Returns false if no such component is found. |
192 bool FindLatency(LatencyComponentType type, | 193 bool FindLatency(LatencyComponentType type, |
193 int64_t id, | 194 int64_t id, |
194 LatencyComponent* output) const; | 195 LatencyComponent* output) const; |
195 | 196 |
| 197 // Returns true if a component with |type| is found in the latency component. |
| 198 // The first such component (when iterating over latency_components_) is |
| 199 // stored to |output| if |output| is not NULL. Returns false if no such |
| 200 // component is found. |
| 201 bool FindLatency(LatencyComponentType type, LatencyComponent* output) const; |
| 202 |
196 void RemoveLatency(LatencyComponentType type); | 203 void RemoveLatency(LatencyComponentType type); |
197 | 204 |
198 // Returns true if there is still room for keeping the |input_coordinate|, | 205 // Returns true if there is still room for keeping the |input_coordinate|, |
199 // false otherwise. | 206 // false otherwise. |
200 bool AddInputCoordinate(const gfx::PointF& input_coordinate); | 207 bool AddInputCoordinate(const gfx::PointF& input_coordinate); |
201 | 208 |
202 uint32_t input_coordinates_size() const { return input_coordinates_size_; } | 209 uint32_t input_coordinates_size() const { return input_coordinates_size_; } |
203 const gfx::PointF* input_coordinates() const { return input_coordinates_; } | 210 const gfx::PointF* input_coordinates() const { return input_coordinates_; } |
204 | 211 |
205 const LatencyMap& latency_components() const { return latency_components_; } | 212 const LatencyMap& latency_components() const { return latency_components_; } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 // Stores the type of the first source event. | 256 // Stores the type of the first source event. |
250 SourceEventType source_event_type_; | 257 SourceEventType source_event_type_; |
251 | 258 |
252 #if !defined(OS_IOS) | 259 #if !defined(OS_IOS) |
253 friend struct IPC::ParamTraits<ui::LatencyInfo>; | 260 friend struct IPC::ParamTraits<ui::LatencyInfo>; |
254 friend struct mojo::StructTraits<ui::mojom::LatencyInfoDataView, | 261 friend struct mojo::StructTraits<ui::mojom::LatencyInfoDataView, |
255 ui::LatencyInfo>; | 262 ui::LatencyInfo>; |
256 #endif | 263 #endif |
257 }; | 264 }; |
258 | 265 |
| 266 // This is declared here for use in gtest-based unit tests, but is defined in |
| 267 // //ui/latency:test_support target. |
| 268 // Without this the default PrintTo template in gtest tries to pass LatencyInfo |
| 269 // by value, which leads to an alignment compile error on Windows. |
| 270 void PrintTo(const LatencyInfo& latency, ::std::ostream* os); |
| 271 |
259 } // namespace ui | 272 } // namespace ui |
260 | 273 |
261 #endif // UI_LATENCY_LATENCY_INFO_H_ | 274 #endif // UI_LATENCY_LATENCY_INFO_H_ |
OLD | NEW |