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

Unified Diff: net/base/file_stream_win.h

Issue 9949011: Make FileStream::Seek async and add FileStream::SeekSync for sync operation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 8 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 | « net/base/file_stream_unittest.cc ('k') | net/base/file_stream_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/file_stream_win.h
diff --git a/net/base/file_stream_win.h b/net/base/file_stream_win.h
index 5b4dd7e806c690424f6b837303e6181db0e2c4cd..8ccf5f251aceabbcdb0a87b48e17e6887754bae1 100644
--- a/net/base/file_stream_win.h
+++ b/net/base/file_stream_win.h
@@ -19,6 +19,10 @@
class FilePath;
+namespace base {
+class WaitableEvent;
+}
+
namespace net {
class IOBuffer;
@@ -36,7 +40,9 @@ class NET_EXPORT FileStreamWin {
const CompletionCallback& callback);
int OpenSync(const FilePath& path, int open_flags);
bool IsOpen() const;
- int64 Seek(Whence whence, int64 offset);
+ int Seek(Whence whence, int64 offset,
+ const Int64CompletionCallback& callback);
+ int64 SeekSync(Whence whence, int64 offset);
int64 Available();
int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback);
int ReadSync(char* buf, int buf_len);
@@ -51,14 +57,23 @@ class NET_EXPORT FileStreamWin {
private:
class AsyncContext;
- friend class AsyncContext;
+
+ // A helper method for Seek.
+ void SeekFile(Whence whence, int64 offset, int64* result);
// Called when the file_ is opened asynchronously. |result| contains the
// result as a network error code.
- void OnOpened(int* result);
+ void OnOpened(const CompletionCallback& callback, int* result);
// Called when the file_ is closed asynchronously.
- void OnClosed();
+ void OnClosed(const CompletionCallback& callback);
+
+ // Called when the file_ is seeked asynchronously.
+ void OnSeeked(const Int64CompletionCallback& callback, int64* result);
+
+ // Resets on_io_complete_ and WeakPtr's.
+ // Called in OnOpened, OnClosed and OnSeeked.
+ void ResetOnIOComplete();
// Waits until the in-flight async open/close operation is complete.
void WaitForIOCompletion();
@@ -73,7 +88,6 @@ class NET_EXPORT FileStreamWin {
bool record_uma_;
net::BoundNetLog bound_net_log_;
base::WeakPtrFactory<FileStreamWin> weak_ptr_factory_;
- CompletionCallback callback_;
scoped_ptr<base::WaitableEvent> on_io_complete_;
DISALLOW_COPY_AND_ASSIGN(FileStreamWin);
« no previous file with comments | « net/base/file_stream_unittest.cc ('k') | net/base/file_stream_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698