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 #include "base/task/cancelable_task_tracker.h" | 5 #include "base/task/cancelable_task_tracker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
17 #include "base/synchronization/cancellation_flag.h" | 17 #include "base/synchronization/cancellation_flag.h" |
18 #include "base/task_runner.h" | 18 #include "base/task_runner.h" |
19 #include "base/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
20 | 20 |
21 using base::Bind; | 21 using base::Bind; |
22 using base::CancellationFlag; | 22 using base::CancellationFlag; |
23 using base::Closure; | 23 using base::Closure; |
24 using base::hash_map; | 24 using base::hash_map; |
25 using base::TaskRunner; | 25 using base::TaskRunner; |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 void RunIfNotCanceled(const CancellationFlag* flag, const Closure& task) { | 29 void RunIfNotCanceled(const CancellationFlag* flag, const Closure& task) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 DCHECK(success); | 182 DCHECK(success); |
183 } | 183 } |
184 | 184 |
185 void CancelableTaskTracker::Untrack(TaskId id) { | 185 void CancelableTaskTracker::Untrack(TaskId id) { |
186 DCHECK(thread_checker_.CalledOnValidThread()); | 186 DCHECK(thread_checker_.CalledOnValidThread()); |
187 size_t num = task_flags_.erase(id); | 187 size_t num = task_flags_.erase(id); |
188 DCHECK_EQ(1u, num); | 188 DCHECK_EQ(1u, num); |
189 } | 189 } |
190 | 190 |
191 } // namespace base | 191 } // namespace base |
OLD | NEW |