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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 | 189 |
190 void ThrottledFileSystem::Abort(int queue_token) { | 190 void ThrottledFileSystem::Abort(int queue_token) { |
191 open_queue_->Abort(queue_token); | 191 open_queue_->Abort(queue_token); |
192 } | 192 } |
193 | 193 |
194 void ThrottledFileSystem::OnOpenFileCompleted(int queue_token, | 194 void ThrottledFileSystem::OnOpenFileCompleted(int queue_token, |
195 const OpenFileCallback& callback, | 195 const OpenFileCallback& callback, |
196 int file_handle, | 196 int file_handle, |
197 base::File::Error result) { | 197 base::File::Error result) { |
198 open_queue_->Complete(queue_token); | 198 if (result != base::File::FILE_ERROR_ABORT) |
| 199 open_queue_->Complete(queue_token); |
199 | 200 |
200 // If the file is opened successfully then hold the queue token until the file | 201 // If the file is opened successfully then hold the queue token until the file |
201 // is closed. | 202 // is closed. |
202 if (result == base::File::FILE_OK) | 203 if (result == base::File::FILE_OK) |
203 opened_files_[file_handle] = queue_token; | 204 opened_files_[file_handle] = queue_token; |
204 else | 205 else |
205 open_queue_->Remove(queue_token); | 206 open_queue_->Remove(queue_token); |
206 | 207 |
207 callback.Run(file_handle, result); | 208 callback.Run(file_handle, result); |
208 } | 209 } |
(...skipping 10 matching lines...) Expand all Loading... |
219 | 220 |
220 const int queue_token = it->second; | 221 const int queue_token = it->second; |
221 open_queue_->Remove(queue_token); | 222 open_queue_->Remove(queue_token); |
222 opened_files_.erase(file_handle); | 223 opened_files_.erase(file_handle); |
223 | 224 |
224 callback.Run(result); | 225 callback.Run(result); |
225 } | 226 } |
226 | 227 |
227 } // namespace file_system_provider | 228 } // namespace file_system_provider |
228 } // namespace chromeos | 229 } // namespace chromeos |
OLD | NEW |