| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 const LatencyMap& latency_components() const { return latency_components_; } | 202 const LatencyMap& latency_components() const { return latency_components_; } |
| 203 | 203 |
| 204 const SourceEventType& source_event_type() const { | 204 const SourceEventType& source_event_type() const { |
| 205 return source_event_type_; | 205 return source_event_type_; |
| 206 } | 206 } |
| 207 void set_source_event_type(SourceEventType type) { | 207 void set_source_event_type(SourceEventType type) { |
| 208 source_event_type_ = type; | 208 source_event_type_ = type; |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool began() const { return began_; } |
| 211 bool terminated() const { return terminated_; } | 212 bool terminated() const { return terminated_; } |
| 212 void set_coalesced() { coalesced_ = true; } | 213 void set_coalesced() { coalesced_ = true; } |
| 213 bool coalesced() const { return coalesced_; } | 214 bool coalesced() const { return coalesced_; } |
| 214 int64_t trace_id() const { return trace_id_; } | 215 int64_t trace_id() const { return trace_id_; } |
| 216 void set_trace_id(int64_t trace_id) { trace_id_ = trace_id; } |
| 215 | 217 |
| 216 private: | 218 private: |
| 217 void AddLatencyNumberWithTimestampImpl(LatencyComponentType component, | 219 void AddLatencyNumberWithTimestampImpl(LatencyComponentType component, |
| 218 int64_t id, | 220 int64_t id, |
| 219 int64_t component_sequence_number, | 221 int64_t component_sequence_number, |
| 220 base::TimeTicks time, | 222 base::TimeTicks time, |
| 221 uint32_t event_count, | 223 uint32_t event_count, |
| 222 const char* trace_name_str); | 224 const char* trace_name_str); |
| 223 | 225 |
| 224 // Converts latencyinfo into format that can be dumped into trace buffer. | 226 // Converts latencyinfo into format that can be dumped into trace buffer. |
| 225 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 227 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 226 AsTraceableData(); | 228 AsTraceableData(); |
| 227 | 229 |
| 228 // Shown as part of the name of the trace event for this LatencyInfo. | 230 // Shown as part of the name of the trace event for this LatencyInfo. |
| 229 // String is empty if no tracing is enabled. | 231 // String is empty if no tracing is enabled. |
| 230 std::string trace_name_; | 232 std::string trace_name_; |
| 231 | 233 |
| 232 LatencyMap latency_components_; | 234 LatencyMap latency_components_; |
| 233 | 235 |
| 234 // The unique id for matching the ASYNC_BEGIN/END trace event. | 236 // The unique id for matching the ASYNC_BEGIN/END trace event. |
| 235 int64_t trace_id_; | 237 int64_t trace_id_; |
| 236 // Whether this event has been coalesced into another event. | 238 // Whether this event has been coalesced into another event. |
| 237 bool coalesced_; | 239 bool coalesced_; |
| 240 // Whether a begin component has been added. |
| 241 bool began_; |
| 238 // Whether a terminal component has been added. | 242 // Whether a terminal component has been added. |
| 239 bool terminated_; | 243 bool terminated_; |
| 240 // Stores the type of the first source event. | 244 // Stores the type of the first source event. |
| 241 SourceEventType source_event_type_; | 245 SourceEventType source_event_type_; |
| 242 | 246 |
| 243 #if !defined(OS_IOS) | 247 #if !defined(OS_IOS) |
| 244 friend struct IPC::ParamTraits<ui::LatencyInfo>; | 248 friend struct IPC::ParamTraits<ui::LatencyInfo>; |
| 245 friend struct mojo::StructTraits<ui::mojom::LatencyInfoDataView, | 249 friend struct mojo::StructTraits<ui::mojom::LatencyInfoDataView, |
| 246 ui::LatencyInfo>; | 250 ui::LatencyInfo>; |
| 247 #endif | 251 #endif |
| 248 }; | 252 }; |
| 249 | 253 |
| 250 // This is declared here for use in gtest-based unit tests, but is defined in | 254 // This is declared here for use in gtest-based unit tests, but is defined in |
| 251 // //ui/latency:test_support target. | 255 // //ui/latency:test_support target. |
| 252 // Without this the default PrintTo template in gtest tries to pass LatencyInfo | 256 // Without this the default PrintTo template in gtest tries to pass LatencyInfo |
| 253 // by value, which leads to an alignment compile error on Windows. | 257 // by value, which leads to an alignment compile error on Windows. |
| 254 void PrintTo(const LatencyInfo& latency, ::std::ostream* os); | 258 void PrintTo(const LatencyInfo& latency, ::std::ostream* os); |
| 255 | 259 |
| 256 } // namespace ui | 260 } // namespace ui |
| 257 | 261 |
| 258 #endif // UI_LATENCY_LATENCY_INFO_H_ | 262 #endif // UI_LATENCY_LATENCY_INFO_H_ |
| OLD | NEW |