Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Side by Side Diff: base/message_loop/message_loop.h

Issue 1013813003: base: Mark MessageLoop::Post*Task API deprecated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add TODO to task_runner(). Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/message_loop/message_loop.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698