| 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 "storage/browser/blob/blob_url_request_job.h" | 5 #include "storage/browser/blob/blob_url_request_job.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 if (request()->method() != "GET") { | 155 if (request()->method() != "GET") { |
| 156 NotifyFailure(net::ERR_METHOD_NOT_SUPPORTED); | 156 NotifyFailure(net::ERR_METHOD_NOT_SUPPORTED); |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 | 159 |
| 160 // If the blob data is not present, bail out. | 160 // If the blob data is not present, bail out. |
| 161 if (!blob_handle_) { | 161 if (!blob_handle_) { |
| 162 NotifyFailure(net::ERR_FILE_NOT_FOUND); | 162 NotifyFailure(net::ERR_FILE_NOT_FOUND); |
| 163 return; | 163 return; |
| 164 } | 164 } |
| 165 if (blob_reader_->net_error()) { |
| 166 NotifyFailure(blob_reader_->net_error()); |
| 167 return; |
| 168 } |
| 165 | 169 |
| 166 TRACE_EVENT_ASYNC_BEGIN1("Blob", "BlobRequest::CountSize", this, "uuid", | 170 TRACE_EVENT_ASYNC_BEGIN1("Blob", "BlobRequest::CountSize", this, "uuid", |
| 167 blob_handle_->uuid()); | 171 blob_handle_->uuid()); |
| 168 BlobReader::Status size_status = blob_reader_->CalculateSize(base::Bind( | 172 BlobReader::Status size_status = blob_reader_->CalculateSize(base::Bind( |
| 169 &BlobURLRequestJob::DidCalculateSize, weak_factory_.GetWeakPtr())); | 173 &BlobURLRequestJob::DidCalculateSize, weak_factory_.GetWeakPtr())); |
| 170 switch (size_status) { | 174 switch (size_status) { |
| 171 case BlobReader::Status::NET_ERROR: | 175 case BlobReader::Status::NET_ERROR: |
| 172 NotifyFailure(blob_reader_->net_error()); | 176 NotifyFailure(blob_reader_->net_error()); |
| 173 return; | 177 return; |
| 174 case BlobReader::Status::IO_PENDING: | 178 case BlobReader::Status::IO_PENDING: |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 318 |
| 315 response_info_.reset(new net::HttpResponseInfo()); | 319 response_info_.reset(new net::HttpResponseInfo()); |
| 316 response_info_->headers = headers; | 320 response_info_->headers = headers; |
| 317 if (blob_reader_) | 321 if (blob_reader_) |
| 318 response_info_->metadata = blob_reader_->side_data(); | 322 response_info_->metadata = blob_reader_->side_data(); |
| 319 | 323 |
| 320 NotifyHeadersComplete(); | 324 NotifyHeadersComplete(); |
| 321 } | 325 } |
| 322 | 326 |
| 323 } // namespace storage | 327 } // namespace storage |
| OLD | NEW |