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 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Nondecreasing number that can be used to determine what events happened | 88 // Nondecreasing number that can be used to determine what events happened |
89 // in the component at the time this struct was sent on to the next | 89 // in the component at the time this struct was sent on to the next |
90 // component. | 90 // component. |
91 int64 sequence_number; | 91 int64 sequence_number; |
92 // Average time of events that happened in this component. | 92 // Average time of events that happened in this component. |
93 base::TimeTicks event_time; | 93 base::TimeTicks event_time; |
94 // Count of events that happened in this component | 94 // Count of events that happened in this component |
95 uint32 event_count; | 95 uint32 event_count; |
96 }; | 96 }; |
97 | 97 |
| 98 struct EVENTS_BASE_EXPORT InputCoordinate { |
| 99 InputCoordinate(); |
| 100 InputCoordinate(float x, float y); |
| 101 |
| 102 float x; |
| 103 float y; |
| 104 }; |
| 105 |
98 // Empirically determined constant based on a typical scroll sequence. | 106 // Empirically determined constant based on a typical scroll sequence. |
99 enum { kTypicalMaxComponentsPerLatencyInfo = 6 }; | 107 enum { kTypicalMaxComponentsPerLatencyInfo = 6 }; |
100 | 108 |
| 109 enum { kMaxInputCoordinates = 2 }; |
| 110 |
101 // Map a Latency Component (with a component-specific int64 id) to a | 111 // Map a Latency Component (with a component-specific int64 id) to a |
102 // component info. | 112 // component info. |
103 typedef base::SmallMap< | 113 typedef base::SmallMap< |
104 std::map<std::pair<LatencyComponentType, int64>, LatencyComponent>, | 114 std::map<std::pair<LatencyComponentType, int64>, LatencyComponent>, |
105 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; | 115 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; |
106 | 116 |
107 LatencyInfo(); | 117 LatencyInfo(); |
108 | 118 |
109 ~LatencyInfo(); | 119 ~LatencyInfo(); |
110 | 120 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 LatencyComponent* output) const; | 156 LatencyComponent* output) const; |
147 | 157 |
148 void RemoveLatency(LatencyComponentType type); | 158 void RemoveLatency(LatencyComponentType type); |
149 | 159 |
150 void Clear(); | 160 void Clear(); |
151 | 161 |
152 // Records the |event_type| in trace buffer as TRACE_EVENT_ASYNC_STEP. | 162 // Records the |event_type| in trace buffer as TRACE_EVENT_ASYNC_STEP. |
153 void TraceEventType(const char* event_type); | 163 void TraceEventType(const char* event_type); |
154 | 164 |
155 LatencyMap latency_components; | 165 LatencyMap latency_components; |
| 166 |
| 167 // These coordinates represent window coordinates of the original input event. |
| 168 uint32 input_coordinates_size; |
| 169 InputCoordinate input_coordinates[kMaxInputCoordinates]; |
| 170 |
156 // The unique id for matching the ASYNC_BEGIN/END trace event. | 171 // The unique id for matching the ASYNC_BEGIN/END trace event. |
157 int64 trace_id; | 172 int64 trace_id; |
158 // Whether a terminal component has been added. | 173 // Whether a terminal component has been added. |
159 bool terminated; | 174 bool terminated; |
160 }; | 175 }; |
161 | 176 |
162 } // namespace ui | 177 } // namespace ui |
163 | 178 |
164 #endif // UI_EVENTS_LATENCY_INFO_H_ | 179 #endif // UI_EVENTS_LATENCY_INFO_H_ |
OLD | NEW |