| 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 "chrome/browser/chromeos/file_system_provider/throttled_file_system.h" | 5 #include "chrome/browser/chromeos/file_system_provider/throttled_file_system.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 209 } |
| 210 | 210 |
| 211 void ThrottledFileSystem::OnCloseFileCompleted( | 211 void ThrottledFileSystem::OnCloseFileCompleted( |
| 212 int file_handle, | 212 int file_handle, |
| 213 const storage::AsyncFileUtil::StatusCallback& callback, | 213 const storage::AsyncFileUtil::StatusCallback& callback, |
| 214 base::File::Error result) { | 214 base::File::Error result) { |
| 215 // Closing is always final. Even if an error happened, the file is considered | 215 // Closing is always final. Even if an error happened, the file is considered |
| 216 // closed on the C++ side. Release the task from the queue, so other files | 216 // closed on the C++ side. Release the task from the queue, so other files |
| 217 // which are enqueued can be opened. | 217 // which are enqueued can be opened. |
| 218 const auto it = opened_files_.find(file_handle); | 218 const auto it = opened_files_.find(file_handle); |
| 219 DCHECK(it != opened_files_.end()); | 219 CHECK(it != opened_files_.end()); |
| 220 | 220 |
| 221 const int queue_token = it->second; | 221 const int queue_token = it->second; |
| 222 open_queue_->Remove(queue_token); | 222 open_queue_->Remove(queue_token); |
| 223 opened_files_.erase(file_handle); | 223 opened_files_.erase(file_handle); |
| 224 | 224 |
| 225 callback.Run(result); | 225 callback.Run(result); |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace file_system_provider | 228 } // namespace file_system_provider |
| 229 } // namespace chromeos | 229 } // namespace chromeos |
| OLD | NEW |