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

Unified Diff: base/message_loop/message_loop_proxy_impl.h

Issue 1011683002: Lazily initialize MessageLoop for faster thread startup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: non-blocking thread_id() Created 5 years, 9 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
Index: base/message_loop/message_loop_proxy_impl.h
diff --git a/base/message_loop/message_loop_proxy_impl.h b/base/message_loop/message_loop_proxy_impl.h
index 0fe629f9d140c0244128e49598308a9a48d15366..150c441a7580649ffa6e95456beb955aa61bb038 100644
--- a/base/message_loop/message_loop_proxy_impl.h
+++ b/base/message_loop/message_loop_proxy_impl.h
@@ -21,7 +21,14 @@ class IncomingTaskQueue;
// MessageLoop.
class BASE_EXPORT MessageLoopProxyImpl : public MessageLoopProxy {
public:
- explicit MessageLoopProxyImpl(
+ static MessageLoopProxyImpl* Create(
rvargas (doing something else) 2015/03/26 02:19:27 return scoped ptr
kinuko 2015/04/13 02:02:59 Removed this ctor.
+ scoped_refptr<IncomingTaskQueue> incoming_queue);
+
+ // Creates a proxy for lazy initialization. This type of MessageLoopProxy
+ // is intended to be created for the message loop that is to be initialized
+ // lazily (i.e. created by CreateForLazyInit()). See the comment at
+ // MessageLoop::CreateForLazyInit() for more details.
+ static MessageLoopProxyImpl* CreateForLazyInit(
rvargas (doing something else) 2015/03/26 02:19:27 nit: Make this the default (Create) and hint that
kinuko 2015/04/13 02:02:59 Done.
scoped_refptr<IncomingTaskQueue> incoming_queue);
// MessageLoopProxy implementation
@@ -33,8 +40,15 @@ class BASE_EXPORT MessageLoopProxyImpl : public MessageLoopProxy {
base::TimeDelta delay) override;
bool RunsTasksOnCurrentThread() const override;
+ // Initialize this message loop proxy on the current thread.
+ // It is not valid to call this unless this proxy is created by
+ // CreateForLazyInit().
+ void LazyInit();
rvargas (doing something else) 2015/03/26 02:19:27 Init() ?
kinuko 2015/04/13 02:02:59 Done.
+
private:
friend class RefCountedThreadSafe<MessageLoopProxyImpl>;
+ MessageLoopProxyImpl(scoped_refptr<IncomingTaskQueue> incoming_queue,
+ bool lazy_init);
~MessageLoopProxyImpl() override;
// THe incoming queue receiving all posted tasks.

Powered by Google App Engine
This is Rietveld 408576698