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

Unified Diff: base/threading/thread.h

Issue 1207823004: PlatformThreadHandle: remove public id() interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more comments Created 5 years, 5 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
Index: base/threading/thread.h
diff --git a/base/threading/thread.h b/base/threading/thread.h
index 5126491b3861cdb60f23eec1b40b11466d27a33a..b470afe0bb68257965b46ad9a285ab72281e4ed7 100644
--- a/base/threading/thread.h
+++ b/base/threading/thread.h
@@ -14,12 +14,12 @@
#include "base/message_loop/timer_slack.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h"
+#include "base/synchronization/waitable_event.h"
#include "base/threading/platform_thread.h"
namespace base {
class MessagePump;
-class WaitableEvent;
// A simple thread abstraction that establishes a MessageLoop on a new thread.
// The consumer uses the MessageLoop of the thread to cause code to execute on
@@ -170,7 +170,9 @@ class BASE_EXPORT Thread : PlatformThread::Delegate {
// The native thread handle.
PlatformThreadHandle thread_handle() { return thread_; }
- // The thread ID.
+ // Returns the thread ID. Should not be called before the first Start*()
+ // call. Keeps on returning the same ID even after a Stop() call. The next
Takashi Toyoshima 2015/07/17 13:20:22 Note: many tests rely on this behavior to hold the
+ // Start*() call renews the ID.
PlatformThreadId thread_id() const;
// Returns true if the thread has been started, and not yet stopped.
@@ -222,6 +224,11 @@ class BASE_EXPORT Thread : PlatformThread::Delegate {
PlatformThreadHandle thread_;
mutable base::Lock thread_lock_; // Protects thread_.
+ // The thread's id once it was started.
Lei Zhang 2015/07/20 21:27:32 was -> has
Takashi Toyoshima 2015/07/21 16:05:37 Done.
+ PlatformThreadId id_;
+
Lei Zhang 2015/07/20 21:27:32 nit: no line separator to better indicate relation
Takashi Toyoshima 2015/07/21 16:05:37 Done.
+ mutable WaitableEvent id_event_; // Protects id_.
+
// The thread's message loop. Valid only while the thread is alive. Set
// by the created thread.
MessageLoop* message_loop_;

Powered by Google App Engine
This is Rietveld 408576698