| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/debug/trace_event_win.h" | 5 #include "base/debug/trace_event_win.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
| 9 #include <initguid.h> // NOLINT | 9 #include <initguid.h> // NOLINT |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // {97BE602D-2930-4ac3-8046-B6763B631DFE} | 25 // {97BE602D-2930-4ac3-8046-B6763B631DFE} |
| 26 const GUID kTraceEventClass64 = { | 26 const GUID kTraceEventClass64 = { |
| 27 0x97be602d, 0x2930, 0x4ac3, 0x80, 0x46, 0xb6, 0x76, 0x3b, 0x63, 0x1d, 0xfe}; | 27 0x97be602d, 0x2930, 0x4ac3, 0x80, 0x46, 0xb6, 0x76, 0x3b, 0x63, 0x1d, 0xfe}; |
| 28 | 28 |
| 29 | 29 |
| 30 TraceLog::TraceLog() : EtwTraceProvider(kChromeTraceProviderName) { | 30 TraceLog::TraceLog() : EtwTraceProvider(kChromeTraceProviderName) { |
| 31 Register(); | 31 Register(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 TraceLog* TraceLog::Get() { | 34 TraceLog* TraceLog::GetInstance() { |
| 35 return Singleton<TraceLog, StaticMemorySingletonTraits<TraceLog>>::get(); | 35 return Singleton<TraceLog, StaticMemorySingletonTraits<TraceLog> >::get(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool TraceLog::StartTracing() { | 38 bool TraceLog::StartTracing() { |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 void TraceLog::TraceEvent(const char* name, | 42 void TraceLog::TraceEvent(const char* name, |
| 43 size_t name_len, | 43 size_t name_len, |
| 44 EventType type, | 44 EventType type, |
| 45 const void* id, | 45 const void* id, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // Trace the event. | 92 // Trace the event. |
| 93 Log(event.get()); | 93 Log(event.get()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void TraceLog::Trace(const char* name, | 96 void TraceLog::Trace(const char* name, |
| 97 size_t name_len, | 97 size_t name_len, |
| 98 EventType type, | 98 EventType type, |
| 99 const void* id, | 99 const void* id, |
| 100 const char* extra, | 100 const char* extra, |
| 101 size_t extra_len) { | 101 size_t extra_len) { |
| 102 TraceLog* provider = TraceLog::Get(); | 102 TraceLog* provider = TraceLog::GetInstance(); |
| 103 if (provider && provider->IsTracing()) { | 103 if (provider && provider->IsTracing()) { |
| 104 // Compute the name & extra lengths if not supplied already. | 104 // Compute the name & extra lengths if not supplied already. |
| 105 if (name_len == -1) | 105 if (name_len == -1) |
| 106 name_len = (name == NULL) ? 0 : strlen(name); | 106 name_len = (name == NULL) ? 0 : strlen(name); |
| 107 if (extra_len == -1) | 107 if (extra_len == -1) |
| 108 extra_len = (extra == NULL) ? 0 : strlen(extra); | 108 extra_len = (extra == NULL) ? 0 : strlen(extra); |
| 109 | 109 |
| 110 provider->TraceEvent(name, name_len, type, id, extra, extra_len); | 110 provider->TraceEvent(name, name_len, type, id, extra, extra_len); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 void TraceLog::Resurrect() { | 114 void TraceLog::Resurrect() { |
| 115 StaticMemorySingletonTraits<TraceLog>::Resurrect(); | 115 StaticMemorySingletonTraits<TraceLog>::Resurrect(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace debug | 118 } // namespace debug |
| 119 } // namespace base | 119 } // namespace base |
| OLD | NEW |