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

Unified Diff: base/threading/platform_thread_win.cc

Issue 14634009: Move Thread Name Mapping into ThreadFunc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/threading/platform_thread_posix.cc ('k') | base/threading/thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « base/threading/platform_thread_posix.cc ('k') | base/threading/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698