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

Unified Diff: base/threading/thread.h

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/message_loop/message_loop.cc ('k') | base/threading/thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread.h
diff --git a/base/threading/thread.h b/base/threading/thread.h
index 98831b82e5ccea93b2d2f68c583a74682d6925d0..99f9dd4a5976eedb502cdee604a38b191fd80560 100644
--- a/base/threading/thread.h
+++ b/base/threading/thread.h
@@ -8,12 +8,16 @@
#include <string>
#include "base/base_export.h"
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/threading/platform_thread.h"
namespace base {
+class MessagePump;
+
// 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
// the thread. When this object is destroyed the thread is terminated. All
@@ -29,14 +33,23 @@ namespace base {
// (3.b) MessageLoop::DestructionObserver::WillDestroyCurrentMessageLoop
class BASE_EXPORT Thread : PlatformThread::Delegate {
public:
- struct Options {
- Options() : message_loop_type(MessageLoop::TYPE_DEFAULT), stack_size(0) {}
- Options(MessageLoop::Type type, size_t size)
- : message_loop_type(type), stack_size(size) {}
+ struct BASE_EXPORT Options {
+ typedef Callback<scoped_ptr<MessagePump>()> MessagePumpFactory;
+
+ Options();
+ Options(MessageLoop::Type type, size_t size);
+ ~Options();
// Specifies the type of message loop that will be allocated on the thread.
+ // This is ignored if message_pump_factory.is_null() is false.
MessageLoop::Type message_loop_type;
+ // Used to create the MessagePump for the MessageLoop. The callback is Run()
+ // on the thread. If message_pump_factory.is_null(), then a MessagePump
+ // appropriate for |message_loop_type| is created. Setting this forces the
+ // MessageLoop::Type to TYPE_CUSTOM.
+ MessagePumpFactory message_pump_factory;
+
// Specifies the maximum stack size that the thread is allowed to use.
// This does not necessarily correspond to the thread's initial stack size.
// A value of 0 indicates that the default maximum should be used.
« no previous file with comments | « base/message_loop/message_loop.cc ('k') | base/threading/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698