diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-21 00:34:03 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-21 00:34:03 +0000 |
commit | 17f5abff8f422bbfd63bfbb809a86464fd20f7ce (patch) | |
tree | 0b78ac0f527f61d922fd48ed8b9c8d4abc8a5597 /net/base/file_stream.h | |
parent | d5b9894549e850acd3abdc6feb4e52ae6e7b166d (diff) | |
download | chromium_src-17f5abff8f422bbfd63bfbb809a86464fd20f7ce.zip chromium_src-17f5abff8f422bbfd63bfbb809a86464fd20f7ce.tar.gz chromium_src-17f5abff8f422bbfd63bfbb809a86464fd20f7ce.tar.bz2 |
net: Simplify FileStream implementation on POSIX.
Replace AsyncContext with PostTaskAndReply and WeakPtrFactory.
This patch shaves about 200 lines.
This patch also fixes a subtle threading issue with the POSIX
implementation. Callbacks passed to Read/Write() should be
run on the thread where Read/Write() were called.
However, before this patch, callbacks passed to Read/Write were
actually run on the thread where the async context object was created.
BUG=114783
TEST=net_unittests
Review URL: https://chromiumcodereview.appspot.com/9425018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/file_stream.h')
-rw-r--r-- | net/base/file_stream.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/net/base/file_stream.h b/net/base/file_stream.h index 7fe89cd..9ac607a 100644 --- a/net/base/file_stream.h +++ b/net/base/file_stream.h @@ -213,8 +213,6 @@ class NET_EXPORT FileStream { void SetBoundNetLogSource(const net::BoundNetLog& owner_bound_net_log); private: - class AsyncContext; - friend class AsyncContext; friend class FileStreamTest; // Called when the file_ is opened asynchronously. |file| contains the @@ -225,9 +223,17 @@ class NET_EXPORT FileStream { // Called when the file_ is closed asynchronously. void OnClosed(); +#if defined(OS_WIN) + class AsyncContext; + friend class AsyncContext; // This member is used to support asynchronous reads. It is non-null when // the FileStream was opened with PLATFORM_FILE_ASYNC. scoped_ptr<AsyncContext> async_context_; +#else + // Called when Read() or Write() is completed (used only for POSIX). + // |result| contains the result as a network error code. + void OnIOComplete(int* result); +#endif base::PlatformFile file_; int open_flags_; |