diff options
author | Brian Osman <brianosman@google.com> | 2017-07-21 15:30:14 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-21 20:57:27 +0000 |
commit | de6e5bf33f6083842ffb0cd63c6578d1f9f23983 (patch) | |
tree | 72c35e7f426c99799499e942dc4689a2488b7bef /src/core/SkTraceEvent.h | |
parent | aaa3056e46ed9004097dc784db94c3a97d070569 (diff) |
Tracing cleanup and bugfixes
TraceID was unused, remove it.
Simplify casting logic by using the same union helper as the macros.
This fixes a bug that was present in the bool handling - we were
treating the union value as a pointer, so we were dereferencing
random stack memory. Luckily it never crashes, we did get the wrong
values for bools.
Bug: skia:
Change-Id: I15d44756214f34c1f6479980d9a487ac7f3d8f6c
Reviewed-on: https://skia-review.googlesource.com/25801
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/core/SkTraceEvent.h')
-rw-r--r-- | src/core/SkTraceEvent.h | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/core/SkTraceEvent.h b/src/core/SkTraceEvent.h index 6e10c102a1..8b9a15cff4 100644 --- a/src/core/SkTraceEvent.h +++ b/src/core/SkTraceEvent.h @@ -143,41 +143,6 @@ namespace tracing_internals { const int kZeroNumArgs = 0; const uint64_t kNoEventId = 0; -// TraceID encapsulates an ID that can either be an integer or pointer. Pointers -// are by default mangled with the Process ID so that they are unlikely to -// collide when the same pointer is used on different processes. -class TraceID { - public: - TraceID(const void* id, unsigned char* flags) - : data_(static_cast<uint64_t>( - reinterpret_cast<uintptr_t>(id))) { - *flags |= TRACE_EVENT_FLAG_MANGLE_ID; - } - TraceID(uint64_t id, unsigned char* flags) - : data_(id) { (void)flags; } - TraceID(unsigned int id, unsigned char* flags) - : data_(id) { (void)flags; } - TraceID(unsigned short id, unsigned char* flags) - : data_(id) { (void)flags; } - TraceID(unsigned char id, unsigned char* flags) - : data_(id) { (void)flags; } - TraceID(long long id, unsigned char* flags) - : data_(static_cast<uint64_t>(id)) { (void)flags; } - TraceID(long id, unsigned char* flags) - : data_(static_cast<uint64_t>(id)) { (void)flags; } - TraceID(int id, unsigned char* flags) - : data_(static_cast<uint64_t>(id)) { (void)flags; } - TraceID(short id, unsigned char* flags) - : data_(static_cast<uint64_t>(id)) { (void)flags; } - TraceID(signed char id, unsigned char* flags) - : data_(static_cast<uint64_t>(id)) { (void)flags; } - - uint64_t data() const { return data_; } - - private: - uint64_t data_; -}; - // Simple union to store various types as uint64_t. union TraceValueUnion { bool as_bool; |