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..51126a107bf5538298139bcde98eb6bd41e461e5 100644 |
--- a/net/base/file_stream_context.cc |
+++ b/net/base/file_stream_context.cc |
@@ -78,13 +78,13 @@ void FileStream::Context::Orphan() { |
if (!async_in_progress_) { |
CloseAndDelete(); |
} else if (file_.IsValid()) { |
- CancelIo(file_.GetPlatformFile()); |
+ CancelIO(); |
} |
} |
-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 +98,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 +112,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 +130,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 +172,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 +183,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 +222,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_) |