| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 // Returns true if the a component with |type| and |id| is found in | 189 // 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 | 190 // the latency_components and the component is stored to |output| if |
| 191 // |output| is not NULL. Returns false if no such component is found. | 191 // |output| is not NULL. Returns false if no such component is found. |
| 192 bool FindLatency(LatencyComponentType type, | 192 bool FindLatency(LatencyComponentType type, |
| 193 int64_t id, | 193 int64_t id, |
| 194 LatencyComponent* output) const; | 194 LatencyComponent* output) const; |
| 195 | 195 |
| 196 void RemoveLatency(LatencyComponentType type); | 196 void RemoveLatency(LatencyComponentType type); |
| 197 | 197 |
| 198 // Returns true if there is still room for keeping the |input_coordinate|, | |
| 199 // false otherwise. | |
| 200 bool AddInputCoordinate(const gfx::PointF& input_coordinate); | |
| 201 | |
| 202 uint32_t input_coordinates_size() const { return input_coordinates_size_; } | |
| 203 const gfx::PointF* input_coordinates() const { return input_coordinates_; } | |
| 204 | |
| 205 const LatencyMap& latency_components() const { return latency_components_; } | 198 const LatencyMap& latency_components() const { return latency_components_; } |
| 206 | 199 |
| 207 const SourceEventType& source_event_type() const { | 200 const SourceEventType& source_event_type() const { |
| 208 return source_event_type_; | 201 return source_event_type_; |
| 209 } | 202 } |
| 210 void set_source_event_type(SourceEventType type) { | 203 void set_source_event_type(SourceEventType type) { |
| 211 source_event_type_ = type; | 204 source_event_type_ = type; |
| 212 } | 205 } |
| 213 | 206 |
| 214 bool terminated() const { return terminated_; } | 207 bool terminated() const { return terminated_; } |
| 215 void set_coalesced() { coalesced_ = true; } | 208 void set_coalesced() { coalesced_ = true; } |
| 216 bool coalesced() const { return coalesced_; } | 209 bool coalesced() const { return coalesced_; } |
| 217 int64_t trace_id() const { return trace_id_; } | 210 int64_t trace_id() const { return trace_id_; } |
| 218 | 211 |
| 219 private: | 212 private: |
| 220 void AddLatencyNumberWithTimestampImpl(LatencyComponentType component, | 213 void AddLatencyNumberWithTimestampImpl(LatencyComponentType component, |
| 221 int64_t id, | 214 int64_t id, |
| 222 int64_t component_sequence_number, | 215 int64_t component_sequence_number, |
| 223 base::TimeTicks time, | 216 base::TimeTicks time, |
| 224 uint32_t event_count, | 217 uint32_t event_count, |
| 225 const char* trace_name_str); | 218 const char* trace_name_str); |
| 226 | 219 |
| 227 // Converts latencyinfo into format that can be dumped into trace buffer. | 220 // Converts latencyinfo into format that can be dumped into trace buffer. |
| 228 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 221 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 229 AsTraceableData(); | 222 AsTraceableData(); |
| 230 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | |
| 231 CoordinatesAsTraceableData(); | |
| 232 | 223 |
| 233 // Shown as part of the name of the trace event for this LatencyInfo. | 224 // Shown as part of the name of the trace event for this LatencyInfo. |
| 234 // String is empty if no tracing is enabled. | 225 // String is empty if no tracing is enabled. |
| 235 std::string trace_name_; | 226 std::string trace_name_; |
| 236 | 227 |
| 237 LatencyMap latency_components_; | 228 LatencyMap latency_components_; |
| 238 | 229 |
| 239 // These coordinates represent window coordinates of the original input event. | |
| 240 uint32_t input_coordinates_size_; | |
| 241 gfx::PointF input_coordinates_[kMaxInputCoordinates]; | |
| 242 | |
| 243 // The unique id for matching the ASYNC_BEGIN/END trace event. | 230 // The unique id for matching the ASYNC_BEGIN/END trace event. |
| 244 int64_t trace_id_; | 231 int64_t trace_id_; |
| 245 // Whether this event has been coalesced into another event. | 232 // Whether this event has been coalesced into another event. |
| 246 bool coalesced_; | 233 bool coalesced_; |
| 247 // Whether a terminal component has been added. | 234 // Whether a terminal component has been added. |
| 248 bool terminated_; | 235 bool terminated_; |
| 249 // Stores the type of the first source event. | 236 // Stores the type of the first source event. |
| 250 SourceEventType source_event_type_; | 237 SourceEventType source_event_type_; |
| 251 | 238 |
| 252 #if !defined(OS_IOS) | 239 #if !defined(OS_IOS) |
| 253 friend struct IPC::ParamTraits<ui::LatencyInfo>; | 240 friend struct IPC::ParamTraits<ui::LatencyInfo>; |
| 254 friend struct mojo::StructTraits<ui::mojom::LatencyInfoDataView, | 241 friend struct mojo::StructTraits<ui::mojom::LatencyInfoDataView, |
| 255 ui::LatencyInfo>; | 242 ui::LatencyInfo>; |
| 256 #endif | 243 #endif |
| 257 }; | 244 }; |
| 258 | 245 |
| 259 } // namespace ui | 246 } // namespace ui |
| 260 | 247 |
| 261 #endif // UI_LATENCY_LATENCY_INFO_H_ | 248 #endif // UI_LATENCY_LATENCY_INFO_H_ |
| OLD | NEW |