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

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: Fix Win DBG build by Pass()-ing file out of CreateForAsyncHandle. Created 5 years, 6 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
« no previous file with comments | « net/base/file_stream_context_posix.cc ('k') | net/base/file_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d78bf91b1c768473878732b51b6d973e7add8cd4..2136c52c702c7380bd986e66aa75c1e7510ff8df 100644
--- a/net/base/file_stream_context_win.cc
+++ b/net/base/file_stream_context_win.cc
@@ -63,7 +63,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();
}
}
@@ -115,16 +115,11 @@ int FileStream::Context::Write(IOBuffer* buf,
}
FileStream::Context::IOResult FileStream::Context::SeekFileImpl(
- base::File::Whence whence,
int64_t 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() {
« no previous file with comments | « net/base/file_stream_context_posix.cc ('k') | net/base/file_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698