Index: net/base/file_stream_context.cc |
diff --git a/net/base/file_stream_context.cc b/net/base/file_stream_context.cc |
index fbfe5368dd8cabfc9a75e5536eac678539e5b46b..3e2c2e5fc2732d0279e0a1fb68be658b7df9d4af 100644 |
--- a/net/base/file_stream_context.cc |
+++ b/net/base/file_stream_context.cc |
@@ -78,13 +78,15 @@ void FileStream::Context::Orphan() { |
if (!async_in_progress_) { |
CloseAndDelete(); |
} else if (file_.IsValid()) { |
+#if defined(OS_WIN) |
CancelIo(file_.GetPlatformFile()); |
wtc
2014/06/19 18:20:49
Hmm... how could the original code be compiled on
rvargas (doing something else)
2014/06/19 18:46:42
There was a void method with that name defined on
|
+#endif |
} |
} |
-void FileStream::Context::OpenAsync(const base::FilePath& path, |
- int open_flags, |
- const CompletionCallback& callback) { |
+void FileStream::Context::Open(const base::FilePath& path, |
+ int open_flags, |
+ const CompletionCallback& callback) { |
DCHECK(!async_in_progress_); |
bool posted = base::PostTaskAndReplyWithResult( |
@@ -98,7 +100,7 @@ void FileStream::Context::OpenAsync(const base::FilePath& path, |
async_in_progress_ = true; |
} |
-void FileStream::Context::CloseAsync(const CompletionCallback& callback) { |
+void FileStream::Context::Close(const CompletionCallback& callback) { |
DCHECK(!async_in_progress_); |
bool posted = base::PostTaskAndReplyWithResult( |
task_runner_.get(), |
@@ -112,9 +114,9 @@ void FileStream::Context::CloseAsync(const CompletionCallback& callback) { |
async_in_progress_ = true; |
} |
-void FileStream::Context::SeekAsync(Whence whence, |
- int64 offset, |
- const Int64CompletionCallback& callback) { |
+void FileStream::Context::Seek(base::File::Whence whence, |
+ int64 offset, |
+ const Int64CompletionCallback& callback) { |
DCHECK(!async_in_progress_); |
bool posted = base::PostTaskAndReplyWithResult( |
@@ -130,7 +132,7 @@ void FileStream::Context::SeekAsync(Whence whence, |
async_in_progress_ = true; |
} |
-void FileStream::Context::FlushAsync(const CompletionCallback& callback) { |
+void FileStream::Context::Flush(const CompletionCallback& callback) { |
DCHECK(!async_in_progress_); |
bool posted = base::PostTaskAndReplyWithResult( |
@@ -172,7 +174,8 @@ FileStream::Context::OpenResult FileStream::Context::OpenFileImpl( |
} |
#endif // defined(OS_ANDROID) |
if (!file.IsValid()) |
- return OpenResult(base::File(), IOResult::FromOSError(GetLastErrno())); |
+ return OpenResult(base::File(), |
+ IOResult::FromOSError(logging::GetLastSystemErrorCode())); |
return OpenResult(file.Pass(), IOResult(OK, 0)); |
} |
@@ -182,11 +185,18 @@ FileStream::Context::IOResult FileStream::Context::CloseFileImpl() { |
return IOResult(OK, 0); |
} |
+FileStream::Context::IOResult FileStream::Context::FlushFileImpl() { |
+ if (file_.Flush()) |
+ return IOResult(OK, 0); |
+ |
+ return IOResult::FromOSError(logging::GetLastSystemErrorCode()); |
+} |
+ |
void FileStream::Context::OnOpenCompleted(const CompletionCallback& callback, |
OpenResult open_result) { |
file_ = open_result.file.Pass(); |
if (file_.IsValid() && !orphaned_) |
- OnAsyncFileOpened(); |
+ OnFileOpened(); |
OnAsyncCompleted(IntToInt64(callback), open_result.error_code); |
} |
@@ -214,7 +224,7 @@ void FileStream::Context::OnAsyncCompleted( |
const Int64CompletionCallback& callback, |
const IOResult& result) { |
// Reset this before Run() as Run() may issue a new async operation. Also it |
- // should be reset before CloseAsync() because it shouldn't run if any async |
+ // should be reset before Close() because it shouldn't run if any async |
// operation is in progress. |
async_in_progress_ = false; |
if (orphaned_) |