OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // CancelableTaskTracker posts tasks (in the form of a Closure) to a | 5 // CancelableTaskTracker posts tasks (in the form of a Closure) to a |
6 // TaskRunner, and is able to cancel the task later if it's not needed | 6 // TaskRunner, and is able to cancel the task later if it's not needed |
7 // anymore. On destruction, CancelableTaskTracker will cancel all | 7 // anymore. On destruction, CancelableTaskTracker will cancel all |
8 // tracked tasks. | 8 // tracked tasks. |
9 // | 9 // |
10 // Each cancelable task can be associated with a reply (also a Closure). After | 10 // Each cancelable task can be associated with a reply (also a Closure). After |
(...skipping 21 matching lines...) Expand all Loading... |
32 // 2. Both task and reply are deleted on the originating thread. | 32 // 2. Both task and reply are deleted on the originating thread. |
33 // | 33 // |
34 // 3. IsCanceledCallback is thread safe and can be run or deleted on any | 34 // 3. IsCanceledCallback is thread safe and can be run or deleted on any |
35 // thread. | 35 // thread. |
36 #ifndef BASE_TASK_CANCELABLE_TASK_TRACKER_H_ | 36 #ifndef BASE_TASK_CANCELABLE_TASK_TRACKER_H_ |
37 #define BASE_TASK_CANCELABLE_TASK_TRACKER_H_ | 37 #define BASE_TASK_CANCELABLE_TASK_TRACKER_H_ |
38 | 38 |
39 #include <stdint.h> | 39 #include <stdint.h> |
40 | 40 |
41 #include "base/base_export.h" | 41 #include "base/base_export.h" |
| 42 #include "base/bind.h" |
42 #include "base/callback.h" | 43 #include "base/callback.h" |
43 #include "base/containers/hash_tables.h" | 44 #include "base/containers/hash_tables.h" |
44 #include "base/macros.h" | 45 #include "base/macros.h" |
45 #include "base/memory/weak_ptr.h" | 46 #include "base/memory/weak_ptr.h" |
46 #include "base/task_runner_util.h" | 47 #include "base/post_task_and_reply_with_result_internal.h" |
47 #include "base/threading/thread_checker.h" | 48 #include "base/threading/thread_checker.h" |
48 | 49 |
49 namespace tracked_objects { | 50 namespace tracked_objects { |
50 class Location; | 51 class Location; |
51 } // namespace tracked_objects | 52 } // namespace tracked_objects |
52 | 53 |
53 namespace base { | 54 namespace base { |
54 | 55 |
55 class CancellationFlag; | 56 class CancellationFlag; |
56 class TaskRunner; | 57 class TaskRunner; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 base::ThreadChecker thread_checker_; | 134 base::ThreadChecker thread_checker_; |
134 | 135 |
135 base::WeakPtrFactory<CancelableTaskTracker> weak_factory_; | 136 base::WeakPtrFactory<CancelableTaskTracker> weak_factory_; |
136 | 137 |
137 DISALLOW_COPY_AND_ASSIGN(CancelableTaskTracker); | 138 DISALLOW_COPY_AND_ASSIGN(CancelableTaskTracker); |
138 }; | 139 }; |
139 | 140 |
140 } // namespace base | 141 } // namespace base |
141 | 142 |
142 #endif // BASE_TASK_CANCELABLE_TASK_TRACKER_H_ | 143 #endif // BASE_TASK_CANCELABLE_TASK_TRACKER_H_ |
OLD | NEW |