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

Side by Side Diff: storage/browser/fileapi/local_file_stream_reader.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
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 "storage/browser/fileapi/local_file_stream_reader.h" 5 #include "storage/browser/fileapi/local_file_stream_reader.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/file_util_proxy.h" 8 #include "base/files/file_util_proxy.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 void LocalFileStreamReader::DidOpenFileStream( 101 void LocalFileStreamReader::DidOpenFileStream(
102 const net::CompletionCallback& callback, 102 const net::CompletionCallback& callback,
103 int result) { 103 int result) {
104 if (result != net::OK) { 104 if (result != net::OK) {
105 callback.Run(result); 105 callback.Run(result);
106 return; 106 return;
107 } 107 }
108 result = stream_impl_->Seek( 108 result = stream_impl_->Seek(
109 base::File::FROM_BEGIN, initial_offset_, 109 initial_offset_, base::Bind(&LocalFileStreamReader::DidSeekFileStream,
110 base::Bind(&LocalFileStreamReader::DidSeekFileStream, 110 weak_factory_.GetWeakPtr(), callback));
111 weak_factory_.GetWeakPtr(),
112 callback));
113 if (result != net::ERR_IO_PENDING) { 111 if (result != net::ERR_IO_PENDING) {
114 callback.Run(result); 112 callback.Run(result);
115 } 113 }
116 } 114 }
117 115
118 void LocalFileStreamReader::DidSeekFileStream( 116 void LocalFileStreamReader::DidSeekFileStream(
119 const net::CompletionCallback& callback, 117 const net::CompletionCallback& callback,
120 int64 seek_result) { 118 int64 seek_result) {
121 if (seek_result < 0) { 119 if (seek_result < 0) {
122 callback.Run(static_cast<int>(seek_result)); 120 callback.Run(static_cast<int>(seek_result));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return; 158 return;
161 } 159 }
162 if (!VerifySnapshotTime(expected_modification_time_, file_info)) { 160 if (!VerifySnapshotTime(expected_modification_time_, file_info)) {
163 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); 161 callback.Run(net::ERR_UPLOAD_FILE_CHANGED);
164 return; 162 return;
165 } 163 }
166 callback.Run(file_info.size); 164 callback.Run(file_info.size);
167 } 165 }
168 166
169 } // namespace storage 167 } // namespace storage
OLDNEW
« no previous file with comments | « net/url_request/url_request_file_job.cc ('k') | storage/browser/fileapi/local_file_stream_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698