| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef BASE_MESSAGE_LOOP_H_ |
| 6 #define BASE_MESSAGE_LOOP_H_ | 6 #define BASE_MESSAGE_LOOP_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // is typical to make use of the current thread's MessageLoop instance. | 113 // is typical to make use of the current thread's MessageLoop instance. |
| 114 explicit MessageLoop(Type type = TYPE_DEFAULT); | 114 explicit MessageLoop(Type type = TYPE_DEFAULT); |
| 115 virtual ~MessageLoop(); | 115 virtual ~MessageLoop(); |
| 116 | 116 |
| 117 // Returns the MessageLoop object for the current thread, or null if none. | 117 // Returns the MessageLoop object for the current thread, or null if none. |
| 118 static MessageLoop* current(); | 118 static MessageLoop* current(); |
| 119 | 119 |
| 120 static void EnableHistogrammer(bool enable_histogrammer); | 120 static void EnableHistogrammer(bool enable_histogrammer); |
| 121 | 121 |
| 122 typedef base::MessagePump* (MessagePumpFactory)(); | 122 typedef base::MessagePump* (MessagePumpFactory)(); |
| 123 // Using the given base::MessagePumpForUIFactory to override the default | 123 // Uses the given base::MessagePumpForUIFactory to override the default |
| 124 // MessagePump implementation for 'TYPE_UI'. | 124 // MessagePump implementation for 'TYPE_UI'. Returns true if the factory |
| 125 static void InitMessagePumpForUIFactory(MessagePumpFactory* factory); | 125 // was successfully registered. |
| 126 static bool InitMessagePumpForUIFactory(MessagePumpFactory* factory); |
| 126 | 127 |
| 127 // A DestructionObserver is notified when the current MessageLoop is being | 128 // A DestructionObserver is notified when the current MessageLoop is being |
| 128 // destroyed. These observers are notified prior to MessageLoop::current() | 129 // destroyed. These observers are notified prior to MessageLoop::current() |
| 129 // being changed to return NULL. This gives interested parties the chance to | 130 // being changed to return NULL. This gives interested parties the chance to |
| 130 // do final cleanup that depends on the MessageLoop. | 131 // do final cleanup that depends on the MessageLoop. |
| 131 // | 132 // |
| 132 // NOTE: Any tasks posted to the MessageLoop during this notification will | 133 // NOTE: Any tasks posted to the MessageLoop during this notification will |
| 133 // not be run. Instead, they will be deleted. | 134 // not be run. Instead, they will be deleted. |
| 134 // | 135 // |
| 135 class BASE_EXPORT DestructionObserver { | 136 class BASE_EXPORT DestructionObserver { |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 #endif // defined(OS_POSIX) | 699 #endif // defined(OS_POSIX) |
| 699 }; | 700 }; |
| 700 | 701 |
| 701 // Do not add any member variables to MessageLoopForIO! This is important b/c | 702 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 702 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 703 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 703 // data that you need should be stored on the MessageLoop's pump_ instance. | 704 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 704 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 705 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 705 MessageLoopForIO_should_not_have_extra_member_variables); | 706 MessageLoopForIO_should_not_have_extra_member_variables); |
| 706 | 707 |
| 707 #endif // BASE_MESSAGE_LOOP_H_ | 708 #endif // BASE_MESSAGE_LOOP_H_ |
| OLD | NEW |