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

Unified Diff: net/base/file_stream_context_win.cc

Issue 1148383003: Only support seeking file streams from the beginning of the file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more instance where files need to be tagged as async. Created 5 years, 7 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_win.cc
diff --git a/net/base/file_stream_context_win.cc b/net/base/file_stream_context_win.cc
index 1a39384c5ee66d3ab843e977aa5ccae36788ec0a..a64f4b2f4d1919d1b1d60b42ec83f78de64c5cd5 100644
--- a/net/base/file_stream_context_win.cc
+++ b/net/base/file_stream_context_win.cc
@@ -62,7 +62,7 @@ FileStream::Context::Context(base::File file,
io_context_.handler = this;
memset(&io_context_.overlapped, 0, sizeof(io_context_.overlapped));
if (file_.IsValid()) {
- // TODO(hashimoto): Check that file_ is async.
+ DCHECK(file_.async());
OnFileOpened();
}
}
@@ -114,17 +114,11 @@ int FileStream::Context::Write(IOBuffer* buf,
return ERR_IO_PENDING;
}
-FileStream::Context::IOResult FileStream::Context::SeekFileImpl(
- base::File::Whence whence,
- int64 offset) {
+FileStream::Context::IOResult FileStream::Context::SeekFileImpl(int64 offset) {
LARGE_INTEGER result;
- result.QuadPart = file_.Seek(whence, offset);
- if (result.QuadPart >= 0) {
- SetOffset(&io_context_.overlapped, result);
- return IOResult(result.QuadPart, 0);
- }
-
- return IOResult::FromOSError(GetLastError());
+ result.QuadPart = offset;
+ SetOffset(&io_context_.overlapped, result);
+ return IOResult(result.QuadPart, 0);
}
void FileStream::Context::OnFileOpened() {

Powered by Google App Engine
This is Rietveld 408576698