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

Side by Side Diff: src/core/SkTraceEvent.h

Issue 510923002: Fixed void* to uint64_t cast on win64 in TraceID. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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) 2014 Google Inc. 1 // Copyright (c) 2014 Google Inc.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 // This header file defines the set of trace_event macros without specifying 6 // This header file defines the set of trace_event macros without specifying
7 // how the events actually get collected and stored. If you need to expose trace 7 // how the events actually get collected and stored. If you need to expose trace
8 // events to some other universe, you can copy-and-paste this file as well as 8 // events to some other universe, you can copy-and-paste this file as well as
9 // trace_event.h, modifying the macros contained there as necessary for the 9 // trace_event.h, modifying the macros contained there as necessary for the
10 // target platform. The end result is that multiple libraries can funnel events 10 // target platform. The end result is that multiple libraries can funnel events
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 942
943 // TraceID encapsulates an ID that can either be an integer or pointer. Pointers 943 // TraceID encapsulates an ID that can either be an integer or pointer. Pointers
944 // are by default mangled with the Process ID so that they are unlikely to 944 // are by default mangled with the Process ID so that they are unlikely to
945 // collide when the same pointer is used on different processes. 945 // collide when the same pointer is used on different processes.
946 class TraceID { 946 class TraceID {
947 public: 947 public:
948 class DontMangle { 948 class DontMangle {
949 public: 949 public:
950 explicit DontMangle(const void* id) 950 explicit DontMangle(const void* id)
951 : data_(static_cast<uint64_t>( 951 : data_(static_cast<uint64_t>(
952 reinterpret_cast<unsigned long>(id))) {} 952 reinterpret_cast<uintptr_t>(id))) {}
953 explicit DontMangle(uint64_t id) : data_(id) {} 953 explicit DontMangle(uint64_t id) : data_(id) {}
954 explicit DontMangle(unsigned int id) : data_(id) {} 954 explicit DontMangle(unsigned int id) : data_(id) {}
955 explicit DontMangle(unsigned short id) : data_(id) {} 955 explicit DontMangle(unsigned short id) : data_(id) {}
956 explicit DontMangle(unsigned char id) : data_(id) {} 956 explicit DontMangle(unsigned char id) : data_(id) {}
957 explicit DontMangle(long long id) 957 explicit DontMangle(long long id)
958 : data_(static_cast<uint64_t>(id)) {} 958 : data_(static_cast<uint64_t>(id)) {}
959 explicit DontMangle(long id) 959 explicit DontMangle(long id)
960 : data_(static_cast<uint64_t>(id)) {} 960 : data_(static_cast<uint64_t>(id)) {}
961 explicit DontMangle(int id) 961 explicit DontMangle(int id)
962 : data_(static_cast<uint64_t>(id)) {} 962 : data_(static_cast<uint64_t>(id)) {}
(...skipping 22 matching lines...) Expand all
985 : data_(static_cast<uint64_t>(id)) {} 985 : data_(static_cast<uint64_t>(id)) {}
986 explicit ForceMangle(signed char id) 986 explicit ForceMangle(signed char id)
987 : data_(static_cast<uint64_t>(id)) {} 987 : data_(static_cast<uint64_t>(id)) {}
988 uint64_t data() const { return data_; } 988 uint64_t data() const { return data_; }
989 private: 989 private:
990 uint64_t data_; 990 uint64_t data_;
991 }; 991 };
992 992
993 TraceID(const void* id, unsigned char* flags) 993 TraceID(const void* id, unsigned char* flags)
994 : data_(static_cast<uint64_t>( 994 : data_(static_cast<uint64_t>(
995 reinterpret_cast<unsigned long>(id))) { 995 reinterpret_cast<uintptr_t>(id))) {
996 *flags |= TRACE_EVENT_FLAG_MANGLE_ID; 996 *flags |= TRACE_EVENT_FLAG_MANGLE_ID;
997 } 997 }
998 TraceID(ForceMangle id, unsigned char* flags) : data_(id.data()) { 998 TraceID(ForceMangle id, unsigned char* flags) : data_(id.data()) {
999 *flags |= TRACE_EVENT_FLAG_MANGLE_ID; 999 *flags |= TRACE_EVENT_FLAG_MANGLE_ID;
1000 } 1000 }
1001 TraceID(DontMangle id, unsigned char* flags) : data_(id.data()) { 1001 TraceID(DontMangle id, unsigned char* flags) : data_(id.data()) {
1002 } 1002 }
1003 TraceID(uint64_t id, unsigned char* flags) 1003 TraceID(uint64_t id, unsigned char* flags)
1004 : data_(id) { (void)flags; } 1004 : data_(id) { (void)flags; }
1005 TraceID(unsigned int id, unsigned char* flags) 1005 TraceID(unsigned int id, unsigned char* flags)
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 } 1236 }
1237 1237
1238 private: 1238 private:
1239 const char* previous_state_; 1239 const char* previous_state_;
1240 }; 1240 };
1241 1241
1242 } // namespace tracing_internals 1242 } // namespace tracing_internals
1243 } // namespace skia 1243 } // namespace skia
1244 1244
1245 #endif 1245 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698