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

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

Issue 2039853004: Replace ui::LatencyInfo::InputCoordinate with gfx::PointF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing gyp dep Created 4 years, 6 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_unittest.cc ('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>
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/containers/small_map.h" 15 #include "base/containers/small_map.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "ui/events/events_base_export.h" 18 #include "ui/events/events_base_export.h"
19 #include "ui/gfx/geometry/point_f.h"
19 20
20 #if !defined(OS_IOS) 21 #if !defined(OS_IOS)
21 #include "ipc/ipc_param_traits.h" // nogncheck 22 #include "ipc/ipc_param_traits.h" // nogncheck
22 #include "mojo/public/cpp/bindings/struct_traits.h" // nogncheck 23 #include "mojo/public/cpp/bindings/struct_traits.h" // nogncheck
23 #endif 24 #endif
24 25
25 namespace ui { 26 namespace ui {
26 27
27 #if !defined(OS_IOS) 28 #if !defined(OS_IOS)
28 namespace mojom { 29 namespace mojom {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Nondecreasing number that can be used to determine what events happened 119 // Nondecreasing number that can be used to determine what events happened
119 // in the component at the time this struct was sent on to the next 120 // in the component at the time this struct was sent on to the next
120 // component. 121 // component.
121 int64_t sequence_number; 122 int64_t sequence_number;
122 // Average time of events that happened in this component. 123 // Average time of events that happened in this component.
123 base::TimeTicks event_time; 124 base::TimeTicks event_time;
124 // Count of events that happened in this component 125 // Count of events that happened in this component
125 uint32_t event_count; 126 uint32_t event_count;
126 }; 127 };
127 128
128 struct EVENTS_BASE_EXPORT InputCoordinate {
129 InputCoordinate();
130 InputCoordinate(float x, float y);
131
132 float x;
133 float y;
134 };
135
136 // Empirically determined constant based on a typical scroll sequence. 129 // Empirically determined constant based on a typical scroll sequence.
137 enum { kTypicalMaxComponentsPerLatencyInfo = 10 }; 130 enum { kTypicalMaxComponentsPerLatencyInfo = 10 };
138 131
139 enum : size_t { kMaxInputCoordinates = 2 }; 132 enum : size_t { kMaxInputCoordinates = 2 };
140 133
141 // Map a Latency Component (with a component-specific int64_t id) to a 134 // Map a Latency Component (with a component-specific int64_t id) to a
142 // component info. 135 // component info.
143 typedef base::SmallMap< 136 typedef base::SmallMap<
144 std::map<std::pair<LatencyComponentType, int64_t>, LatencyComponent>, 137 std::map<std::pair<LatencyComponentType, int64_t>, LatencyComponent>,
145 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; 138 kTypicalMaxComponentsPerLatencyInfo> LatencyMap;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // the latency_components and the component is stored to |output| if 186 // the latency_components and the component is stored to |output| if
194 // |output| is not NULL. Returns false if no such component is found. 187 // |output| is not NULL. Returns false if no such component is found.
195 bool FindLatency(LatencyComponentType type, 188 bool FindLatency(LatencyComponentType type,
196 int64_t id, 189 int64_t id,
197 LatencyComponent* output) const; 190 LatencyComponent* output) const;
198 191
199 void RemoveLatency(LatencyComponentType type); 192 void RemoveLatency(LatencyComponentType type);
200 193
201 // Returns true if there is still room for keeping the |input_coordinate|, 194 // Returns true if there is still room for keeping the |input_coordinate|,
202 // false otherwise. 195 // false otherwise.
203 bool AddInputCoordinate(const InputCoordinate& input_coordinate); 196 bool AddInputCoordinate(const gfx::PointF& input_coordinate);
204 197
205 uint32_t input_coordinates_size() const { return input_coordinates_size_; } 198 uint32_t input_coordinates_size() const { return input_coordinates_size_; }
206 const InputCoordinate* input_coordinates() const { 199 const gfx::PointF* input_coordinates() const { return input_coordinates_; }
207 return input_coordinates_;
208 }
209 200
210 const LatencyMap& latency_components() const { return latency_components_; } 201 const LatencyMap& latency_components() const { return latency_components_; }
211 202
212 bool terminated() const { return terminated_; } 203 bool terminated() const { return terminated_; }
213 void set_coalesced() { coalesced_ = true; } 204 void set_coalesced() { coalesced_ = true; }
214 bool coalesced() const { return coalesced_; } 205 bool coalesced() const { return coalesced_; }
215 int64_t trace_id() const { return trace_id_; } 206 int64_t trace_id() const { return trace_id_; }
216 207
217 private: 208 private:
218 void AddLatencyNumberWithTimestampImpl(LatencyComponentType component, 209 void AddLatencyNumberWithTimestampImpl(LatencyComponentType component,
(...skipping 10 matching lines...) Expand all
229 CoordinatesAsTraceableData(); 220 CoordinatesAsTraceableData();
230 221
231 // Shown as part of the name of the trace event for this LatencyInfo. 222 // Shown as part of the name of the trace event for this LatencyInfo.
232 // String is empty if no tracing is enabled. 223 // String is empty if no tracing is enabled.
233 std::string trace_name_; 224 std::string trace_name_;
234 225
235 LatencyMap latency_components_; 226 LatencyMap latency_components_;
236 227
237 // These coordinates represent window coordinates of the original input event. 228 // These coordinates represent window coordinates of the original input event.
238 uint32_t input_coordinates_size_; 229 uint32_t input_coordinates_size_;
239 InputCoordinate input_coordinates_[kMaxInputCoordinates]; 230 gfx::PointF input_coordinates_[kMaxInputCoordinates];
240 231
241 // The unique id for matching the ASYNC_BEGIN/END trace event. 232 // The unique id for matching the ASYNC_BEGIN/END trace event.
242 int64_t trace_id_; 233 int64_t trace_id_;
243 // Whether this event has been coalesced into another event. 234 // Whether this event has been coalesced into another event.
244 bool coalesced_; 235 bool coalesced_;
245 // Whether a terminal component has been added. 236 // Whether a terminal component has been added.
246 bool terminated_; 237 bool terminated_;
247 238
248 #if !defined(OS_IOS) 239 #if !defined(OS_IOS)
249 friend struct IPC::ParamTraits<ui::LatencyInfo>; 240 friend struct IPC::ParamTraits<ui::LatencyInfo>;
250 friend struct mojo::StructTraits<ui::mojom::LatencyInfo, ui::LatencyInfo>; 241 friend struct mojo::StructTraits<ui::mojom::LatencyInfo, ui::LatencyInfo>;
251 #endif 242 #endif
252 }; 243 };
253 244
254 } // namespace ui 245 } // namespace ui
255 246
256 #endif // UI_EVENTS_LATENCY_INFO_H_ 247 #endif // UI_EVENTS_LATENCY_INFO_H_
OLDNEW
« no previous file with comments | « ui/events/ipc/latency_info_param_traits_unittest.cc ('k') | ui/events/latency_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698