summaryrefslogtreecommitdiffstats
path: root/net/base/file_stream_win.h
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-01 05:54:26 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-01 05:54:26 +0000
commita95ce07699b8ce79df8b59e36fe53b345a5921b2 (patch)
treec4b54622b37e7aa21e004e3570b6fb6299b00973 /net/base/file_stream_win.h
parent2f729cd95a5452af56269f594ffbe4f539303182 (diff)
downloadchromium_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 'net/base/file_stream_win.h')
-rw-r--r--net/base/file_stream_win.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/base/file_stream_win.h b/net/base/file_stream_win.h
index 4feb7a2..e241f4c 100644
--- a/net/base/file_stream_win.h
+++ b/net/base/file_stream_win.h
@@ -49,7 +49,8 @@ class NET_EXPORT FileStreamWin {
int Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback);
int WriteSync(const char* buf, int buf_len);
int64 Truncate(int64 bytes);
- int Flush();
+ int Flush(const CompletionCallback& callback);
+ int FlushSync();
void EnableErrorStatistics();
void SetBoundNetLogSource(const net::BoundNetLog& owner_bound_net_log);
base::PlatformFile GetPlatformFileForTesting();
@@ -60,6 +61,9 @@ class NET_EXPORT FileStreamWin {
// A helper method for Seek.
void SeekFile(Whence whence, int64 offset, int64* result);
+ // A helper method for Flush.
+ void FlushFile(int* result);
+
// Called when the file_ is opened asynchronously. |result| contains the
// result as a network error code.
void OnOpened(const CompletionCallback& callback, int* result);
@@ -70,6 +74,9 @@ class NET_EXPORT FileStreamWin {
// Called when the file_ is seeked asynchronously.
void OnSeeked(const Int64CompletionCallback& callback, int64* result);
+ // Called when the file_ is flushed asynchronously.
+ void OnFlushed(const CompletionCallback& callback, int* result);
+
// Resets on_io_complete_ and WeakPtr's.
// Called in OnOpened, OnClosed and OnSeeked.
void ResetOnIOComplete();