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_EVENTS_LATENCY_INFO_H_ | 5 #ifndef UI_EVENTS_LATENCY_INFO_H_ |
6 #define UI_EVENTS_LATENCY_INFO_H_ | 6 #define UI_EVENTS_LATENCY_INFO_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/containers/small_map.h" | 12 #include "base/containers/small_map.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "ui/events/events_base_export.h" | 14 #include "ui/events/events_base_export.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 | 17 |
18 enum LatencyComponentType { | 18 enum LatencyComponentType { |
19 // ---------------------------BEGIN COMPONENT------------------------------- | 19 // ---------------------------BEGIN COMPONENT------------------------------- |
20 // BEGIN COMPONENT is when we show the latency begin in chrome://tracing. | 20 // BEGIN COMPONENT is when we show the latency begin in chrome://tracing. |
21 // Timestamp when the input event is sent from RenderWidgetHost to renderer. | 21 // Timestamp when the input event is sent from RenderWidgetHost to renderer. |
22 INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, | 22 INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, |
23 // Timestamp when the input event is received in plugin. | 23 // Timestamp when the input event is received in plugin. |
24 INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT, | 24 INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT, |
25 // Timestamp when a scroll update for the main thread is begun. | 25 // Timestamp when a scroll update for the main thread is begun. |
26 INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT, | 26 INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT, |
27 // ---------------------------NORMAL COMPONENT------------------------------- | 27 // ---------------------------NORMAL COMPONENT------------------------------- |
| 28 // Timestamp when the scroll update gesture event is sent from RWH to |
| 29 // renderer. In Aura, touch event's LatencyInfo is carried over to the gesture |
| 30 // event. So gesture event's INPUT_EVENT_LATENCY_RWH_COMPONENT is the |
| 31 // timestamp when its original touch events is sent from RWH to renderer. |
| 32 // In non-aura platform, INPUT_EVENT_LATENCY_SCROLL_UPDATE_RWH_COMPONENT |
| 33 // is the same as INPUT_EVENT_LATENCY_RWH_COMPONENT. |
| 34 INPUT_EVENT_LATENCY_SCROLL_UPDATE_RWH_COMPONENT, |
28 // The original timestamp of the touch event which converts to scroll update. | 35 // The original timestamp of the touch event which converts to scroll update. |
29 INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, | 36 INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, |
30 // The original timestamp of the touch event which converts to the *first* | |
31 // scroll update in a scroll gesture sequence. | |
32 INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, | |
33 // Original timestamp for input event (e.g. timestamp from kernel). | 37 // Original timestamp for input event (e.g. timestamp from kernel). |
34 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, | 38 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
35 // Timestamp when the UI event is created. | 39 // Timestamp when the UI event is created. |
36 INPUT_EVENT_LATENCY_UI_COMPONENT, | 40 INPUT_EVENT_LATENCY_UI_COMPONENT, |
37 // This is special component indicating there is rendering scheduled for | 41 // This is special component indicating there is rendering scheduled for |
38 // the event associated with this LatencyInfo on main thread. | 42 // the event associated with this LatencyInfo. |
39 INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, | 43 INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, |
40 // This is special component indicating there is rendering scheduled for | |
41 // the event associated with this LatencyInfo on impl thread. | |
42 INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, | |
43 // Timestamp when a scroll update is forwarded to the main thread. | 44 // Timestamp when a scroll update is forwarded to the main thread. |
44 INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT, | 45 INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT, |
45 // Timestamp when the event's ack is received by the RWH. | 46 // Timestamp when the touch event is acked. |
46 INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, | 47 INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, |
47 // Frame number when a window snapshot was requested. The snapshot | 48 // Frame number when a window snapshot was requested. The snapshot |
48 // is taken when the rendering results actually reach the screen. | 49 // is taken when the rendering results actually reach the screen. |
49 WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, | 50 WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, |
50 // Frame number for a snapshot requested via | 51 // Frame number for a snapshot requested via |
51 // gpuBenchmarking.beginWindowSnapshotPNG | 52 // gpuBenchmarking.beginWindowSnapshotPNG |
52 // TODO(vkuzkokov): remove when patch adding this hits Stable | 53 // TODO(vkuzkokov): remove when patch adding this hits Stable |
53 WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT, | 54 WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT, |
54 // Timestamp when a tab is requested to be shown. | 55 // Timestamp when a tab is requested to be shown. |
55 TAB_SHOW_COMPONENT, | 56 TAB_SHOW_COMPONENT, |
56 // Timestamp when the frame is swapped in renderer. | 57 // Timestamp of when the Browser process began compositing |
57 INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, | 58 INPUT_EVENT_BROWSER_COMPOSITE_COMPONENT, |
58 // Timestamp of when the browser process receives a buffer swap notification | 59 // Timestamp of when the Browser process began swap buffers |
59 // from the renderer. | 60 INPUT_EVENT_BROWSER_SWAP_BUFFER_COMPONENT, |
60 INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, | |
61 // Timestamp of when the gpu service began swap buffers, unlike | 61 // Timestamp of when the gpu service began swap buffers, unlike |
62 // INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT which measures after. | 62 // INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT which measure after |
63 INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, | 63 INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, |
64 // ---------------------------TERMINAL COMPONENT----------------------------- | 64 // ---------------------------TERMINAL COMPONENT----------------------------- |
65 // TERMINAL COMPONENT is when we show the latency end in chrome://tracing. | 65 // TERMINAL COMPONENT is when we show the latency end in chrome://tracing. |
66 // Timestamp when the mouse event is acked from renderer and it does not | 66 // Timestamp when the mouse event is acked from renderer and it does not |
67 // cause any rendering scheduled. | 67 // cause any rendering scheduled. |
68 INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, | 68 INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, |
69 // Timestamp when the touch event is acked from renderer and it does not | 69 // Timestamp when the touch event is acked from renderer and it does not |
70 // cause any rendering schedueld and does not generate any gesture event. | 70 // cause any rendering schedueld and does not generate any gesture event. |
71 INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, | 71 INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, |
72 // Timestamp when the gesture event is acked from renderer, and it does not | 72 // Timestamp when the gesture event is acked from renderer, and it does not |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 struct EVENTS_BASE_EXPORT InputCoordinate { | 105 struct EVENTS_BASE_EXPORT InputCoordinate { |
106 InputCoordinate(); | 106 InputCoordinate(); |
107 InputCoordinate(float x, float y); | 107 InputCoordinate(float x, float y); |
108 | 108 |
109 float x; | 109 float x; |
110 float y; | 110 float y; |
111 }; | 111 }; |
112 | 112 |
113 // Empirically determined constant based on a typical scroll sequence. | 113 // Empirically determined constant based on a typical scroll sequence. |
114 enum { kTypicalMaxComponentsPerLatencyInfo = 10 }; | 114 enum { kTypicalMaxComponentsPerLatencyInfo = 9 }; |
115 | 115 |
116 enum { kMaxInputCoordinates = 2 }; | 116 enum { kMaxInputCoordinates = 2 }; |
117 | 117 |
118 // Map a Latency Component (with a component-specific int64 id) to a | 118 // Map a Latency Component (with a component-specific int64 id) to a |
119 // component info. | 119 // component info. |
120 typedef base::SmallMap< | 120 typedef base::SmallMap< |
121 std::map<std::pair<LatencyComponentType, int64>, LatencyComponent>, | 121 std::map<std::pair<LatencyComponentType, int64>, LatencyComponent>, |
122 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; | 122 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; |
123 | 123 |
124 LatencyInfo(); | 124 LatencyInfo(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 // The unique id for matching the ASYNC_BEGIN/END trace event. | 178 // The unique id for matching the ASYNC_BEGIN/END trace event. |
179 int64 trace_id; | 179 int64 trace_id; |
180 // Whether a terminal component has been added. | 180 // Whether a terminal component has been added. |
181 bool terminated; | 181 bool terminated; |
182 }; | 182 }; |
183 | 183 |
184 } // namespace ui | 184 } // namespace ui |
185 | 185 |
186 #endif // UI_EVENTS_LATENCY_INFO_H_ | 186 #endif // UI_EVENTS_LATENCY_INFO_H_ |
OLD | NEW |