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 <stack> | 9 #include <stack> |
10 #include <string> | 10 #include <string> |
(...skipping 22 matching lines...) Expand all Loading... |
33 base::debug::TraceLog::AddTraceEventEtw( \ | 33 base::debug::TraceLog::AddTraceEventEtw( \ |
34 TRACE_EVENT_PHASE_END, \ | 34 TRACE_EVENT_PHASE_END, \ |
35 name, reinterpret_cast<const void*>(id), extra) | 35 name, reinterpret_cast<const void*>(id), extra) |
36 | 36 |
37 #define TRACE_EVENT_INSTANT_ETW(name, id, extra) \ | 37 #define TRACE_EVENT_INSTANT_ETW(name, id, extra) \ |
38 base::debug::TraceLog::AddTraceEventEtw( \ | 38 base::debug::TraceLog::AddTraceEventEtw( \ |
39 TRACE_EVENT_PHASE_INSTANT, \ | 39 TRACE_EVENT_PHASE_INSTANT, \ |
40 name, reinterpret_cast<const void*>(id), extra) | 40 name, reinterpret_cast<const void*>(id), extra) |
41 | 41 |
42 template <typename Type> | 42 template <typename Type> |
43 struct StaticMemorySingletonTraits; | 43 struct DefaultSingletonTraits; |
44 | 44 |
45 namespace base { | 45 namespace base { |
46 | 46 |
47 class WaitableEvent; | 47 class WaitableEvent; |
48 | 48 |
49 namespace debug { | 49 namespace debug { |
50 | 50 |
51 // For any argument of type TRACE_VALUE_TYPE_CONVERTABLE the provided | 51 // For any argument of type TRACE_VALUE_TYPE_CONVERTABLE the provided |
52 // class must implement this interface. | 52 // class must implement this interface. |
53 class ConvertableToTraceFormat { | 53 class ConvertableToTraceFormat { |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 433 |
434 int process_id() const { return process_id_; } | 434 int process_id() const { return process_id_; } |
435 | 435 |
436 // Exposed for unittesting: | 436 // Exposed for unittesting: |
437 | 437 |
438 void InstallWaitableEventForSamplingTesting(WaitableEvent* waitable_event); | 438 void InstallWaitableEventForSamplingTesting(WaitableEvent* waitable_event); |
439 | 439 |
440 // Allows deleting our singleton instance. | 440 // Allows deleting our singleton instance. |
441 static void DeleteForTesting(); | 441 static void DeleteForTesting(); |
442 | 442 |
443 // Allows resurrecting our singleton instance post-AtExit processing. | |
444 static void Resurrect(); | |
445 | |
446 // Allow tests to inspect TraceEvents. | 443 // Allow tests to inspect TraceEvents. |
447 size_t GetEventsSize() const { return logged_events_->Size(); } | 444 size_t GetEventsSize() const { return logged_events_->Size(); } |
448 const TraceEvent& GetEventAt(size_t index) const { | 445 const TraceEvent& GetEventAt(size_t index) const { |
449 return logged_events_->GetEventAt(index); | 446 return logged_events_->GetEventAt(index); |
450 } | 447 } |
451 | 448 |
452 void SetProcessID(int process_id); | 449 void SetProcessID(int process_id); |
453 | 450 |
454 // Allow setting an offset between the current TimeTicks time and the time | 451 // Allow setting an offset between the current TimeTicks time and the time |
455 // that should be reported. | 452 // that should be reported. |
456 void SetTimeOffset(TimeDelta offset); | 453 void SetTimeOffset(TimeDelta offset); |
457 | 454 |
458 size_t GetObserverCountForTest() const; | 455 size_t GetObserverCountForTest() const; |
459 | 456 |
460 private: | 457 private: |
461 // This allows constructor and destructor to be private and usable only | 458 // This allows constructor and destructor to be private and usable only |
462 // by the Singleton class. | 459 // by the Singleton class. |
463 friend struct StaticMemorySingletonTraits<TraceLog>; | 460 friend struct DefaultSingletonTraits<TraceLog>; |
464 | 461 |
465 // Enable/disable each category group based on the current category_filter_. | 462 // Enable/disable each category group based on the current category_filter_. |
466 // If the category group contains a category that matches an included category | 463 // If the category group contains a category that matches an included category |
467 // pattern, that category group will be enabled. | 464 // pattern, that category group will be enabled. |
468 void EnableIncludedCategoryGroups(); | 465 void EnableIncludedCategoryGroups(); |
469 void EnableIncludedCategoryGroup(int category_index); | 466 void EnableIncludedCategoryGroup(int category_index); |
470 | 467 |
471 static void SetCategoryGroupEnabled(int category_index, bool enabled); | 468 static void SetCategoryGroupEnabled(int category_index, bool enabled); |
472 static bool IsCategoryGroupEnabled( | 469 static bool IsCategoryGroupEnabled( |
473 const unsigned char* category_group_enabled); | 470 const unsigned char* category_group_enabled); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 559 |
563 CategoryFilter category_filter_; | 560 CategoryFilter category_filter_; |
564 | 561 |
565 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 562 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
566 }; | 563 }; |
567 | 564 |
568 } // namespace debug | 565 } // namespace debug |
569 } // namespace base | 566 } // namespace base |
570 | 567 |
571 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 568 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
OLD | NEW |