OLD | NEW |
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_SEQUENCED_TASK_RUNNER_H_ | 5 #ifndef BASE_SEQUENCED_TASK_RUNNER_H_ |
6 #define BASE_SEQUENCED_TASK_RUNNER_H_ | 6 #define BASE_SEQUENCED_TASK_RUNNER_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/sequenced_task_runner_helpers.h" | 9 #include "base/sequenced_task_runner_helpers.h" |
10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // A simple corollary is that posting a task as non-nestable can | 102 // A simple corollary is that posting a task as non-nestable can |
103 // only delay when the task gets run. That is, posting a task as | 103 // only delay when the task gets run. That is, posting a task as |
104 // non-nestable may not affect when the task gets run, or it could | 104 // non-nestable may not affect when the task gets run, or it could |
105 // make it run later than it normally would, but it won't make it | 105 // make it run later than it normally would, but it won't make it |
106 // run earlier than it normally would. | 106 // run earlier than it normally would. |
107 | 107 |
108 // TODO(akalin): Get rid of the boolean return value for the methods | 108 // TODO(akalin): Get rid of the boolean return value for the methods |
109 // below. | 109 // below. |
110 | 110 |
111 bool PostNonNestableTask(const tracked_objects::Location& from_here, | 111 bool PostNonNestableTask(const tracked_objects::Location& from_here, |
112 const Closure& task); | 112 OnceClosure task); |
113 | 113 |
114 virtual bool PostNonNestableDelayedTask( | 114 virtual bool PostNonNestableDelayedTask( |
115 const tracked_objects::Location& from_here, | 115 const tracked_objects::Location& from_here, |
116 const Closure& task, | 116 OnceClosure task, |
117 base::TimeDelta delay) = 0; | 117 base::TimeDelta delay) = 0; |
118 | 118 |
119 // Submits a non-nestable task to delete the given object. Returns | 119 // Submits a non-nestable task to delete the given object. Returns |
120 // true if the object may be deleted at some point in the future, | 120 // true if the object may be deleted at some point in the future, |
121 // and false if the object definitely will not be deleted. | 121 // and false if the object definitely will not be deleted. |
122 template <class T> | 122 template <class T> |
123 bool DeleteSoon(const tracked_objects::Location& from_here, | 123 bool DeleteSoon(const tracked_objects::Location& from_here, |
124 const T* object) { | 124 const T* object) { |
125 return | 125 return |
126 subtle::DeleteHelperInternal<T, bool>::DeleteViaSequencedTaskRunner( | 126 subtle::DeleteHelperInternal<T, bool>::DeleteViaSequencedTaskRunner( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 else if (ptr) | 168 else if (ptr) |
169 task_runner_->DeleteSoon(FROM_HERE, ptr); | 169 task_runner_->DeleteSoon(FROM_HERE, ptr); |
170 } | 170 } |
171 | 171 |
172 scoped_refptr<SequencedTaskRunner> task_runner_; | 172 scoped_refptr<SequencedTaskRunner> task_runner_; |
173 }; | 173 }; |
174 | 174 |
175 } // namespace base | 175 } // namespace base |
176 | 176 |
177 #endif // BASE_SEQUENCED_TASK_RUNNER_H_ | 177 #endif // BASE_SEQUENCED_TASK_RUNNER_H_ |
OLD | NEW |