Index: base/debug/trace_event_impl.cc |
diff --git a/base/debug/trace_event_impl.cc b/base/debug/trace_event_impl.cc |
index 07679d1131250fb101401191d02434dc6e59e8b8..82bf10308d8de56e848353c3b794a612f2991d05 100644 |
--- a/base/debug/trace_event_impl.cc |
+++ b/base/debug/trace_event_impl.cc |
@@ -10,7 +10,6 @@ |
#include "base/debug/leak_annotations.h" |
#include "base/debug/trace_event.h" |
#include "base/format_macros.h" |
-#include "base/lazy_instance.h" |
#include "base/memory/singleton.h" |
#include "base/process_util.h" |
#include "base/stl_util.h" |
@@ -65,9 +64,8 @@ const int g_category_categories_exhausted = 1; |
const int g_category_metadata = 2; |
int g_category_index = 3; // skip initial 3 categories |
-// The most-recently captured name of the current thread |
-LazyInstance<ThreadLocalPointer<const char> >::Leaky |
- g_current_thread_name = LAZY_INSTANCE_INITIALIZER; |
+// The most-recently captured name version of the current thread |
jar (doing other things)
2012/12/14 18:23:07
Please explain what a "name version" is for a thre
dsinclair
2012/12/14 19:13:46
Done.
jar (doing other things)
2012/12/21 00:16:59
The comment change was helpful, as I now am able t
dsinclair
2012/12/21 16:28:59
Done.
|
+uint32 g_current_thread_name_version = 0; |
} // namespace |
@@ -637,13 +635,15 @@ void TraceLog::AddTraceEvent(char phase, |
int thread_id = static_cast<int>(PlatformThread::CurrentId()); |
const char* new_name = PlatformThread::GetName(); |
+ uint32 new_version = PlatformThread::GetVersionForName(); |
// Check if the thread name has been set or changed since the previous |
// call (if any), but don't bother if the new name is empty. Note this will |
// not detect a thread name change within the same char* buffer address: we |
// favor common case performance over corner case correctness. |
- if (new_name != g_current_thread_name.Get().Get() && |
+ if (new_version != g_current_thread_name_version && |
new_name && *new_name) { |
- g_current_thread_name.Get().Set(new_name); |
+ g_current_thread_name_version = new_version; |
+ |
base::hash_map<int, std::string>::iterator existing_name = |
thread_names_.find(thread_id); |
if (existing_name == thread_names_.end()) { |