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

Side by Side Diff: webkit/browser/fileapi/file_system_url_request_job.cc

Issue 470323003: [fsp] Improve performance for reading small chunks of data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a dcheck. Created 6 years, 4 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 | Annotate | Revision Log
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 "webkit/browser/fileapi/file_system_url_request_job.h" 5 #include "webkit/browser/fileapi/file_system_url_request_job.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 NotifyHeadersComplete(); 210 NotifyHeadersComplete();
211 return; 211 return;
212 } 212 }
213 213
214 remaining_bytes_ = byte_range_.last_byte_position() - 214 remaining_bytes_ = byte_range_.last_byte_position() -
215 byte_range_.first_byte_position() + 1; 215 byte_range_.first_byte_position() + 1;
216 DCHECK_GE(remaining_bytes_, 0); 216 DCHECK_GE(remaining_bytes_, 0);
217 217
218 DCHECK(!reader_.get()); 218 DCHECK(!reader_.get());
219 reader_ = file_system_context_->CreateFileStreamReader( 219 reader_ = file_system_context_->CreateFileStreamReader(
220 url_, byte_range_.first_byte_position(), base::Time()); 220 url_,
221 byte_range_.first_byte_position(),
222 byte_range_.last_byte_position() - byte_range_.first_byte_position() + 1,
hashimoto 2014/08/22 06:53:42 You can use remaining_bytes_.
mtomasz 2014/08/25 03:32:31 Done.
223 base::Time());
221 224
222 set_expected_content_size(remaining_bytes_); 225 set_expected_content_size(remaining_bytes_);
223 response_info_.reset(new net::HttpResponseInfo()); 226 response_info_.reset(new net::HttpResponseInfo());
224 response_info_->headers = CreateHttpResponseHeaders(); 227 response_info_->headers = CreateHttpResponseHeaders();
225 NotifyHeadersComplete(); 228 NotifyHeadersComplete();
226 } 229 }
227 230
228 void FileSystemURLRequestJob::DidRead(int result) { 231 void FileSystemURLRequestJob::DidRead(int result) {
229 if (result > 0) 232 if (result > 0)
230 SetStatus(URLRequestStatus()); // Clear the IO_PENDING status 233 SetStatus(URLRequestStatus()); // Clear the IO_PENDING status
(...skipping 23 matching lines...) Expand all
254 } 257 }
255 258
256 return false; 259 return false;
257 } 260 }
258 261
259 void FileSystemURLRequestJob::NotifyFailed(int rv) { 262 void FileSystemURLRequestJob::NotifyFailed(int rv) {
260 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); 263 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
261 } 264 }
262 265
263 } // namespace fileapi 266 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698