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

Side by Side Diff: base/task_runner.h

Issue 1048373003: CancelableTaskTracker::PostDelayedTask() support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
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_TASK_RUNNER_H_ 5 #ifndef BASE_TASK_RUNNER_H_
6 #define BASE_TASK_RUNNER_H_ 6 #define BASE_TASK_RUNNER_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // * Results of |task| are shared with |reply| by binding a shared argument 121 // * Results of |task| are shared with |reply| by binding a shared argument
122 // (a DataBuffer instance). 122 // (a DataBuffer instance).
123 // * The DataLoader object has no special thread safety. 123 // * The DataLoader object has no special thread safety.
124 // * The DataLoader object can be deleted while |task| is still running, 124 // * The DataLoader object can be deleted while |task| is still running,
125 // and the reply will cancel itself safely because it is bound to a 125 // and the reply will cancel itself safely because it is bound to a
126 // WeakPtr<>. 126 // WeakPtr<>.
127 bool PostTaskAndReply(const tracked_objects::Location& from_here, 127 bool PostTaskAndReply(const tracked_objects::Location& from_here,
128 const Closure& task, 128 const Closure& task,
129 const Closure& reply); 129 const Closure& reply);
130 130
131 bool PostDelayedTaskAndReply(const tracked_objects::Location& from_here,
132 const Closure& task,
133 const Closure& reply,
134 TimeDelta delay);
135
131 protected: 136 protected:
132 friend struct TaskRunnerTraits; 137 friend struct TaskRunnerTraits;
133 138
134 // Only the Windows debug build seems to need this: see 139 // Only the Windows debug build seems to need this: see
135 // http://crbug.com/112250. 140 // http://crbug.com/112250.
136 friend class RefCountedThreadSafe<TaskRunner, TaskRunnerTraits>; 141 friend class RefCountedThreadSafe<TaskRunner, TaskRunnerTraits>;
137 142
138 TaskRunner(); 143 TaskRunner();
139 virtual ~TaskRunner(); 144 virtual ~TaskRunner();
140 145
141 // Called when this object should be destroyed. By default simply 146 // Called when this object should be destroyed. By default simply
142 // deletes |this|, but can be overridden to do something else, like 147 // deletes |this|, but can be overridden to do something else, like
143 // delete on a certain thread. 148 // delete on a certain thread.
144 virtual void OnDestruct() const; 149 virtual void OnDestruct() const;
145 }; 150 };
146 151
147 struct BASE_EXPORT TaskRunnerTraits { 152 struct BASE_EXPORT TaskRunnerTraits {
148 static void Destruct(const TaskRunner* task_runner); 153 static void Destruct(const TaskRunner* task_runner);
149 }; 154 };
150 155
151 } // namespace base 156 } // namespace base
152 157
153 #endif // BASE_TASK_RUNNER_H_ 158 #endif // BASE_TASK_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698