diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-22 22:04:21 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-22 22:04:21 +0000 |
commit | e9b19f26146a8f4cf5248084a85770f00bb4148a (patch) | |
tree | e0cb866f933bfb8d11f6d3a7732a8030669625d8 /base | |
parent | de834152c917dce0e7c74a7c62dac5506f6b0260 (diff) | |
download | chromium_src-e9b19f26146a8f4cf5248084a85770f00bb4148a.zip chromium_src-e9b19f26146a8f4cf5248084a85770f00bb4148a.tar.gz chromium_src-e9b19f26146a8f4cf5248084a85770f00bb4148a.tar.bz2 |
Review URL: http://codereview.chromium.org/18690
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8506 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/thread.cc | 7 | ||||
-rw-r--r-- | base/thread_unittest.cc | 23 |
2 files changed, 3 insertions, 27 deletions
diff --git a/base/thread.cc b/base/thread.cc index 387b1c5..9bc81a4 100644 --- a/base/thread.cc +++ b/base/thread.cc @@ -143,14 +143,13 @@ void Thread::ThreadMain() { message_loop.set_thread_name(name_); message_loop_ = &message_loop; - // Let the thread do extra initialization. - // Let's do this before signaling we are started. - Init(); - startup_data_->event.Signal(); // startup_data_ can't be touched anymore since the starting thread is now // unlocked. + // Let the thread do extra initialization. + Init(); + message_loop.Run(); // Let the thread do extra cleanup. diff --git a/base/thread_unittest.cc b/base/thread_unittest.cc index 083456d..085df71 100644 --- a/base/thread_unittest.cc +++ b/base/thread_unittest.cc @@ -37,20 +37,6 @@ class SleepSome : public Task { int msec_; }; -class SleepInsideInitThread : public Thread { - public: - SleepInsideInitThread() : Thread("none") { init_called_ = false; } - virtual ~SleepInsideInitThread() { } - - virtual void Init() { - PlatformThread::Sleep(1000); - init_called_ = true; - } - bool InitCalled() { return init_called_; } - private: - bool init_called_; -}; - } // namespace TEST_F(ThreadTest, Restart) { @@ -121,12 +107,3 @@ TEST_F(ThreadTest, ThreadName) { EXPECT_TRUE(a.Start()); EXPECT_EQ("ThreadName", a.thread_name()); } - -// Make sure we can't use a thread between Start() and Init(). -TEST_F(ThreadTest, SleepInsideInit) { - SleepInsideInitThread t; - EXPECT_FALSE(t.InitCalled()); - t.Start(); - EXPECT_TRUE(t.InitCalled()); -} - |