Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: chrome/browser/chromeos/file_system_provider/throttled_file_system.cc

Issue 968763002: Fix aborting in throttled file system (FSP). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/file_system_provider/queue_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if (result != base::File::FILE_ERROR_ABORT) 198 // The task may be aborted either via the callback, or by the operation, eg.
199 // because of destroying the request manager or unmounting the file system
200 // during the operation. Mark the task as completed only if it hasn't been
201 // aborted before.
202 if (!open_queue_->IsAborted(queue_token))
199 open_queue_->Complete(queue_token); 203 open_queue_->Complete(queue_token);
200 204
201 // If the file is opened successfully then hold the queue token until the file 205 // If the file is opened successfully then hold the queue token until the file
202 // is closed. 206 // is closed.
203 if (result == base::File::FILE_OK) 207 if (result == base::File::FILE_OK)
204 opened_files_[file_handle] = queue_token; 208 opened_files_[file_handle] = queue_token;
205 else 209 else
206 open_queue_->Remove(queue_token); 210 open_queue_->Remove(queue_token);
207 211
208 callback.Run(file_handle, result); 212 callback.Run(file_handle, result);
(...skipping 11 matching lines...) Expand all
220 224
221 const int queue_token = it->second; 225 const int queue_token = it->second;
222 open_queue_->Remove(queue_token); 226 open_queue_->Remove(queue_token);
223 opened_files_.erase(file_handle); 227 opened_files_.erase(file_handle);
224 228
225 callback.Run(result); 229 callback.Run(result);
226 } 230 }
227 231
228 } // namespace file_system_provider 232 } // namespace file_system_provider
229 } // namespace chromeos 233 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_system_provider/queue_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698