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

Unified Diff: base/threading/thread.cc

Issue 61643006: Adds the ability for MessageLoop to take a MessagePump (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge 2 trunk and BASE_EXPORT Created 7 years, 1 month 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') | chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc » ('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 aca4ddbaa02a11c37ef02b39b5e4c3da829f404e..ae4d37319471a247a2bb6cf01dc29a876e445953 100644
--- a/base/threading/thread.cc
+++ b/base/threading/thread.cc
@@ -49,6 +49,20 @@ struct Thread::StartupData {
event(false, false) {}
};
+Thread::Options::Options()
+ : message_loop_type(MessageLoop::TYPE_DEFAULT),
+ stack_size(0) {
+}
+
+Thread::Options::Options(MessageLoop::Type type,
+ size_t size)
+ : message_loop_type(type),
+ stack_size(size) {
+}
+
+Thread::Options::~Options() {
+}
+
Thread::Thread(const char* name)
:
#if defined(OS_WIN)
@@ -174,8 +188,14 @@ void Thread::ThreadMain() {
{
// The message loop for this thread.
// Allocated on the heap to centralize any leak reports at this line.
- scoped_ptr<MessageLoop> message_loop(
- new MessageLoop(startup_data_->options.message_loop_type));
+ scoped_ptr<MessageLoop> message_loop;
+ if (!startup_data_->options.message_pump_factory.is_null()) {
+ message_loop.reset(
+ new MessageLoop(startup_data_->options.message_pump_factory.Run()));
+ } else {
+ message_loop.reset(
+ new MessageLoop(startup_data_->options.message_loop_type));
+ }
// Complete the initialization of our Thread object.
thread_id_ = PlatformThread::CurrentId();
« no previous file with comments | « base/threading/thread.h ('k') | chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698