OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 5 |
6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 // Allow tests to inspect TraceEvents. | 304 // Allow tests to inspect TraceEvents. |
305 size_t GetEventsSize() const { return logged_events_.size(); } | 305 size_t GetEventsSize() const { return logged_events_.size(); } |
306 const TraceEvent& GetEventAt(size_t index) const { | 306 const TraceEvent& GetEventAt(size_t index) const { |
307 DCHECK(index < logged_events_.size()); | 307 DCHECK(index < logged_events_.size()); |
308 return logged_events_[index]; | 308 return logged_events_[index]; |
309 } | 309 } |
310 | 310 |
311 void SetProcessID(int process_id); | 311 void SetProcessID(int process_id); |
312 | 312 |
| 313 // Allow setting an offset between the current TimeTicks time and the time |
| 314 // that should be reported. |
| 315 void SetTimeOffset(TimeDelta offset); |
| 316 |
313 private: | 317 private: |
314 // This allows constructor and destructor to be private and usable only | 318 // This allows constructor and destructor to be private and usable only |
315 // by the Singleton class. | 319 // by the Singleton class. |
316 friend struct StaticMemorySingletonTraits<TraceLog>; | 320 friend struct StaticMemorySingletonTraits<TraceLog>; |
317 | 321 |
318 // The pointer returned from GetCategoryEnabledInternal() points to a value | 322 // The pointer returned from GetCategoryEnabledInternal() points to a value |
319 // with zero or more of the following bits. Used in this class only. | 323 // with zero or more of the following bits. Used in this class only. |
320 // The TRACE_EVENT macros should only use the value as a bool. | 324 // The TRACE_EVENT macros should only use the value as a bool. |
321 enum CategoryEnabledFlags { | 325 enum CategoryEnabledFlags { |
322 // Normal enabled flag for categories enabled with Enable(). | 326 // Normal enabled flag for categories enabled with Enable(). |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 bool dispatching_to_observer_list_; | 382 bool dispatching_to_observer_list_; |
379 ObserverList<EnabledStateChangedObserver> enabled_state_observer_list_; | 383 ObserverList<EnabledStateChangedObserver> enabled_state_observer_list_; |
380 | 384 |
381 base::hash_map<int, std::string> thread_names_; | 385 base::hash_map<int, std::string> thread_names_; |
382 | 386 |
383 // XORed with TraceID to make it unlikely to collide with other processes. | 387 // XORed with TraceID to make it unlikely to collide with other processes. |
384 unsigned long long process_id_hash_; | 388 unsigned long long process_id_hash_; |
385 | 389 |
386 int process_id_; | 390 int process_id_; |
387 | 391 |
| 392 TimeDelta time_offset_; |
| 393 |
388 // Allow tests to wake up when certain events occur. | 394 // Allow tests to wake up when certain events occur. |
389 const unsigned char* watch_category_; | 395 const unsigned char* watch_category_; |
390 std::string watch_event_name_; | 396 std::string watch_event_name_; |
391 | 397 |
392 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 398 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
393 }; | 399 }; |
394 | 400 |
395 } // namespace debug | 401 } // namespace debug |
396 } // namespace base | 402 } // namespace base |
397 | 403 |
398 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 404 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
OLD | NEW |