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

Unified Diff: net/base/file_stream.h

Issue 10986045: Flush at the end of local file writing in FileWriter API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up. Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/base_file.cc ('k') | net/base/file_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/file_stream.h
diff --git a/net/base/file_stream.h b/net/base/file_stream.h
index 2031bd05912b2a256f08a8c39dbb55ac693c9852..f4cfff293e8599f7c79d1790d0623f34f4511e8b 100644
--- a/net/base/file_stream.h
+++ b/net/base/file_stream.h
@@ -197,10 +197,31 @@ class NET_EXPORT FileStream {
// not have to be called, it just forces one to happen at the time of
// calling.
//
- /// Returns an error code if the operation could not be performed.
+ // The file must be opened with PLATFORM_FILE_ASYNC, and a non-null
+ // callback must be passed to this method. If the write could not
+ // complete synchronously, then ERR_IO_PENDING is returned, and the
+ // callback will be run on the thread where Flush() was called when
+ // the write has completed.
+ //
+ // It is valid to destroy or close the file stream while there is an
+ // asynchronous flush in progress. That will cancel the flush and allow
+ // the buffer to be freed.
+ //
+ // It is invalid to request any asynchronous operations while there is an
+ // in-flight asynchronous operation.
+ //
+ // This method should not be called if the stream was opened READ_ONLY.
+ virtual int Flush(const CompletionCallback& callback);
+
+ // Forces out a filesystem sync on this file to make sure that the file was
+ // written out to disk and is not currently sitting in the buffer. This does
+ // not have to be called, it just forces one to happen at the time of
+ // calling.
+ //
+ // Returns an error code if the operation could not be performed.
//
// This method should not be called if the stream was opened READ_ONLY.
- virtual int Flush();
+ virtual int FlushSync();
// Turns on UMA error statistics gathering.
void EnableErrorStatistics();
« no previous file with comments | « content/browser/download/base_file.cc ('k') | net/base/file_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698