Index: net/base/file_stream_posix.h |
=================================================================== |
--- net/base/file_stream_posix.h (revision 145483) |
+++ net/base/file_stream_posix.h (working copy) |
@@ -8,8 +8,6 @@ |
#define NET_BASE_FILE_STREAM_POSIX_H_ |
#pragma once |
-#include "base/memory/scoped_ptr.h" |
-#include "base/memory/weak_ptr.h" |
#include "base/platform_file.h" |
#include "net/base/completion_callback.h" |
#include "net/base/file_stream_whence.h" |
@@ -35,6 +33,7 @@ |
// FileStream implementations. |
void Close(const CompletionCallback& callback); |
void CloseSync(); |
+ void CloseAndCancelAsync(); |
int Open(const FilePath& path, int open_flags, |
const CompletionCallback& callback); |
int OpenSync(const FilePath& path, int open_flags); |
@@ -55,25 +54,18 @@ |
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(const CompletionCallback& callback); |
+ class AsyncContext; |
- // Waits until the in-flight async open/close/read/write operation is |
- // complete. |
- void WaitForIOCompletion(); |
+ bool is_async() { return !!(open_flags_ & base::PLATFORM_FILE_ASYNC); } |
- base::PlatformFile file_; |
+ // Context performing I/O operations. Despite its name the context is used |
+ // for synchronous operations too, but it was extracted into separate class |
+ // to perform asynchronous operations correctly. |
+ AsyncContext* context_; |
+ |
int open_flags_; |
- bool auto_closed_; |
- bool record_uma_; |
net::BoundNetLog bound_net_log_; |
- base::WeakPtrFactory<FileStreamPosix> weak_ptr_factory_; |
- scoped_ptr<base::WaitableEvent> on_io_complete_; |
DISALLOW_COPY_AND_ASSIGN(FileStreamPosix); |
}; |