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

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

Issue 9949011: Make FileStream::Seek async and add FileStream::SeekSync for sync operation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 8 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
« no previous file with comments | « webkit/blob/blob_url_request_job.cc ('k') | webkit/fileapi/file_writer_delegate.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 "webkit/fileapi/file_system_url_request_job.h" 5 #include "webkit/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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 byte_range_.first_byte_position() + 1; 238 byte_range_.first_byte_position() + 1;
239 DCHECK_GE(remaining_bytes_, 0); 239 DCHECK_GE(remaining_bytes_, 0);
240 240
241 // TODO(adamk): Please remove this ScopedAllowIO once we support async seek 241 // TODO(adamk): Please remove this ScopedAllowIO once we support async seek
242 // on FileStream. crbug.com/113300 242 // on FileStream. crbug.com/113300
243 base::ThreadRestrictions::ScopedAllowIO allow_io; 243 base::ThreadRestrictions::ScopedAllowIO allow_io;
244 // Do the seek at the beginning of the request. 244 // Do the seek at the beginning of the request.
245 if (remaining_bytes_ > 0 && 245 if (remaining_bytes_ > 0 &&
246 byte_range_.first_byte_position() != 0 && 246 byte_range_.first_byte_position() != 0 &&
247 byte_range_.first_byte_position() != 247 byte_range_.first_byte_position() !=
248 stream_->Seek(net::FROM_BEGIN, byte_range_.first_byte_position())) { 248 stream_->SeekSync(net::FROM_BEGIN,
249 byte_range_.first_byte_position())) {
249 NotifyFailed(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE); 250 NotifyFailed(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE);
250 return; 251 return;
251 } 252 }
252 253
253 set_expected_content_size(remaining_bytes_); 254 set_expected_content_size(remaining_bytes_);
254 response_info_.reset(new net::HttpResponseInfo()); 255 response_info_.reset(new net::HttpResponseInfo());
255 response_info_->headers = CreateHttpResponseHeaders(); 256 response_info_->headers = CreateHttpResponseHeaders();
256 257
257 NotifyHeadersComplete(); 258 NotifyHeadersComplete();
258 } 259 }
(...skipping 27 matching lines...) Expand all
286 } 287 }
287 288
288 return false; 289 return false;
289 } 290 }
290 291
291 void FileSystemURLRequestJob::NotifyFailed(int rv) { 292 void FileSystemURLRequestJob::NotifyFailed(int rv) {
292 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); 293 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
293 } 294 }
294 295
295 } // namespace fileapi 296 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/blob/blob_url_request_job.cc ('k') | webkit/fileapi/file_writer_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698