| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |