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

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: '' 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
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util_proxy.h" 10 #include "base/file_util_proxy.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 byte_range_.first_byte_position() + 1; 236 byte_range_.first_byte_position() + 1;
237 DCHECK_GE(remaining_bytes_, 0); 237 DCHECK_GE(remaining_bytes_, 0);
238 238
239 // TODO(adamk): Please remove this ScopedAllowIO once we support async seek 239 // TODO(adamk): Please remove this ScopedAllowIO once we support async seek
240 // on FileStream. crbug.com/113300 240 // on FileStream. crbug.com/113300
241 base::ThreadRestrictions::ScopedAllowIO allow_io; 241 base::ThreadRestrictions::ScopedAllowIO allow_io;
242 // Do the seek at the beginning of the request. 242 // Do the seek at the beginning of the request.
243 if (remaining_bytes_ > 0 && 243 if (remaining_bytes_ > 0 &&
244 byte_range_.first_byte_position() != 0 && 244 byte_range_.first_byte_position() != 0 &&
245 byte_range_.first_byte_position() != 245 byte_range_.first_byte_position() !=
246 stream_->Seek(net::FROM_BEGIN, byte_range_.first_byte_position())) { 246 stream_->SeekSync(net::FROM_BEGIN,
247 byte_range_.first_byte_position())) {
247 NotifyFailed(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE); 248 NotifyFailed(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE);
248 return; 249 return;
249 } 250 }
250 251
251 set_expected_content_size(remaining_bytes_); 252 set_expected_content_size(remaining_bytes_);
252 response_info_.reset(new net::HttpResponseInfo()); 253 response_info_.reset(new net::HttpResponseInfo());
253 response_info_->headers = CreateHttpResponseHeaders(); 254 response_info_->headers = CreateHttpResponseHeaders();
254 255
255 NotifyHeadersComplete(); 256 NotifyHeadersComplete();
256 } 257 }
(...skipping 27 matching lines...) Expand all
284 } 285 }
285 286
286 return false; 287 return false;
287 } 288 }
288 289
289 void FileSystemURLRequestJob::NotifyFailed(int rv) { 290 void FileSystemURLRequestJob::NotifyFailed(int rv) {
290 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); 291 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
291 } 292 }
292 293
293 } // namespace fileapi 294 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698