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

Side by Side Diff: base/threading/platform_thread_win.cc

Issue 8564014: Revert 109898 - Set the profiler's thread name at a central place (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/threading/platform_thread_posix.cc ('k') | base/threading/thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/threading/platform_thread.h" 5 #include "base/threading/platform_thread.h"
6 6
7 #include "base/debug/alias.h" 7 #include "base/debug/alias.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/thread_local.h" 9 #include "base/threading/thread_local.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
11 #include "base/tracked_objects.h"
12 11
13 #include "base/win/windows_version.h" 12 #include "base/win/windows_version.h"
14 13
15 namespace base { 14 namespace base {
16 15
17 namespace { 16 namespace {
18 17
19 static ThreadLocalPointer<char> current_thread_name; 18 static ThreadLocalPointer<char> current_thread_name;
20 19
21 // The information on how to set the thread name comes from 20 // The information on how to set the thread name comes from
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 93 }
95 94
96 // static 95 // static
97 void PlatformThread::Sleep(int duration_ms) { 96 void PlatformThread::Sleep(int duration_ms) {
98 ::Sleep(duration_ms); 97 ::Sleep(duration_ms);
99 } 98 }
100 99
101 // static 100 // static
102 void PlatformThread::SetName(const char* name) { 101 void PlatformThread::SetName(const char* name) {
103 current_thread_name.Set(const_cast<char*>(name)); 102 current_thread_name.Set(const_cast<char*>(name));
104 tracked_objects::ThreadData::InitializeThreadContext(name);
105 103
106 // The debugger needs to be around to catch the name in the exception. If 104 // The debugger needs to be around to catch the name in the exception. If
107 // there isn't a debugger, we are just needlessly throwing an exception. 105 // there isn't a debugger, we are just needlessly throwing an exception.
108 if (!::IsDebuggerPresent()) 106 if (!::IsDebuggerPresent())
109 return; 107 return;
110 108
111 THREADNAME_INFO info; 109 THREADNAME_INFO info;
112 info.dwType = 0x1000; 110 info.dwType = 0x1000;
113 info.szName = name; 111 info.szName = name;
114 info.dwThreadID = CurrentId(); 112 info.dwThreadID = CurrentId();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 case kThreadPriority_RealtimeAudio: 166 case kThreadPriority_RealtimeAudio:
169 ::SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL); 167 ::SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
170 break; 168 break;
171 default: 169 default:
172 NOTIMPLEMENTED(); 170 NOTIMPLEMENTED();
173 break; 171 break;
174 } 172 }
175 } 173 }
176 174
177 } // namespace base 175 } // namespace base
OLDNEW
« 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