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

Unified Diff: net/base/file_stream_context.h

Issue 323683002: net: FileStream cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove new methods Created 6 years, 6 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
Index: net/base/file_stream_context.h
diff --git a/net/base/file_stream_context.h b/net/base/file_stream_context.h
index c4a06ee1de62c4168675ae47d3150fc65069670b..74f47c42a7effc050e0305249336f6af4357913c 100644
--- a/net/base/file_stream_context.h
+++ b/net/base/file_stream_context.h
@@ -33,7 +33,6 @@
#include "base/task_runner.h"
#include "net/base/completion_callback.h"
#include "net/base/file_stream.h"
-#include "net/base/file_stream_whence.h"
#if defined(OS_POSIX)
#include <errno.h>
@@ -66,17 +65,13 @@ class FileStream::Context {
~Context();
#endif
- int ReadAsync(IOBuffer* buf,
- int buf_len,
- const CompletionCallback& callback);
+ int Read(IOBuffer* buf,
+ int buf_len,
+ const CompletionCallback& callback);
- int WriteAsync(IOBuffer* buf,
- int buf_len,
- const CompletionCallback& callback);
-
- ////////////////////////////////////////////////////////////////////////////
- // Inline methods.
- ////////////////////////////////////////////////////////////////////////////
+ int Write(IOBuffer* buf,
+ int buf_len,
+ const CompletionCallback& callback);
const base::File& file() const { return file_; }
bool async_in_progress() const { return async_in_progress_; }
@@ -90,23 +85,19 @@ class FileStream::Context {
// not closed yet.
void Orphan();
- void OpenAsync(const base::FilePath& path,
- int open_flags,
- const CompletionCallback& callback);
+ void Open(const base::FilePath& path,
+ int open_flags,
+ const CompletionCallback& callback);
- void CloseAsync(const CompletionCallback& callback);
+ void Close(const CompletionCallback& callback);
- void SeekAsync(Whence whence,
- int64 offset,
- const Int64CompletionCallback& callback);
+ void Seek(base::File::Whence whence,
+ int64 offset,
+ const Int64CompletionCallback& callback);
- void FlushAsync(const CompletionCallback& callback);
+ void Flush(const CompletionCallback& callback);
private:
- ////////////////////////////////////////////////////////////////////////////
- // Platform-independent methods implemented in file_stream_context.cc.
- ////////////////////////////////////////////////////////////////////////////
-
struct IOResult {
IOResult();
IOResult(int64 result, int os_error);
@@ -129,10 +120,16 @@ class FileStream::Context {
IOResult error_code;
};
+ ////////////////////////////////////////////////////////////////////////////
+ // Platform-independent methods implemented in file_stream_context.cc.
+ ////////////////////////////////////////////////////////////////////////////
+
OpenResult OpenFileImpl(const base::FilePath& path, int open_flags);
IOResult CloseFileImpl();
+ IOResult FlushFileImpl();
+
void OnOpenCompleted(const CompletionCallback& callback,
OpenResult open_result);
@@ -140,37 +137,20 @@ class FileStream::Context {
Int64CompletionCallback IntToInt64(const CompletionCallback& callback);
- // Called when asynchronous Open() or Seek()
- // is completed. |result| contains the result or a network error code.
+ // Called when Open() or Seek() completes. |result| contains the result or a
+ // network error code.
void OnAsyncCompleted(const Int64CompletionCallback& callback,
const IOResult& result);
////////////////////////////////////////////////////////////////////////////
- // Helper stuff which is platform-dependent but is used in the platform-
- // independent code implemented in file_stream_context.cc. These helpers were
- // introduced solely to implement as much of the Context methods as
- // possible independently from platform.
- ////////////////////////////////////////////////////////////////////////////
-
-#if defined(OS_WIN)
- int GetLastErrno() { return GetLastError(); }
- void OnAsyncFileOpened();
-#elif defined(OS_POSIX)
- int GetLastErrno() { return errno; }
- void OnAsyncFileOpened() {}
- void CancelIo(base::PlatformFile) {}
-#endif
-
- ////////////////////////////////////////////////////////////////////////////
// Platform-dependent methods implemented in
// file_stream_context_{win,posix}.cc.
////////////////////////////////////////////////////////////////////////////
// Adjusts the position from where the data is read.
- IOResult SeekFileImpl(Whence whence, int64 offset);
+ IOResult SeekFileImpl(base::File::Whence whence, int64 offset);
- // Flushes all data written to the stream.
- IOResult FlushFileImpl();
+ void OnFileOpened();
#if defined(OS_WIN)
void IOCompletionIsPending(const CompletionCallback& callback, IOBuffer* buf);

Powered by Google App Engine
This is Rietveld 408576698