| 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 #include "chrome/common/cancelable_task_tracker.h" | 5 #include "chrome/common/cancelable_task_tracker.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/callback_helpers.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/message_loop/message_loop_proxy.h" | 14 #include "base/message_loop/message_loop_proxy.h" |
| 15 #include "base/synchronization/cancellation_flag.h" | 15 #include "base/synchronization/cancellation_flag.h" |
| 16 #include "base/task_runner.h" | 16 #include "base/task_runner.h" |
| 17 | 17 |
| 18 using base::Bind; | 18 using base::Bind; |
| 19 using base::CancellationFlag; | 19 using base::CancellationFlag; |
| 20 using base::Closure; | 20 using base::Closure; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 bool success = task_flags_.insert(std::make_pair(id, flag)).second; | 175 bool success = task_flags_.insert(std::make_pair(id, flag)).second; |
| 176 DCHECK(success); | 176 DCHECK(success); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void CancelableTaskTracker::Untrack(TaskId id) { | 179 void CancelableTaskTracker::Untrack(TaskId id) { |
| 180 DCHECK(thread_checker_.CalledOnValidThread()); | 180 DCHECK(thread_checker_.CalledOnValidThread()); |
| 181 size_t num = task_flags_.erase(id); | 181 size_t num = task_flags_.erase(id); |
| 182 DCHECK_EQ(1u, num); | 182 DCHECK_EQ(1u, num); |
| 183 } | 183 } |
| OLD | NEW |