| 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/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/sequenced_task_runner_helpers.h" | 10 #include "base/sequenced_task_runner_helpers.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // A simple corollary is that posting a task as non-nestable can | 103 // A simple corollary is that posting a task as non-nestable can |
| 104 // only delay when the task gets run. That is, posting a task as | 104 // only delay when the task gets run. That is, posting a task as |
| 105 // non-nestable may not affect when the task gets run, or it could | 105 // non-nestable may not affect when the task gets run, or it could |
| 106 // make it run later than it normally would, but it won't make it | 106 // make it run later than it normally would, but it won't make it |
| 107 // run earlier than it normally would. | 107 // run earlier than it normally would. |
| 108 | 108 |
| 109 // TODO(akalin): Get rid of the boolean return value for the methods | 109 // TODO(akalin): Get rid of the boolean return value for the methods |
| 110 // below. | 110 // below. |
| 111 | 111 |
| 112 bool PostNonNestableTask(const tracked_objects::Location& from_here, | 112 bool PostNonNestableTask(const tracked_objects::Location& from_here, |
| 113 Closure task); | 113 OnceClosure task); |
| 114 | 114 |
| 115 virtual bool PostNonNestableDelayedTask( | 115 virtual bool PostNonNestableDelayedTask( |
| 116 const tracked_objects::Location& from_here, | 116 const tracked_objects::Location& from_here, |
| 117 Closure task, | 117 OnceClosure task, |
| 118 base::TimeDelta delay) = 0; | 118 base::TimeDelta delay) = 0; |
| 119 | 119 |
| 120 // Submits a non-nestable task to delete the given object. Returns | 120 // Submits a non-nestable task to delete the given object. Returns |
| 121 // true if the object may be deleted at some point in the future, | 121 // true if the object may be deleted at some point in the future, |
| 122 // and false if the object definitely will not be deleted. | 122 // and false if the object definitely will not be deleted. |
| 123 template <class T> | 123 template <class T> |
| 124 bool DeleteSoon(const tracked_objects::Location& from_here, | 124 bool DeleteSoon(const tracked_objects::Location& from_here, |
| 125 const T* object) { | 125 const T* object) { |
| 126 return DeleteOrReleaseSoonInternal(from_here, &DeleteHelper<T>::DoDelete, | 126 return DeleteOrReleaseSoonInternal(from_here, &DeleteHelper<T>::DoDelete, |
| 127 object); | 127 object); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 158 if (ptr) | 158 if (ptr) |
| 159 task_runner_->DeleteSoon(FROM_HERE, ptr); | 159 task_runner_->DeleteSoon(FROM_HERE, ptr); |
| 160 } | 160 } |
| 161 | 161 |
| 162 scoped_refptr<SequencedTaskRunner> task_runner_; | 162 scoped_refptr<SequencedTaskRunner> task_runner_; |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 } // namespace base | 165 } // namespace base |
| 166 | 166 |
| 167 #endif // BASE_SEQUENCED_TASK_RUNNER_H_ | 167 #endif // BASE_SEQUENCED_TASK_RUNNER_H_ |
| OLD | NEW |