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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 }; | 148 }; |
149 | 149 |
150 // Add a DestructionObserver, which will start receiving notifications | 150 // Add a DestructionObserver, which will start receiving notifications |
151 // immediately. | 151 // immediately. |
152 void AddDestructionObserver(DestructionObserver* destruction_observer); | 152 void AddDestructionObserver(DestructionObserver* destruction_observer); |
153 | 153 |
154 // Remove a DestructionObserver. It is safe to call this method while a | 154 // Remove a DestructionObserver. It is safe to call this method while a |
155 // DestructionObserver is receiving a notification callback. | 155 // DestructionObserver is receiving a notification callback. |
156 void RemoveDestructionObserver(DestructionObserver* destruction_observer); | 156 void RemoveDestructionObserver(DestructionObserver* destruction_observer); |
157 | 157 |
| 158 // NOTE: Deprecated; prefer task_runner() and the TaskRunner interfaces. |
| 159 // TODO(skyostil): Remove these functions (crbug.com/465354). |
| 160 // |
158 // The "PostTask" family of methods call the task's Run method asynchronously | 161 // The "PostTask" family of methods call the task's Run method asynchronously |
159 // from within a message loop at some point in the future. | 162 // from within a message loop at some point in the future. |
160 // | 163 // |
161 // With the PostTask variant, tasks are invoked in FIFO order, inter-mixed | 164 // With the PostTask variant, tasks are invoked in FIFO order, inter-mixed |
162 // with normal UI or IO event processing. With the PostDelayedTask variant, | 165 // with normal UI or IO event processing. With the PostDelayedTask variant, |
163 // tasks are called after at least approximately 'delay_ms' have elapsed. | 166 // tasks are called after at least approximately 'delay_ms' have elapsed. |
164 // | 167 // |
165 // The NonNestable variants work similarly except that they promise never to | 168 // The NonNestable variants work similarly except that they promise never to |
166 // dispatch the task from a nested invocation of MessageLoop::Run. Instead, | 169 // dispatch the task from a nested invocation of MessageLoop::Run. Instead, |
167 // such tasks get deferred until the top-most MessageLoop::Run is executing. | 170 // such tasks get deferred until the top-most MessageLoop::Run is executing. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 const std::string& thread_name() const { return thread_name_; } | 296 const std::string& thread_name() const { return thread_name_; } |
294 | 297 |
295 // Gets the message loop proxy associated with this message loop. | 298 // Gets the message loop proxy associated with this message loop. |
296 // | 299 // |
297 // NOTE: Deprecated; prefer task_runner() and the TaskRunner interfaces | 300 // NOTE: Deprecated; prefer task_runner() and the TaskRunner interfaces |
298 scoped_refptr<MessageLoopProxy> message_loop_proxy() { | 301 scoped_refptr<MessageLoopProxy> message_loop_proxy() { |
299 return message_loop_proxy_; | 302 return message_loop_proxy_; |
300 } | 303 } |
301 | 304 |
302 // Gets the TaskRunner associated with this message loop. | 305 // Gets the TaskRunner associated with this message loop. |
| 306 // TODO(skyostil): Change this to return a const reference to a refptr |
| 307 // once the internal type matches what is being returned (crbug.com/465354). |
303 scoped_refptr<SingleThreadTaskRunner> task_runner() { | 308 scoped_refptr<SingleThreadTaskRunner> task_runner() { |
304 return message_loop_proxy_; | 309 return message_loop_proxy_; |
305 } | 310 } |
306 | 311 |
307 // Enables or disables the recursive task processing. This happens in the case | 312 // Enables or disables the recursive task processing. This happens in the case |
308 // of recursive message loops. Some unwanted message loop may occurs when | 313 // of recursive message loops. Some unwanted message loop may occurs when |
309 // using common controls or printer functions. By default, recursive task | 314 // using common controls or printer functions. By default, recursive task |
310 // processing is disabled. | 315 // processing is disabled. |
311 // | 316 // |
312 // Please utilize |ScopedNestableTaskAllower| instead of calling these methods | 317 // Please utilize |ScopedNestableTaskAllower| instead of calling these methods |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 | 654 |
650 // Do not add any member variables to MessageLoopForIO! This is important b/c | 655 // Do not add any member variables to MessageLoopForIO! This is important b/c |
651 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 656 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
652 // data that you need should be stored on the MessageLoop's pump_ instance. | 657 // data that you need should be stored on the MessageLoop's pump_ instance. |
653 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 658 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
654 MessageLoopForIO_should_not_have_extra_member_variables); | 659 MessageLoopForIO_should_not_have_extra_member_variables); |
655 | 660 |
656 } // namespace base | 661 } // namespace base |
657 | 662 |
658 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 663 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |