diff options
author | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-01 05:54:26 +0000 |
---|---|---|
committer | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-01 05:54:26 +0000 |
commit | a95ce07699b8ce79df8b59e36fe53b345a5921b2 (patch) | |
tree | c4b54622b37e7aa21e004e3570b6fb6299b00973 /webkit/fileapi/file_stream_writer.h | |
parent | 2f729cd95a5452af56269f594ffbe4f539303182 (diff) | |
download | chromium_src-a95ce07699b8ce79df8b59e36fe53b345a5921b2.zip chromium_src-a95ce07699b8ce79df8b59e36fe53b345a5921b2.tar.gz chromium_src-a95ce07699b8ce79df8b59e36fe53b345a5921b2.tar.bz2 |
Flush at the end of local file writing in FileWriter API.
This CL ensures the written content is flushed physically before
fileWriter.write() invokes the "onwriteend" event, for native local files.
Remote files (Google Drive files in Chrome OS) nor FileSystem API
files (in PERSISTENT or TEMPORARY storage) aren't affected.
The summary of the changes:
* Call Flush() before the final callback.
(webkit/fileapi/file_writer_delegate.cc)
* Delegate Flush() to net::FileStream::Flush
(webkit/fileapi/local_file_stream_writer.cc)
* No-op implementation for Flush().
(webkit/fileapi/sanbox_file_stream_writer.cc)
(webkit/chromeos/fileapi/remote_file_stream_writer.cc)
* Implementation of asynchronous Flush.
(net/base/file_stream_{posix,win}.cc)
* Other files are just for reflecting the rename Flush -> FlushSync.
BUG=144790
R=willchan@chromium.org,kinuko@chromium.org,benjhayden@chromium.org
TBR=marja@chromium.org
TEST=out/Debug/browser_tests --gtest_filter='*FileSystemApi*'
TEST=./webkit/tools/layout_tests/run_webkit_tests.sh fast/filesystem
TEST=Manual steps reported in the issue.
Review URL: https://codereview.chromium.org/10986045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159454 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_stream_writer.h')
-rw-r--r-- | webkit/fileapi/file_stream_writer.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/webkit/fileapi/file_stream_writer.h b/webkit/fileapi/file_stream_writer.h index 967d501..f3f6398 100644 --- a/webkit/fileapi/file_stream_writer.h +++ b/webkit/fileapi/file_stream_writer.h @@ -55,6 +55,16 @@ class FILEAPI_EXPORT_PRIVATE FileStreamWriter { // operation is dismissed immediately when Cancel() is called, and thus // will never be called. virtual int Cancel(const net::CompletionCallback& callback) = 0; + + // Flushes the data written so far. + // + // If the flush finished synchronously, it return net::OK. If the flush could + // not be performed, it returns an error code. Otherwise, net::ERR_IO_PENDING + // is returned, and the callback will be run on the thread where Flush() was + // called when the flush has completed. + // + // It is invalid to call Flush while there is an in-flight async operation. + virtual int Flush(const net::CompletionCallback& callback) = 0; }; } // namespace fileapi |