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

Side by Side Diff: net/base/file_stream_context_posix.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 unified diff | Download patch
« no previous file with comments | « net/base/file_stream_context.cc ('k') | net/base/file_stream_context_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/file_stream_context.h" 5 #include "net/base/file_stream_context.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 base::Bind(&Context::OnAsyncCompleted, 72 base::Bind(&Context::OnAsyncCompleted,
73 base::Unretained(this), 73 base::Unretained(this),
74 IntToInt64(callback))); 74 IntToInt64(callback)));
75 DCHECK(posted); 75 DCHECK(posted);
76 76
77 async_in_progress_ = true; 77 async_in_progress_ = true;
78 return ERR_IO_PENDING; 78 return ERR_IO_PENDING;
79 } 79 }
80 80
81 FileStream::Context::IOResult FileStream::Context::SeekFileImpl( 81 FileStream::Context::IOResult FileStream::Context::SeekFileImpl(
82 base::File::Whence whence,
83 int64_t offset) { 82 int64_t offset) {
84 int64_t res = file_.Seek(whence, offset); 83 int64_t res = file_.Seek(base::File::FROM_BEGIN, offset);
85 if (res == -1) 84 if (res == -1)
86 return IOResult::FromOSError(errno); 85 return IOResult::FromOSError(errno);
87 86
88 return IOResult(res, 0); 87 return IOResult(res, 0);
89 } 88 }
90 89
91 void FileStream::Context::OnFileOpened() { 90 void FileStream::Context::OnFileOpened() {
92 } 91 }
93 92
94 FileStream::Context::IOResult FileStream::Context::ReadFileImpl( 93 FileStream::Context::IOResult FileStream::Context::ReadFileImpl(
(...skipping 14 matching lines...) Expand all
109 scoped_refptr<IOBuffer> buf, 108 scoped_refptr<IOBuffer> buf,
110 int buf_len) { 109 int buf_len) {
111 int res = file_.WriteAtCurrentPosNoBestEffort(buf->data(), buf_len); 110 int res = file_.WriteAtCurrentPosNoBestEffort(buf->data(), buf_len);
112 if (res == -1) 111 if (res == -1)
113 return IOResult::FromOSError(errno); 112 return IOResult::FromOSError(errno);
114 113
115 return IOResult(res, 0); 114 return IOResult(res, 0);
116 } 115 }
117 116
118 } // namespace net 117 } // namespace net
OLDNEW
« no previous file with comments | « net/base/file_stream_context.cc ('k') | net/base/file_stream_context_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698