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

Unified Diff: base/threading/thread.cc

Issue 1212193003: MessageLoop: wire the unused static method in base::Thread (follow-up cleanup) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/message_loop/message_loop.h ('k') | no next file » | 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 6ca1caea099d344fa5c44cebd7310bd5c7078777..7bff24232e2bf2d66fda4485a4246ebae2e98332 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;
}
« no previous file with comments | « base/message_loop/message_loop.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698