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

Side by Side Diff: net/base/file_stream.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: 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 unified diff | Download patch
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.h" 5 #include "net/base/file_stream.h"
6 6
7 #include "base/profiler/scoped_tracker.h" 7 #include "base/profiler/scoped_tracker.h"
8 #include "net/base/file_stream_context.h" 8 #include "net/base/file_stream_context.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 10
(...skipping 26 matching lines...) Expand all
37 37
38 int FileStream::Close(const CompletionCallback& callback) { 38 int FileStream::Close(const CompletionCallback& callback) {
39 context_->Close(callback); 39 context_->Close(callback);
40 return ERR_IO_PENDING; 40 return ERR_IO_PENDING;
41 } 41 }
42 42
43 bool FileStream::IsOpen() const { 43 bool FileStream::IsOpen() const {
44 return context_->file().IsValid(); 44 return context_->file().IsValid();
45 } 45 }
46 46
47 int FileStream::Seek(base::File::Whence whence, 47 int FileStream::Seek(int64 offset, const Int64CompletionCallback& callback) {
48 int64 offset,
49 const Int64CompletionCallback& callback) {
50 if (!IsOpen()) 48 if (!IsOpen())
51 return ERR_UNEXPECTED; 49 return ERR_UNEXPECTED;
52 50
53 context_->Seek(whence, offset, callback); 51 context_->Seek(offset, callback);
54 return ERR_IO_PENDING; 52 return ERR_IO_PENDING;
55 } 53 }
56 54
57 int FileStream::Read(IOBuffer* buf, 55 int FileStream::Read(IOBuffer* buf,
58 int buf_len, 56 int buf_len,
59 const CompletionCallback& callback) { 57 const CompletionCallback& callback) {
60 // TODO(rvargas): Remove ScopedTracker below once crbug.com/475751 is fixed. 58 // TODO(rvargas): Remove ScopedTracker below once crbug.com/475751 is fixed.
61 tracked_objects::ScopedTracker tracking_profile( 59 tracked_objects::ScopedTracker tracking_profile(
62 FROM_HERE_WITH_EXPLICIT_FUNCTION("475751 FileStream::Read")); 60 FROM_HERE_WITH_EXPLICIT_FUNCTION("475751 FileStream::Read"));
63 61
(...skipping 22 matching lines...) Expand all
86 84
87 context_->Flush(callback); 85 context_->Flush(callback);
88 return ERR_IO_PENDING; 86 return ERR_IO_PENDING;
89 } 87 }
90 88
91 const base::File& FileStream::GetFileForTesting() const { 89 const base::File& FileStream::GetFileForTesting() const {
92 return context_->file(); 90 return context_->file();
93 } 91 }
94 92
95 } // namespace net 93 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698