Index: net/base/file_stream.h |
diff --git a/net/base/file_stream.h b/net/base/file_stream.h |
index 57011b77decb8103fee14803db14c5e3046df764..9229a89f99f3ba78d1837b8560cc8b1ce8351027 100644 |
--- a/net/base/file_stream.h |
+++ b/net/base/file_stream.h |
@@ -12,7 +12,6 @@ |
#include "base/files/file.h" |
#include "net/base/completion_callback.h" |
-#include "net/base/file_stream_whence.h" |
#include "net/base/net_export.h" |
namespace base { |
@@ -69,7 +68,7 @@ class NET_EXPORT FileStream { |
// relative to the start of the file. Otherwise, an error code is returned. |
// It is invalid to request any asynchronous operations while there is an |
// in-flight asynchronous operation. |
- virtual int Seek(Whence whence, int64 offset, |
+ virtual int Seek(base::File::Whence whence, int64 offset, |
const Int64CompletionCallback& callback); |
// Call this method to read data from the current stream position |
@@ -95,6 +94,15 @@ class NET_EXPORT FileStream { |
virtual int Read(IOBuffer* buf, int buf_len, |
const CompletionCallback& callback); |
+ // Same as Read, but delays starting the operation until it should complete |
+ // without blocking, reducing the load on the task_runner. It is the caller's |
+ // responsibility to determine if using non-blocking IO is appropriate or not. |
+ // For example, using this with regular files will most likely hang on POSIX. |
+ // This method does the same as Read on Windows, as Read uses async IO instead |
+ // of blocking IO. |
+ virtual int ReadNonBlocking(IOBuffer* buf, int buf_len, |
+ const CompletionCallback& callback); |
+ |
// Call this method to write data at the current stream position |
// asynchronously. Up to buf_len bytes will be written from buf. (In |
// other words, partial writes are allowed.) Returns the number of |
@@ -120,6 +128,15 @@ class NET_EXPORT FileStream { |
virtual int Write(IOBuffer* buf, int buf_len, |
const CompletionCallback& callback); |
+ // Same as Write, but delays starting the operation until it should complete |
+ // without blocking, reducing the load on the task_runner. It is the caller's |
+ // responsibility to determine if using non-blocking IO is appropriate or not. |
+ // For example, using this with regular files will most likely hang on POSIX. |
+ // This method does the same as Write on Windows, as Write uses async IO |
+ // instead of blocking IO. |
+ virtual int WriteNonBlocking(IOBuffer* buf, int buf_len, |
+ 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 |