OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/location.h" | 6 #include "base/location.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "chrome/browser/chromeos/file_system_provider/queue.h" | 10 #include "chrome/browser/chromeos/file_system_provider/queue.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 FROM_HERE, | 118 FROM_HERE, |
119 base::Bind(&Queue::MaybeRun, weak_ptr_factory_.GetWeakPtr())); | 119 base::Bind(&Queue::MaybeRun, weak_ptr_factory_.GetWeakPtr())); |
120 return; | 120 return; |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 // The task is already removed, marked as completed or aborted. | 124 // The task is already removed, marked as completed or aborted. |
125 NOTREACHED(); | 125 NOTREACHED(); |
126 } | 126 } |
127 | 127 |
| 128 bool Queue::IsAborted(size_t token) { |
| 129 #if !NDEBUG |
| 130 bool in_queue = executed_.find(token) != executed_.end() || |
| 131 completed_.find(token) != completed_.end() || |
| 132 aborted_.find(token) != aborted_.end(); |
| 133 for (auto& task : pending_) { |
| 134 if (token == task.token) { |
| 135 in_queue = true; |
| 136 break; |
| 137 } |
| 138 } |
| 139 DCHECK(in_queue); |
| 140 #endif |
| 141 return aborted_.find(token) != aborted_.end(); |
| 142 } |
| 143 |
128 } // namespace file_system_provider | 144 } // namespace file_system_provider |
129 } // namespace chromeos | 145 } // namespace chromeos |
OLD | NEW |