Commit c754ff6f authored by mtomasz@chromium.org's avatar mtomasz@chromium.org

[fsp] Do not allow to cancel closing a file.

Closing a file should not be abortable, since we could end up on files which
once opened, are never closed.

TEST=browser_tests: *FileSystemProvider*WriteFile*
BUG=405821

Review URL: https://codereview.chromium.org/497673002

Cr-Commit-Position: refs/heads/master@{#291381}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291381 0039d316-1c4b-4281-b951-d872f2087c98
parent 43d3b1c3
......@@ -59,8 +59,10 @@ class FileStreamWriter::OperationRunner
void CloseFileOnUIThread() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (file_system_.get() && file_handle_ != -1) {
abort_callback_ = file_system_->CloseFile(
file_handle_, base::Bind(&EmptyStatusCallback));
// Closing a file must not be aborted, since we could end up on files
// which are never closed.
file_system_->CloseFile(file_handle_, base::Bind(&EmptyStatusCallback));
abort_callback_ = ProvidedFileSystemInterface::AbortCallback();
}
}
......@@ -96,12 +98,11 @@ class FileStreamWriter::OperationRunner
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (abort_callback_.is_null()) {
// No operation on the file system being performed. At most a callback
// call, which will be discarded.
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
base::Bind(callback, base::File::FILE_ERROR_ABORT));
// No operation to be cancelled. At most a callback call, which will be
// discarded.
BrowserThread::PostTask(BrowserThread::IO,
FROM_HERE,
base::Bind(callback, base::File::FILE_OK));
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment