| 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" |
| 11 | 11 |
| 12 namespace chromeos { | 12 namespace chromeos { |
| 13 namespace file_system_provider { | 13 namespace file_system_provider { |
| 14 | 14 |
| 15 struct Queue::Task { | 15 Queue::Task::Task() : token(0), completed(false) { |
| 16 Task() : token(0), completed(false) {} | 16 } |
| 17 Task(size_t token, const AbortableCallback& callback) | |
| 18 : token(token), completed(false), callback(callback) {} | |
| 19 | 17 |
| 20 size_t token; | 18 Queue::Task::Task(size_t token, const AbortableCallback& callback) |
| 21 bool completed; | 19 : token(token), completed(false), callback(callback) { |
| 22 AbortableCallback callback; | 20 } |
| 23 AbortCallback abort_callback; | 21 |
| 24 }; | 22 Queue::Task::~Task() { |
| 23 } |
| 25 | 24 |
| 26 Queue::Queue(size_t max_in_parallel) | 25 Queue::Queue(size_t max_in_parallel) |
| 27 : max_in_parallel_(max_in_parallel), | 26 : max_in_parallel_(max_in_parallel), |
| 28 next_token_(1), | 27 next_token_(1), |
| 29 weak_ptr_factory_(this) { | 28 weak_ptr_factory_(this) { |
| 30 DCHECK_LT(0u, max_in_parallel); | 29 DCHECK_LT(0u, max_in_parallel); |
| 31 } | 30 } |
| 32 | 31 |
| 33 Queue::~Queue() { | 32 Queue::~Queue() { |
| 34 } | 33 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return; | 109 return; |
| 111 } | 110 } |
| 112 } | 111 } |
| 113 | 112 |
| 114 // The task is already removed. | 113 // The task is already removed. |
| 115 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | 114 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
| 116 } | 115 } |
| 117 | 116 |
| 118 } // namespace file_system_provider | 117 } // namespace file_system_provider |
| 119 } // namespace chromeos | 118 } // namespace chromeos |
| OLD | NEW |