Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: base/debug/trace_event.h

Issue 374043002: Fix tracing 64-bit to 32-bit truncations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/debug/trace_event_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 file defines the set of trace_event macros without specifying 5 // This header file defines the set of 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 // events to some other universe, you can copy-and-paste this file as well as 7 // events to some other universe, you can copy-and-paste this file as well as
8 // trace_event.h, modifying the macros contained there as necessary for the 8 // trace_event.h, modifying the macros contained there as necessary for the
9 // target platform. The end result is that multiple libraries can funnel events 9 // target platform. The end result is that multiple libraries can funnel events
10 // through to a shared trace event collector. 10 // through to a shared trace event collector.
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 996
997 // TraceID encapsulates an ID that can either be an integer or pointer. Pointers 997 // TraceID encapsulates an ID that can either be an integer or pointer. Pointers
998 // are by default mangled with the Process ID so that they are unlikely to 998 // are by default mangled with the Process ID so that they are unlikely to
999 // collide when the same pointer is used on different processes. 999 // collide when the same pointer is used on different processes.
1000 class TraceID { 1000 class TraceID {
1001 public: 1001 public:
1002 class DontMangle { 1002 class DontMangle {
1003 public: 1003 public:
1004 explicit DontMangle(const void* id) 1004 explicit DontMangle(const void* id)
1005 : data_(static_cast<unsigned long long>( 1005 : data_(static_cast<unsigned long long>(
1006 reinterpret_cast<unsigned long>(id))) {} 1006 reinterpret_cast<uintptr_t>(id))) {}
1007 explicit DontMangle(unsigned long long id) : data_(id) {} 1007 explicit DontMangle(unsigned long long id) : data_(id) {}
1008 explicit DontMangle(unsigned long id) : data_(id) {} 1008 explicit DontMangle(unsigned long id) : data_(id) {}
1009 explicit DontMangle(unsigned int id) : data_(id) {} 1009 explicit DontMangle(unsigned int id) : data_(id) {}
1010 explicit DontMangle(unsigned short id) : data_(id) {} 1010 explicit DontMangle(unsigned short id) : data_(id) {}
1011 explicit DontMangle(unsigned char id) : data_(id) {} 1011 explicit DontMangle(unsigned char id) : data_(id) {}
1012 explicit DontMangle(long long id) 1012 explicit DontMangle(long long id)
1013 : data_(static_cast<unsigned long long>(id)) {} 1013 : data_(static_cast<unsigned long long>(id)) {}
1014 explicit DontMangle(long id) 1014 explicit DontMangle(long id)
1015 : data_(static_cast<unsigned long long>(id)) {} 1015 : data_(static_cast<unsigned long long>(id)) {}
1016 explicit DontMangle(int id) 1016 explicit DontMangle(int id)
(...skipping 21 matching lines...) Expand all
1038 explicit ForceMangle(int id) 1038 explicit ForceMangle(int id)
1039 : data_(static_cast<unsigned long long>(id)) {} 1039 : data_(static_cast<unsigned long long>(id)) {}
1040 explicit ForceMangle(short id) 1040 explicit ForceMangle(short id)
1041 : data_(static_cast<unsigned long long>(id)) {} 1041 : data_(static_cast<unsigned long long>(id)) {}
1042 explicit ForceMangle(signed char id) 1042 explicit ForceMangle(signed char id)
1043 : data_(static_cast<unsigned long long>(id)) {} 1043 : data_(static_cast<unsigned long long>(id)) {}
1044 unsigned long long data() const { return data_; } 1044 unsigned long long data() const { return data_; }
1045 private: 1045 private:
1046 unsigned long long data_; 1046 unsigned long long data_;
1047 }; 1047 };
1048
1049 TraceID(const void* id, unsigned char* flags) 1048 TraceID(const void* id, unsigned char* flags)
1050 : data_(static_cast<unsigned long long>( 1049 : data_(static_cast<unsigned long long>(
1051 reinterpret_cast<unsigned long>(id))) { 1050 reinterpret_cast<uintptr_t>(id))) {
1052 *flags |= TRACE_EVENT_FLAG_MANGLE_ID; 1051 *flags |= TRACE_EVENT_FLAG_MANGLE_ID;
1053 } 1052 }
1054 TraceID(ForceMangle id, unsigned char* flags) : data_(id.data()) { 1053 TraceID(ForceMangle id, unsigned char* flags) : data_(id.data()) {
1055 *flags |= TRACE_EVENT_FLAG_MANGLE_ID; 1054 *flags |= TRACE_EVENT_FLAG_MANGLE_ID;
1056 } 1055 }
1057 TraceID(DontMangle id, unsigned char* flags) : data_(id.data()) { 1056 TraceID(DontMangle id, unsigned char* flags) : data_(id.data()) {
1058 } 1057 }
1059 TraceID(unsigned long long id, unsigned char* flags) 1058 TraceID(unsigned long long id, unsigned char* flags)
1060 : data_(id) { (void)flags; } 1059 : data_(id) { (void)flags; }
1061 TraceID(unsigned long id, unsigned char* flags) 1060 TraceID(unsigned long id, unsigned char* flags)
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 const char* name_; 1510 const char* name_;
1512 IDType id_; 1511 IDType id_;
1513 1512
1514 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); 1513 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject);
1515 }; 1514 };
1516 1515
1517 } // namespace debug 1516 } // namespace debug
1518 } // namespace base 1517 } // namespace base
1519 1518
1520 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ 1519 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */
OLDNEW
« no previous file with comments | « no previous file | base/debug/trace_event_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698