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

Side by Side Diff: base/message_loop_proxy.h

Issue 9086002: base::Bind: Remove Task. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style fix. Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/message_loop.cc ('k') | base/message_loop_proxy_impl.h » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_PROXY_H_ 5 #ifndef BASE_MESSAGE_LOOP_PROXY_H_
6 #define BASE_MESSAGE_LOOP_PROXY_H_ 6 #define BASE_MESSAGE_LOOP_PROXY_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/base_export.h" 9 #include "base/base_export.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 15 matching lines...) Expand all
26 // MessageLoopProxy objects are constructed automatically for all MessageLoops. 26 // MessageLoopProxy objects are constructed automatically for all MessageLoops.
27 // So, to access them, you can use any of the following: 27 // So, to access them, you can use any of the following:
28 // Thread::message_loop_proxy() 28 // Thread::message_loop_proxy()
29 // MessageLoop::current()->message_loop_proxy() 29 // MessageLoop::current()->message_loop_proxy()
30 // MessageLoopProxy::current() 30 // MessageLoopProxy::current()
31 class BASE_EXPORT MessageLoopProxy 31 class BASE_EXPORT MessageLoopProxy
32 : public base::RefCountedThreadSafe<MessageLoopProxy, 32 : public base::RefCountedThreadSafe<MessageLoopProxy,
33 MessageLoopProxyTraits> { 33 MessageLoopProxyTraits> {
34 public: 34 public:
35 // These methods are the same as in message_loop.h, but are guaranteed to 35 // These methods are the same as in message_loop.h, but are guaranteed to
36 // either post the Task to the MessageLoop (if it's still alive), or to 36 // either post the Task to the MessageLoop (if it's still alive), or the task
37 // delete the Task otherwise. 37 // is discarded.
38 // They return true iff the thread existed and the task was posted. Note that 38 // They return true iff the thread existed and the task was posted. Note that
39 // even if the task is posted, there's no guarantee that it will run; for 39 // even if the task is posted, there's no guarantee that it will run; for
40 // example the target loop may already be quitting, or in the case of a 40 // example the target loop may already be quitting, or in the case of a
41 // delayed task a Quit message may preempt it in the message loop queue. 41 // delayed task a Quit message may preempt it in the message loop queue.
42 // Conversely, a return value of false is a guarantee the task will not run. 42 // Conversely, a return value of false is a guarantee the task will not run.
43 virtual bool PostTask(const tracked_objects::Location& from_here, 43 virtual bool PostTask(const tracked_objects::Location& from_here,
44 Task* task) = 0;
45 virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
46 Task* task,
47 int64 delay_ms) = 0;
48 virtual bool PostNonNestableTask(const tracked_objects::Location& from_here,
49 Task* task) = 0;
50 virtual bool PostNonNestableDelayedTask(
51 const tracked_objects::Location& from_here,
52 Task* task,
53 int64 delay_ms) = 0;
54
55 // TODO(ajwong): Remove the functions above once the Task -> Closure migration
56 // is complete.
57 //
58 // There are 2 sets of Post*Task functions, one which takes the older Task*
59 // function object representation, and one that takes the newer base::Closure.
60 // We have this overload to allow a staged transition between the two systems.
61 // Once the transition is done, the functions above should be deleted.
62 virtual bool PostTask(const tracked_objects::Location& from_here,
63 const base::Closure& task) = 0; 44 const base::Closure& task) = 0;
64 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, 45 virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
65 const base::Closure& task, 46 const base::Closure& task,
66 int64 delay_ms) = 0; 47 int64 delay_ms) = 0;
67 virtual bool PostNonNestableTask(const tracked_objects::Location& from_here, 48 virtual bool PostNonNestableTask(const tracked_objects::Location& from_here,
68 const base::Closure& task) = 0; 49 const base::Closure& task) = 0;
69 virtual bool PostNonNestableDelayedTask( 50 virtual bool PostNonNestableDelayedTask(
70 const tracked_objects::Location& from_here, 51 const tracked_objects::Location& from_here,
71 const base::Closure& task, 52 const base::Closure& task,
72 int64 delay_ms) = 0; 53 int64 delay_ms) = 0;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 142
162 struct MessageLoopProxyTraits { 143 struct MessageLoopProxyTraits {
163 static void Destruct(const MessageLoopProxy* proxy) { 144 static void Destruct(const MessageLoopProxy* proxy) {
164 proxy->OnDestruct(); 145 proxy->OnDestruct();
165 } 146 }
166 }; 147 };
167 148
168 } // namespace base 149 } // namespace base
169 150
170 #endif // BASE_MESSAGE_LOOP_PROXY_H_ 151 #endif // BASE_MESSAGE_LOOP_PROXY_H_
OLDNEW
« no previous file with comments | « base/message_loop.cc ('k') | base/message_loop_proxy_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698