OLD | NEW |
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 static MessageLoop* current(); | 156 static MessageLoop* current(); |
157 | 157 |
158 static void EnableHistogrammer(bool enable_histogrammer); | 158 static void EnableHistogrammer(bool enable_histogrammer); |
159 | 159 |
160 typedef MessagePump* (MessagePumpFactory)(); | 160 typedef MessagePump* (MessagePumpFactory)(); |
161 // Uses the given base::MessagePumpForUIFactory to override the default | 161 // Uses the given base::MessagePumpForUIFactory to override the default |
162 // MessagePump implementation for 'TYPE_UI'. Returns true if the factory | 162 // MessagePump implementation for 'TYPE_UI'. Returns true if the factory |
163 // was successfully registered. | 163 // was successfully registered. |
164 static bool InitMessagePumpForUIFactory(MessagePumpFactory* factory); | 164 static bool InitMessagePumpForUIFactory(MessagePumpFactory* factory); |
165 | 165 |
| 166 // Creates the default MessagePump based on |type|. Caller owns return |
| 167 // value. |
| 168 // TODO(sky): convert this and InitMessagePumpForUIFactory() to return a |
| 169 // scoped_ptr. |
| 170 static MessagePump* CreateMessagePumpForType(Type type); |
| 171 |
166 // A DestructionObserver is notified when the current MessageLoop is being | 172 // A DestructionObserver is notified when the current MessageLoop is being |
167 // destroyed. These observers are notified prior to MessageLoop::current() | 173 // destroyed. These observers are notified prior to MessageLoop::current() |
168 // being changed to return NULL. This gives interested parties the chance to | 174 // being changed to return NULL. This gives interested parties the chance to |
169 // do final cleanup that depends on the MessageLoop. | 175 // do final cleanup that depends on the MessageLoop. |
170 // | 176 // |
171 // NOTE: Any tasks posted to the MessageLoop during this notification will | 177 // NOTE: Any tasks posted to the MessageLoop during this notification will |
172 // not be run. Instead, they will be deleted. | 178 // not be run. Instead, they will be deleted. |
173 // | 179 // |
174 class BASE_EXPORT DestructionObserver { | 180 class BASE_EXPORT DestructionObserver { |
175 public: | 181 public: |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 747 |
742 // Do not add any member variables to MessageLoopForIO! This is important b/c | 748 // Do not add any member variables to MessageLoopForIO! This is important b/c |
743 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 749 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
744 // data that you need should be stored on the MessageLoop's pump_ instance. | 750 // data that you need should be stored on the MessageLoop's pump_ instance. |
745 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 751 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
746 MessageLoopForIO_should_not_have_extra_member_variables); | 752 MessageLoopForIO_should_not_have_extra_member_variables); |
747 | 753 |
748 } // namespace base | 754 } // namespace base |
749 | 755 |
750 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 756 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |