OLD | NEW |
1 // Copyright (c) 2011 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/blob/blob_url_request_job.h" | 5 #include "webkit/blob/blob_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.h" | 10 #include "base/file_util.h" |
11 #include "base/file_util_proxy.h" | 11 #include "base/file_util_proxy.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 320 |
321 void BlobURLRequestJob::DidOpen(base::PlatformFileError rv, | 321 void BlobURLRequestJob::DidOpen(base::PlatformFileError rv, |
322 base::PassPlatformFile file, | 322 base::PassPlatformFile file, |
323 bool created) { | 323 bool created) { |
324 if (rv != base::PLATFORM_FILE_OK) { | 324 if (rv != base::PLATFORM_FILE_OK) { |
325 NotifyFailure(net::ERR_FAILED); | 325 NotifyFailure(net::ERR_FAILED); |
326 return; | 326 return; |
327 } | 327 } |
328 | 328 |
329 DCHECK(!stream_.get()); | 329 DCHECK(!stream_.get()); |
330 stream_.reset(new net::FileStream(file.ReleaseValue(), kFileOpenFlags)); | 330 stream_.reset(new net::FileStream(file.ReleaseValue(), kFileOpenFlags, NULL)); |
331 | 331 |
332 const BlobData::Item& item = blob_data_->items().at(item_index_); | 332 const BlobData::Item& item = blob_data_->items().at(item_index_); |
333 { | 333 { |
334 // stream_.Seek() blocks the IO thread, see http://crbug.com/75548. | 334 // stream_.Seek() blocks the IO thread, see http://crbug.com/75548. |
335 base::ThreadRestrictions::ScopedAllowIO allow_io; | 335 base::ThreadRestrictions::ScopedAllowIO allow_io; |
336 int64 offset = current_item_offset_ + static_cast<int64>(item.offset); | 336 int64 offset = current_item_offset_ + static_cast<int64>(item.offset); |
337 if (offset > 0 && offset != stream_->Seek(net::FROM_BEGIN, offset)) { | 337 if (offset > 0 && offset != stream_->Seek(net::FROM_BEGIN, offset)) { |
338 NotifyFailure(net::ERR_FAILED); | 338 NotifyFailure(net::ERR_FAILED); |
339 return; | 339 return; |
340 } | 340 } |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 // We don't support multiple range requests in one single URL request, | 558 // We don't support multiple range requests in one single URL request, |
559 // because we need to do multipart encoding here. | 559 // because we need to do multipart encoding here. |
560 // TODO(jianli): Support multipart byte range requests. | 560 // TODO(jianli): Support multipart byte range requests. |
561 NotifyFailure(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE); | 561 NotifyFailure(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE); |
562 } | 562 } |
563 } | 563 } |
564 } | 564 } |
565 } | 565 } |
566 | 566 |
567 } // namespace webkit_blob | 567 } // namespace webkit_blob |
OLD | NEW |