Chromium Code Reviews| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 TYPE_UI, | 133 TYPE_UI, |
| 134 #if defined(TOOLKIT_GTK) | 134 #if defined(TOOLKIT_GTK) |
| 135 TYPE_GPU, | 135 TYPE_GPU, |
| 136 #endif | 136 #endif |
| 137 TYPE_IO, | 137 TYPE_IO, |
| 138 #if defined(OS_ANDROID) | 138 #if defined(OS_ANDROID) |
| 139 TYPE_JAVA, | 139 TYPE_JAVA, |
| 140 #endif // defined(OS_ANDROID) | 140 #endif // defined(OS_ANDROID) |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 // Creates a MessageLoop. If |message_pump| is NULL a MessagePump based on | |
| 144 // |type| is used, otherwise MessageLoop takes ownership of |message_pump| and | |
| 145 // uses it as the MessagePump. | |
| 143 // Normally, it is not necessary to instantiate a MessageLoop. Instead, it | 146 // Normally, it is not necessary to instantiate a MessageLoop. Instead, it |
| 144 // is typical to make use of the current thread's MessageLoop instance. | 147 // is typical to make use of the current thread's MessageLoop instance. |
| 145 explicit MessageLoop(Type type = TYPE_DEFAULT); | 148 // TODO(sky): remove default args. |
| 149 MessageLoop(Type type = TYPE_DEFAULT, MessagePump* message_pump = NULL); | |
|
darin (slow to review)
2013/11/07 00:17:54
Can we use scoped_ptr<MessagePump> here? Is it har
| |
| 146 virtual ~MessageLoop(); | 150 virtual ~MessageLoop(); |
| 147 | 151 |
| 148 // 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. |
| 149 static MessageLoop* current(); | 153 static MessageLoop* current(); |
| 150 | 154 |
| 151 static void EnableHistogrammer(bool enable_histogrammer); | 155 static void EnableHistogrammer(bool enable_histogrammer); |
| 152 | 156 |
| 153 typedef MessagePump* (MessagePumpFactory)(); | 157 typedef MessagePump* (MessagePumpFactory)(); |
| 154 // Uses the given base::MessagePumpForUIFactory to override the default | 158 // Uses the given base::MessagePumpForUIFactory to override the default |
| 155 // MessagePump implementation for 'TYPE_UI'. Returns true if the factory | 159 // MessagePump implementation for 'TYPE_UI'. Returns true if the factory |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 731 | 735 |
| 732 // Do not add any member variables to MessageLoopForIO! This is important b/c | 736 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 733 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 737 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 734 // data that you need should be stored on the MessageLoop's pump_ instance. | 738 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 735 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 739 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 736 MessageLoopForIO_should_not_have_extra_member_variables); | 740 MessageLoopForIO_should_not_have_extra_member_variables); |
| 737 | 741 |
| 738 } // namespace base | 742 } // namespace base |
| 739 | 743 |
| 740 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 744 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
| OLD | NEW |