| Index: base/threading/thread.h
|
| diff --git a/base/threading/thread.h b/base/threading/thread.h
|
| index 2e19b0a944e862ef4a46f096a9d7143d5a833eb9..49156063929759f62cab534432251947df10dec8 100644
|
| --- a/base/threading/thread.h
|
| +++ b/base/threading/thread.h
|
| @@ -13,13 +13,11 @@
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/message_loop/timer_slack.h"
|
| #include "base/single_thread_task_runner.h"
|
| -#include "base/synchronization/lock.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
|
| @@ -47,7 +45,7 @@
|
| // This is ignored if message_pump_factory.is_null() is false.
|
| MessageLoop::Type message_loop_type;
|
|
|
| - // Specifies timer slack for thread message loop.
|
| + // Specify timer slack for thread message loop.
|
| TimerSlack timer_slack;
|
|
|
| // Used to create the MessagePump for the MessageLoop. The callback is Run()
|
| @@ -83,7 +81,7 @@
|
| // init_com_with_mta(false) and then StartWithOptions() with any message loop
|
| // type other than TYPE_UI.
|
| void init_com_with_mta(bool use_mta) {
|
| - DCHECK(!start_event_);
|
| + DCHECK(!started_);
|
| com_status_ = use_mta ? MTA : STA;
|
| }
|
| #endif
|
| @@ -104,18 +102,6 @@
|
| // i.e. during a DllMain, global object construction or destruction, atexit()
|
| // callback.
|
| bool StartWithOptions(const Options& options);
|
| -
|
| - // Starts the thread and wait for the thread to start and run initialization
|
| - // before returning. It's same as calling Start() and then
|
| - // WaitUntilThreadStarted().
|
| - // Note that using this (instead of Start() or StartWithOptions() causes
|
| - // jank on the calling thread, should be used only in testing code.
|
| - bool StartAndWaitForTesting();
|
| -
|
| - // Blocks until the thread starts running. Called within StartAndWait().
|
| - // Note that calling this causes jank on the calling thread, must be used
|
| - // carefully for production code.
|
| - bool WaitUntilThreadStarted();
|
|
|
| // Signals the thread to exit and returns once the thread has exited. After
|
| // this method returns, the Thread object is completely reset and may be used
|
| @@ -180,7 +166,7 @@
|
| PlatformThreadHandle thread_handle() { return thread_; }
|
|
|
| // The thread ID.
|
| - PlatformThreadId thread_id() const { return thread_.id(); }
|
| + PlatformThreadId thread_id() const { return thread_id_; }
|
|
|
| // Returns true if the thread has been started, and not yet stopped.
|
| bool IsRunning() const;
|
| @@ -222,13 +208,19 @@
|
| ComStatus com_status_;
|
| #endif
|
|
|
| + // Whether we successfully started the thread.
|
| + bool started_;
|
| +
|
| // If true, we're in the middle of stopping, and shouldn't access
|
| // |message_loop_|. It may non-NULL and invalid.
|
| bool stopping_;
|
|
|
| // True while inside of Run().
|
| bool running_;
|
| - mutable base::Lock lock_; // Protects running_.
|
| +
|
| + // Used to pass data to ThreadMain.
|
| + struct StartupData;
|
| + StartupData* startup_data_;
|
|
|
| // The thread's handle.
|
| PlatformThreadHandle thread_;
|
| @@ -237,16 +229,12 @@
|
| // by the created thread.
|
| MessageLoop* message_loop_;
|
|
|
| - // Stores Options::timer_slack_ until the message loop has been bound to
|
| - // a thread.
|
| - TimerSlack message_loop_timer_slack_;
|
| + // Our thread's ID.
|
| + PlatformThreadId thread_id_;
|
|
|
| // The name of the thread. Used for debugging purposes.
|
| std::string name_;
|
|
|
| - // Non-null if the thread has successfully started.
|
| - scoped_ptr<WaitableEvent> start_event_;
|
| -
|
| friend void ThreadQuitHelper();
|
|
|
| DISALLOW_COPY_AND_ASSIGN(Thread);
|
|
|