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

Unified Diff: net/base/file_stream_posix.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.cc ('k') | net/base/file_stream_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/file_stream_posix.h
diff --git a/net/base/file_stream_posix.h b/net/base/file_stream_posix.h
index a8b919fb38f459d69d219dcc95d8262387f913e1..8187badb5f0075e10beb2cee2cb67d1a40218233 100644
--- a/net/base/file_stream_posix.h
+++ b/net/base/file_stream_posix.h
@@ -10,7 +10,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/synchronization/waitable_event.h"
#include "base/platform_file.h"
#include "net/base/completion_callback.h"
#include "net/base/file_stream_whence.h"
@@ -19,6 +18,10 @@
class FilePath;
+namespace base {
+class WaitableEvent;
+}
+
namespace net {
class IOBuffer;
@@ -36,7 +39,9 @@ class NET_EXPORT FileStreamPosix {
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);
@@ -50,13 +55,13 @@ class NET_EXPORT FileStreamPosix {
const net::BoundNetLog& owner_bound_net_log);
base::PlatformFile GetPlatformFileForTesting();
+ // Resets on_io_complete_ and WeakPtr's.
+ // Called when Read() or Write() is completed.
+ void ResetOnIOComplete();
+
private:
// Called when the file_ is closed asynchronously.
- void OnClosed();
-
- // Called when Read() or Write() is completed (used only for POSIX).
- // |result| contains the result as a network error code.
- void OnIOComplete(int* result);
+ void OnClosed(const CompletionCallback& callback);
// Waits until the in-flight async open/close/read/write operation is
// complete.
@@ -68,7 +73,6 @@ class NET_EXPORT FileStreamPosix {
bool record_uma_;
net::BoundNetLog bound_net_log_;
base::WeakPtrFactory<FileStreamPosix> weak_ptr_factory_;
- CompletionCallback callback_;
scoped_ptr<base::WaitableEvent> on_io_complete_;
DISALLOW_COPY_AND_ASSIGN(FileStreamPosix);
« no previous file with comments | « net/base/file_stream.cc ('k') | net/base/file_stream_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698