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

Side by Side Diff: base/message_loop/message_loop.h

Issue 185413019: Used scoped_ptr in InitMessagePumpForUIFactory and CreateMessagePumpForType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes in accordance to build fail for linux chromeos Created 6 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 unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Creates a TYPE_CUSTOM MessageLoop with the supplied MessagePump, which must 147 // Creates a TYPE_CUSTOM MessageLoop with the supplied MessagePump, which must
148 // be non-NULL. 148 // be non-NULL.
149 explicit MessageLoop(scoped_ptr<base::MessagePump> pump); 149 explicit MessageLoop(scoped_ptr<base::MessagePump> pump);
150 virtual ~MessageLoop(); 150 virtual ~MessageLoop();
151 151
152 // Returns the MessageLoop object for the current thread, or null if none. 152 // Returns the MessageLoop object for the current thread, or null if none.
153 static MessageLoop* current(); 153 static MessageLoop* current();
154 154
155 static void EnableHistogrammer(bool enable_histogrammer); 155 static void EnableHistogrammer(bool enable_histogrammer);
156 156
157 typedef MessagePump* (MessagePumpFactory)(); 157 typedef scoped_ptr<MessagePump> (MessagePumpFactory)();
158 // Uses the given base::MessagePumpForUIFactory to override the default 158 // Uses the given base::MessagePumpForUIFactory to override the default
159 // MessagePump implementation for 'TYPE_UI'. Returns true if the factory 159 // MessagePump implementation for 'TYPE_UI'. Returns true if the factory
160 // was successfully registered. 160 // was successfully registered.
161 static bool InitMessagePumpForUIFactory(MessagePumpFactory* factory); 161 static bool InitMessagePumpForUIFactory(MessagePumpFactory* factory);
162 162
163 // Creates the default MessagePump based on |type|. Caller owns return 163 // Creates the default MessagePump based on |type|. Caller owns return
164 // value. 164 // value.
165 // TODO(sky): convert this and InitMessagePumpForUIFactory() to return a 165 static scoped_ptr<MessagePump> CreateMessagePumpForType(Type type);
166 // scoped_ptr.
167 static MessagePump* CreateMessagePumpForType(Type type);
168
169 // A DestructionObserver is notified when the current MessageLoop is being 166 // A DestructionObserver is notified when the current MessageLoop is being
170 // destroyed. These observers are notified prior to MessageLoop::current() 167 // destroyed. These observers are notified prior to MessageLoop::current()
171 // being changed to return NULL. This gives interested parties the chance to 168 // being changed to return NULL. This gives interested parties the chance to
172 // do final cleanup that depends on the MessageLoop. 169 // do final cleanup that depends on the MessageLoop.
173 // 170 //
174 // NOTE: Any tasks posted to the MessageLoop during this notification will 171 // NOTE: Any tasks posted to the MessageLoop during this notification will
175 // not be run. Instead, they will be deleted. 172 // not be run. Instead, they will be deleted.
176 // 173 //
177 class BASE_EXPORT DestructionObserver { 174 class BASE_EXPORT DestructionObserver {
178 public: 175 public:
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 710
714 // Do not add any member variables to MessageLoopForIO! This is important b/c 711 // Do not add any member variables to MessageLoopForIO! This is important b/c
715 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 712 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
716 // data that you need should be stored on the MessageLoop's pump_ instance. 713 // data that you need should be stored on the MessageLoop's pump_ instance.
717 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 714 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
718 MessageLoopForIO_should_not_have_extra_member_variables); 715 MessageLoopForIO_should_not_have_extra_member_variables);
719 716
720 } // namespace base 717 } // namespace base
721 718
722 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 719 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « AUTHORS ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698