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

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

Issue 2122543002: Replace Closure in TaskRunner::PostTask with OneShotCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@07_oneshot
Patch Set: fix Created 4 years, 3 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 | « base/message_loop/incoming_task_queue.cc ('k') | 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 <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // 198 //
199 // The MessageLoop takes ownership of the Task, and deletes it after it has 199 // The MessageLoop takes ownership of the Task, and deletes it after it has
200 // been Run(). 200 // been Run().
201 // 201 //
202 // PostTask(from_here, task) is equivalent to 202 // PostTask(from_here, task) is equivalent to
203 // PostDelayedTask(from_here, task, 0). 203 // PostDelayedTask(from_here, task, 0).
204 // 204 //
205 // NOTE: These methods may be called on any thread. The Task will be invoked 205 // NOTE: These methods may be called on any thread. The Task will be invoked
206 // on the thread that executes MessageLoop::Run(). 206 // on the thread that executes MessageLoop::Run().
207 void PostTask(const tracked_objects::Location& from_here, 207 void PostTask(const tracked_objects::Location& from_here,
208 const Closure& task); 208 OnceClosure task);
209 209
210 void PostDelayedTask(const tracked_objects::Location& from_here, 210 void PostDelayedTask(const tracked_objects::Location& from_here,
211 const Closure& task, 211 OnceClosure task,
212 TimeDelta delay); 212 TimeDelta delay);
213 213
214 // A variant on PostTask that deletes the given object. This is useful 214 // A variant on PostTask that deletes the given object. This is useful
215 // if the object needs to live until the next run of the MessageLoop (for 215 // if the object needs to live until the next run of the MessageLoop (for
216 // example, deleting a RenderProcessHost from within an IPC callback is not 216 // example, deleting a RenderProcessHost from within an IPC callback is not
217 // good). 217 // good).
218 // 218 //
219 // NOTE: This method may be called on any thread. The object will be deleted 219 // NOTE: This method may be called on any thread. The object will be deleted
220 // on the thread that executes MessageLoop::Run(). 220 // on the thread that executes MessageLoop::Run().
221 template <class T> 221 template <class T>
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 bool HasHighResolutionTasks(); 403 bool HasHighResolutionTasks();
404 404
405 // Returns true if the message loop is "idle". Provided for testing. 405 // Returns true if the message loop is "idle". Provided for testing.
406 bool IsIdleForTesting(); 406 bool IsIdleForTesting();
407 407
408 // Returns the TaskAnnotator which is used to add debug information to posted 408 // Returns the TaskAnnotator which is used to add debug information to posted
409 // tasks. 409 // tasks.
410 debug::TaskAnnotator* task_annotator() { return &task_annotator_; } 410 debug::TaskAnnotator* task_annotator() { return &task_annotator_; }
411 411
412 // Runs the specified PendingTask. 412 // Runs the specified PendingTask.
413 void RunTask(const PendingTask& pending_task); 413 void RunTask(PendingTask pending_task);
414 414
415 #if defined(OS_WIN) 415 #if defined(OS_WIN)
416 // TODO (stanisc): crbug.com/596190: Remove this after the signaling issue 416 // TODO (stanisc): crbug.com/596190: Remove this after the signaling issue
417 // has been investigated. 417 // has been investigated.
418 // This should be used for diagnostic only. If message pump wake-up mechanism 418 // This should be used for diagnostic only. If message pump wake-up mechanism
419 // is based on auto-reset event this call would reset the event to unset 419 // is based on auto-reset event this call would reset the event to unset
420 // state. 420 // state.
421 bool MessagePumpWasSignaled(); 421 bool MessagePumpWasSignaled();
422 #endif 422 #endif
423 423
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 726
727 // Do not add any member variables to MessageLoopForIO! This is important b/c 727 // Do not add any member variables to MessageLoopForIO! This is important b/c
728 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 728 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
729 // data that you need should be stored on the MessageLoop's pump_ instance. 729 // data that you need should be stored on the MessageLoop's pump_ instance.
730 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 730 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
731 "MessageLoopForIO should not have extra member variables"); 731 "MessageLoopForIO should not have extra member variables");
732 732
733 } // namespace base 733 } // namespace base
734 734
735 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 735 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « base/message_loop/incoming_task_queue.cc ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698