Index: base/threading/platform_thread_win.cc |
diff --git a/base/threading/platform_thread_win.cc b/base/threading/platform_thread_win.cc |
index 904f2b4d27ebc042392c22e08e7f9cc272c0b23d..cf1e0f60ea1c0e6ed3bc5b8ce3343b5793c0c900 100644 |
--- a/base/threading/platform_thread_win.cc |
+++ b/base/threading/platform_thread_win.cc |
@@ -53,8 +53,29 @@ DWORD __stdcall ThreadFunc(void* params) { |
PlatformThread::Delegate* delegate = thread_params->delegate; |
if (!thread_params->joinable) |
base::ThreadRestrictions::SetSingletonAllowed(false); |
+ |
+ /* Retrieve a copy of the thread handle to use as the key in the |
+ * thread name mapping. */ |
+ PlatformThreadHandle::Handle platform_handle; |
+ DuplicateHandle( |
+ GetCurrentProcess(), |
+ GetCurrentThread(), |
+ GetCurrentProcess(), |
+ &platform_handle, |
+ 0, |
+ FALSE, |
+ DUPLICATE_SAME_ACCESS); |
+ |
+ ThreadIdNameManager::GetInstance()->RegisterThread( |
+ platform_handle, |
+ PlatformThread::CurrentId()); |
+ |
delete thread_params; |
delegate->ThreadMain(); |
+ |
+ ThreadIdNameManager::GetInstance()->RemoveName( |
+ platform_handle, |
+ PlatformThread::CurrentId()); |
return NULL; |
} |