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 // Uses the given base::MessagePumpForUIFactory to override the default | 123 // Using the given base::MessagePumpForUIFactory to override the default |
124 // MessagePump implementation for 'TYPE_UI'. Returns true if the factory | 124 // MessagePump implementation for 'TYPE_UI'. |
125 // was successfully registered. | 125 static void InitMessagePumpForUIFactory(MessagePumpFactory* factory); |
126 static bool InitMessagePumpForUIFactory(MessagePumpFactory* factory); | |
127 | 126 |
128 // A DestructionObserver is notified when the current MessageLoop is being | 127 // A DestructionObserver is notified when the current MessageLoop is being |
129 // destroyed. These observers are notified prior to MessageLoop::current() | 128 // destroyed. These observers are notified prior to MessageLoop::current() |
130 // being changed to return NULL. This gives interested parties the chance to | 129 // being changed to return NULL. This gives interested parties the chance to |
131 // do final cleanup that depends on the MessageLoop. | 130 // do final cleanup that depends on the MessageLoop. |
132 // | 131 // |
133 // NOTE: Any tasks posted to the MessageLoop during this notification will | 132 // NOTE: Any tasks posted to the MessageLoop during this notification will |
134 // not be run. Instead, they will be deleted. | 133 // not be run. Instead, they will be deleted. |
135 // | 134 // |
136 class BASE_EXPORT DestructionObserver { | 135 class BASE_EXPORT DestructionObserver { |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 #endif // defined(OS_POSIX) | 698 #endif // defined(OS_POSIX) |
700 }; | 699 }; |
701 | 700 |
702 // Do not add any member variables to MessageLoopForIO! This is important b/c | 701 // Do not add any member variables to MessageLoopForIO! This is important b/c |
703 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 702 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
704 // data that you need should be stored on the MessageLoop's pump_ instance. | 703 // data that you need should be stored on the MessageLoop's pump_ instance. |
705 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 704 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
706 MessageLoopForIO_should_not_have_extra_member_variables); | 705 MessageLoopForIO_should_not_have_extra_member_variables); |
707 | 706 |
708 #endif // BASE_MESSAGE_LOOP_H_ | 707 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |