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

Unified Diff: base/threading/thread.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « base/threading/thread.h ('k') | base/threading/thread_restrictions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread.cc
diff --git a/base/threading/thread.cc b/base/threading/thread.cc
index 63b07cbce6935bce5dcc203e289b4b8d58dc2af7..9c4535b59eb4361ba503691f497dbd9bdd97cc5f 100644
--- a/base/threading/thread.cc
+++ b/base/threading/thread.cc
@@ -94,8 +94,9 @@ bool Thread::StartWithOptions(const Options& options) {
type = MessageLoop::TYPE_CUSTOM;
message_loop_timer_slack_ = options.timer_slack;
- message_loop_ = new MessageLoop(type, options.message_pump_factory);
-
+ scoped_ptr<MessageLoop> message_loop =
+ MessageLoop::CreateUnbound(type, options.message_pump_factory);
+ message_loop_ = message_loop.get();
start_event_.reset(new WaitableEvent(false, false));
// Hold the thread_lock_ while starting a new thread, so that we can make sure
@@ -111,13 +112,16 @@ bool Thread::StartWithOptions(const Options& options) {
}
if (!created) {
DLOG(ERROR) << "failed to create thread";
- delete message_loop_;
message_loop_ = nullptr;
start_event_.reset();
return false;
}
}
+ // The ownership of message_loop is managemed by the newly created thread
+ // within the ThreadMain.
+ ignore_result(message_loop.release());
+
DCHECK(message_loop_);
return true;
}
@@ -190,13 +194,6 @@ bool Thread::IsRunning() const {
return running_;
}
-void Thread::SetPriority(ThreadPriority priority) {
- // The thread must be started (and id known) for this to be
- // compatible with all platforms.
- DCHECK(message_loop_ != nullptr);
- PlatformThread::SetThreadPriority(thread_, priority);
-}
-
void Thread::Run(MessageLoop* message_loop) {
message_loop->Run();
}
« no previous file with comments | « base/threading/thread.h ('k') | base/threading/thread_restrictions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698