summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authordeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-25 13:54:18 +0000
committerdeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-25 13:54:18 +0000
commit7d0f9445f4ffb50dc1d72bc2f5ce329ccfec7cad (patch)
tree668755bb0e584a311f5c22e24f1c48e0e47d0c56 /base
parent302bdc13a9baebb21894673e7674f4e0361cfe97 (diff)
downloadchromium_src-7d0f9445f4ffb50dc1d72bc2f5ce329ccfec7cad.zip
chromium_src-7d0f9445f4ffb50dc1d72bc2f5ce329ccfec7cad.tar.gz
chromium_src-7d0f9445f4ffb50dc1d72bc2f5ce329ccfec7cad.tar.bz2
Make PlatformThread::SetName operate only on the current thread.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1306 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/platform_thread.h8
-rw-r--r--base/platform_thread_posix.cc2
-rw-r--r--base/platform_thread_win.cc4
-rw-r--r--base/thread.cc2
-rw-r--r--base/watchdog.cc2
5 files changed, 10 insertions, 8 deletions
diff --git a/base/platform_thread.h b/base/platform_thread.h
index edb2ddc..a999e8d 100644
--- a/base/platform_thread.h
+++ b/base/platform_thread.h
@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// WARNING: You should *NOT* be using this class directly. PlatformThread is
+// the low-level platform-specific abstraction to the OS's threading interface.
+// You should instead be using a message-loop driven Thread, see thread.h.
+
#ifndef BASE_PLATFORM_THREAD_H_
#define BASE_PLATFORM_THREAD_H_
@@ -31,9 +35,7 @@ class PlatformThread {
static void Sleep(int duration_ms);
// Sets the thread name visible to a debugger. This has no effect otherwise.
- // To set the name of the current thread, pass PlatformThread::CurrentId() as
- // the thread_id parameter.
- static void SetName(int thread_id, const char* name);
+ static void SetName(const char* name);
// Implement this interface to run code on a background thread. Your
// ThreadMain method will be called on the newly created thread.
diff --git a/base/platform_thread_posix.cc b/base/platform_thread_posix.cc
index 79e17f3..9d65264 100644
--- a/base/platform_thread_posix.cc
+++ b/base/platform_thread_posix.cc
@@ -53,7 +53,7 @@ void PlatformThread::Sleep(int duration_ms) {
}
// static
-void PlatformThread::SetName(int thread_id, const char* name) {
+void PlatformThread::SetName(const char* name) {
// TODO(darin): implement me!
}
diff --git a/base/platform_thread_win.cc b/base/platform_thread_win.cc
index 7b62d8e..00efdc1 100644
--- a/base/platform_thread_win.cc
+++ b/base/platform_thread_win.cc
@@ -47,11 +47,11 @@ void PlatformThread::Sleep(int duration_ms) {
}
// static
-void PlatformThread::SetName(int thread_id, const char* name) {
+void PlatformThread::SetName(const char* name) {
THREADNAME_INFO info;
info.dwType = 0x1000;
info.szName = name;
- info.dwThreadID = thread_id;
+ info.dwThreadID = CurrentId();
info.dwFlags = 0;
__try {
diff --git a/base/thread.cc b/base/thread.cc
index a4798e0..0fe023a 100644
--- a/base/thread.cc
+++ b/base/thread.cc
@@ -123,7 +123,7 @@ void Thread::ThreadMain() {
// Complete the initialization of our Thread object.
thread_id_ = PlatformThread::CurrentId();
- PlatformThread::SetName(thread_id_, name_.c_str());
+ PlatformThread::SetName(name_.c_str());
message_loop.set_thread_name(name_);
message_loop_ = &message_loop;
thread_created_ = true;
diff --git a/base/watchdog.cc b/base/watchdog.cc
index 96dd9b9..06ab871 100644
--- a/base/watchdog.cc
+++ b/base/watchdog.cc
@@ -135,7 +135,7 @@ unsigned Watchdog::Run() {
void Watchdog::SetThreadName() const {
std::string name = StringPrintf("%s Watchdog",
WideToASCII(thread_watched_name_).c_str());
- PlatformThread::SetName(thread_id_, name.c_str());
+ PlatformThread::SetName(name.c_str());
DLOG(INFO) << "Watchdog active: " << name;
}