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 // This header is designed to give you trace_event macros without specifying | 5 // This header is designed to give you trace_event macros without specifying |
6 // how the events actually get collected and stored. If you need to expose trace | 6 // how the events actually get collected and stored. If you need to expose trace |
7 // event to some other universe, you can copy-and-paste this file, | 7 // event to some other universe, you can copy-and-paste this file, |
8 // implement the TRACE_EVENT_API macros, and do any other necessary fixup for | 8 // implement the TRACE_EVENT_API macros, and do any other necessary fixup for |
9 // the target platform. The end result is that multiple libraries can funnel | 9 // the target platform. The end result is that multiple libraries can funnel |
10 // events through to a shared trace event collector. | 10 // events through to a shared trace event collector. |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 : data_(static_cast<unsigned long long>(id)) {} | 712 : data_(static_cast<unsigned long long>(id)) {} |
713 explicit ForceMangle(signed char id) | 713 explicit ForceMangle(signed char id) |
714 : data_(static_cast<unsigned long long>(id)) {} | 714 : data_(static_cast<unsigned long long>(id)) {} |
715 | 715 |
716 unsigned long long data() const { return data_; } | 716 unsigned long long data() const { return data_; } |
717 | 717 |
718 private: | 718 private: |
719 unsigned long long data_; | 719 unsigned long long data_; |
720 }; | 720 }; |
721 | 721 |
722 explicit TraceID(const void* id, unsigned char* flags) | 722 TraceID(const void* id, unsigned char* flags) |
723 : data_(static_cast<unsigned long long>( | 723 : data_(static_cast<unsigned long long>( |
724 reinterpret_cast<unsigned long>(id))) { | 724 reinterpret_cast<unsigned long>(id))) { |
725 *flags |= TRACE_EVENT_FLAG_MANGLE_ID; | 725 *flags |= TRACE_EVENT_FLAG_MANGLE_ID; |
726 } | 726 } |
727 explicit TraceID(ForceMangle id, unsigned char* flags) : data_(id.data()) { | 727 TraceID(ForceMangle id, unsigned char* flags) : data_(id.data()) { |
728 *flags |= TRACE_EVENT_FLAG_MANGLE_ID; | 728 *flags |= TRACE_EVENT_FLAG_MANGLE_ID; |
729 } | 729 } |
730 explicit TraceID(unsigned long long id, unsigned char* flags) | 730 TraceID(unsigned long long id, unsigned char* flags) |
731 : data_(id) { (void)flags; } | 731 : data_(id) { (void)flags; } |
732 explicit TraceID(unsigned long id, unsigned char* flags) | 732 TraceID(unsigned long id, unsigned char* flags) |
733 : data_(id) { (void)flags; } | 733 : data_(id) { (void)flags; } |
734 explicit TraceID(unsigned int id, unsigned char* flags) | 734 TraceID(unsigned int id, unsigned char* flags) |
735 : data_(id) { (void)flags; } | 735 : data_(id) { (void)flags; } |
736 explicit TraceID(unsigned short id, unsigned char* flags) | 736 TraceID(unsigned short id, unsigned char* flags) |
737 : data_(id) { (void)flags; } | 737 : data_(id) { (void)flags; } |
738 explicit TraceID(unsigned char id, unsigned char* flags) | 738 TraceID(unsigned char id, unsigned char* flags) |
739 : data_(id) { (void)flags; } | 739 : data_(id) { (void)flags; } |
740 explicit TraceID(long long id, unsigned char* flags) | 740 TraceID(long long id, unsigned char* flags) |
741 : data_(static_cast<unsigned long long>(id)) { (void)flags; } | 741 : data_(static_cast<unsigned long long>(id)) { (void)flags; } |
742 explicit TraceID(long id, unsigned char* flags) | 742 TraceID(long id, unsigned char* flags) |
743 : data_(static_cast<unsigned long long>(id)) { (void)flags; } | 743 : data_(static_cast<unsigned long long>(id)) { (void)flags; } |
744 explicit TraceID(int id, unsigned char* flags) | 744 TraceID(int id, unsigned char* flags) |
745 : data_(static_cast<unsigned long long>(id)) { (void)flags; } | 745 : data_(static_cast<unsigned long long>(id)) { (void)flags; } |
746 explicit TraceID(short id, unsigned char* flags) | 746 TraceID(short id, unsigned char* flags) |
747 : data_(static_cast<unsigned long long>(id)) { (void)flags; } | 747 : data_(static_cast<unsigned long long>(id)) { (void)flags; } |
748 explicit TraceID(signed char id, unsigned char* flags) | 748 TraceID(signed char id, unsigned char* flags) |
749 : data_(static_cast<unsigned long long>(id)) { (void)flags; } | 749 : data_(static_cast<unsigned long long>(id)) { (void)flags; } |
750 | 750 |
751 unsigned long long data() const { return data_; } | 751 unsigned long long data() const { return data_; } |
752 | 752 |
753 private: | 753 private: |
754 unsigned long long data_; | 754 unsigned long long data_; |
755 }; | 755 }; |
756 | 756 |
757 // Simple union to store various types as unsigned long long. | 757 // Simple union to store various types as unsigned long long. |
758 union TraceValueUnion { | 758 union TraceValueUnion { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 const char* name; | 913 const char* name; |
914 }; | 914 }; |
915 Data* p_data_; | 915 Data* p_data_; |
916 Data data_; | 916 Data data_; |
917 }; | 917 }; |
918 | 918 |
919 | 919 |
920 } // namespace trace_event_internal | 920 } // namespace trace_event_internal |
921 | 921 |
922 #endif // BASE_DEBUG_TRACE_EVENT_H_ | 922 #endif // BASE_DEBUG_TRACE_EVENT_H_ |
OLD | NEW |