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

Side by Side Diff: ui/events/latency_info.h

Issue 2394593002: revert "SourceEventType added to LatencyInfo." (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « ui/events/ipc/latency_info_param_traits_macros.h ('k') | ui/events/latency_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // This component indicates that the input causes a commit to be scheduled 111 // This component indicates that the input causes a commit to be scheduled
112 // but the commit was aborted since it carried no new information. 112 // but the commit was aborted since it carried no new information.
113 INPUT_EVENT_LATENCY_TERMINATED_COMMIT_NO_UPDATE_COMPONENT, 113 INPUT_EVENT_LATENCY_TERMINATED_COMMIT_NO_UPDATE_COMPONENT,
114 // This component indicates that the input causes a swap to be scheduled 114 // This component indicates that the input causes a swap to be scheduled
115 // but the swap failed. 115 // but the swap failed.
116 INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT, 116 INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT,
117 LATENCY_COMPONENT_TYPE_LAST = 117 LATENCY_COMPONENT_TYPE_LAST =
118 INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT, 118 INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT,
119 }; 119 };
120 120
121 enum SourceEventType {
122 UNKNOWN,
123 WHEEL,
124 TOUCH,
125 OTHER,
126 SOURCE_EVENT_TYPE_LAST = OTHER,
127 };
128
129 class EVENTS_BASE_EXPORT LatencyInfo { 121 class EVENTS_BASE_EXPORT LatencyInfo {
130 public: 122 public:
131 struct LatencyComponent { 123 struct LatencyComponent {
132 // Nondecreasing number that can be used to determine what events happened 124 // Nondecreasing number that can be used to determine what events happened
133 // in the component at the time this struct was sent on to the next 125 // in the component at the time this struct was sent on to the next
134 // component. 126 // component.
135 int64_t sequence_number; 127 int64_t sequence_number;
136 // Average time of events that happened in this component. 128 // Average time of events that happened in this component.
137 base::TimeTicks event_time; 129 base::TimeTicks event_time;
138 // Count of events that happened in this component 130 // Count of events that happened in this component
139 uint32_t event_count; 131 uint32_t event_count;
140 }; 132 };
141 133
142 // Empirically determined constant based on a typical scroll sequence. 134 // Empirically determined constant based on a typical scroll sequence.
143 enum { kTypicalMaxComponentsPerLatencyInfo = 10 }; 135 enum { kTypicalMaxComponentsPerLatencyInfo = 10 };
144 136
145 enum : size_t { kMaxInputCoordinates = 2 }; 137 enum : size_t { kMaxInputCoordinates = 2 };
146 138
147 // Map a Latency Component (with a component-specific int64_t id) to a 139 // Map a Latency Component (with a component-specific int64_t id) to a
148 // component info. 140 // component info.
149 typedef base::SmallMap< 141 typedef base::SmallMap<
150 std::map<std::pair<LatencyComponentType, int64_t>, LatencyComponent>, 142 std::map<std::pair<LatencyComponentType, int64_t>, LatencyComponent>,
151 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; 143 kTypicalMaxComponentsPerLatencyInfo> LatencyMap;
152 144
153 LatencyInfo(); 145 LatencyInfo();
154 LatencyInfo(const LatencyInfo& other); 146 LatencyInfo(const LatencyInfo& other);
155 LatencyInfo(SourceEventType type);
156 ~LatencyInfo(); 147 ~LatencyInfo();
157 148
158 // For test only. 149 // For test only.
159 LatencyInfo(int64_t trace_id, bool terminated); 150 LatencyInfo(int64_t trace_id, bool terminated);
160 151
161 // Returns true if the vector |latency_info| is valid. Returns false 152 // Returns true if the vector |latency_info| is valid. Returns false
162 // if it is not valid and log the |referring_msg|. 153 // if it is not valid and log the |referring_msg|.
163 // This function is mainly used to check the latency_info vector that 154 // This function is mainly used to check the latency_info vector that
164 // is passed between processes using IPC message has reasonable size 155 // is passed between processes using IPC message has reasonable size
165 // so that we are confident the IPC message is not corrupted/compromised. 156 // so that we are confident the IPC message is not corrupted/compromised.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 198
208 // Returns true if there is still room for keeping the |input_coordinate|, 199 // Returns true if there is still room for keeping the |input_coordinate|,
209 // false otherwise. 200 // false otherwise.
210 bool AddInputCoordinate(const gfx::PointF& input_coordinate); 201 bool AddInputCoordinate(const gfx::PointF& input_coordinate);
211 202
212 uint32_t input_coordinates_size() const { return input_coordinates_size_; } 203 uint32_t input_coordinates_size() const { return input_coordinates_size_; }
213 const gfx::PointF* input_coordinates() const { return input_coordinates_; } 204 const gfx::PointF* input_coordinates() const { return input_coordinates_; }
214 205
215 const LatencyMap& latency_components() const { return latency_components_; } 206 const LatencyMap& latency_components() const { return latency_components_; }
216 207
217 const SourceEventType& source_event_type() const {
218 return source_event_type_;
219 }
220 void set_source_event_type(SourceEventType type) {
221 source_event_type_ = type;
222 }
223
224 bool terminated() const { return terminated_; } 208 bool terminated() const { return terminated_; }
225 void set_coalesced() { coalesced_ = true; } 209 void set_coalesced() { coalesced_ = true; }
226 bool coalesced() const { return coalesced_; } 210 bool coalesced() const { return coalesced_; }
227 int64_t trace_id() const { return trace_id_; } 211 int64_t trace_id() const { return trace_id_; }
228 212
229 private: 213 private:
230 void AddLatencyNumberWithTimestampImpl(LatencyComponentType component, 214 void AddLatencyNumberWithTimestampImpl(LatencyComponentType component,
231 int64_t id, 215 int64_t id,
232 int64_t component_sequence_number, 216 int64_t component_sequence_number,
233 base::TimeTicks time, 217 base::TimeTicks time,
(...skipping 15 matching lines...) Expand all
249 // These coordinates represent window coordinates of the original input event. 233 // These coordinates represent window coordinates of the original input event.
250 uint32_t input_coordinates_size_; 234 uint32_t input_coordinates_size_;
251 gfx::PointF input_coordinates_[kMaxInputCoordinates]; 235 gfx::PointF input_coordinates_[kMaxInputCoordinates];
252 236
253 // The unique id for matching the ASYNC_BEGIN/END trace event. 237 // The unique id for matching the ASYNC_BEGIN/END trace event.
254 int64_t trace_id_; 238 int64_t trace_id_;
255 // Whether this event has been coalesced into another event. 239 // Whether this event has been coalesced into another event.
256 bool coalesced_; 240 bool coalesced_;
257 // Whether a terminal component has been added. 241 // Whether a terminal component has been added.
258 bool terminated_; 242 bool terminated_;
259 // Stores the type of the first source event.
260 SourceEventType source_event_type_;
261 243
262 #if !defined(OS_IOS) 244 #if !defined(OS_IOS)
263 friend struct IPC::ParamTraits<ui::LatencyInfo>; 245 friend struct IPC::ParamTraits<ui::LatencyInfo>;
264 friend struct mojo::StructTraits<ui::mojom::LatencyInfoDataView, 246 friend struct mojo::StructTraits<ui::mojom::LatencyInfoDataView,
265 ui::LatencyInfo>; 247 ui::LatencyInfo>;
266 #endif 248 #endif
267 }; 249 };
268 250
269 } // namespace ui 251 } // namespace ui
270 252
271 #endif // UI_EVENTS_LATENCY_INFO_H_ 253 #endif // UI_EVENTS_LATENCY_INFO_H_
OLDNEW
« no previous file with comments | « ui/events/ipc/latency_info_param_traits_macros.h ('k') | ui/events/latency_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698