| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 TRACE_EVENT_ASYNC_BEGIN1("Blob", "BlobRequest::CountSize", this, "uuid", | 171 TRACE_EVENT_ASYNC_BEGIN1("Blob", "BlobRequest::CountSize", this, "uuid", |
| 172 blob_handle_->uuid()); | 172 blob_handle_->uuid()); |
| 173 BlobReader::Status size_status = blob_reader_->CalculateSize(base::Bind( | 173 BlobReader::Status size_status = blob_reader_->CalculateSize(base::Bind( |
| 174 &BlobURLRequestJob::DidCalculateSize, weak_factory_.GetWeakPtr())); | 174 &BlobURLRequestJob::DidCalculateSize, weak_factory_.GetWeakPtr())); |
| 175 switch (size_status) { | 175 switch (size_status) { |
| 176 case BlobReader::Status::NET_ERROR: | 176 case BlobReader::Status::NET_ERROR: |
| 177 NotifyFailure(blob_reader_->net_error()); | 177 NotifyFailure(blob_reader_->net_error()); |
| 178 return; | 178 return; |
| 179 case BlobReader::Status::IO_PENDING: | 179 case BlobReader::Status::IO_PENDING: |
| 180 SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0)); | |
| 181 return; | 180 return; |
| 182 case BlobReader::Status::DONE: | 181 case BlobReader::Status::DONE: |
| 183 DidCalculateSize(net::OK); | 182 DidCalculateSize(net::OK); |
| 184 return; | 183 return; |
| 185 } | 184 } |
| 186 } | 185 } |
| 187 | 186 |
| 188 void BlobURLRequestJob::DidCalculateSize(int result) { | 187 void BlobURLRequestJob::DidCalculateSize(int result) { |
| 189 TRACE_EVENT_ASYNC_END1("Blob", "BlobRequest::CountSize", this, "uuid", | 188 TRACE_EVENT_ASYNC_END1("Blob", "BlobRequest::CountSize", this, "uuid", |
| 190 blob_handle_->uuid()); | 189 blob_handle_->uuid()); |
| 191 // Clear the IO_PENDING status | |
| 192 SetStatus(net::URLRequestStatus()); | |
| 193 | 190 |
| 194 if (result != net::OK) { | 191 if (result != net::OK) { |
| 195 NotifyFailure(result); | 192 NotifyFailure(result); |
| 196 return; | 193 return; |
| 197 } | 194 } |
| 198 | 195 |
| 199 // Apply the range requirement. | 196 // Apply the range requirement. |
| 200 if (!byte_range_.ComputeBounds(blob_reader_->total_size())) { | 197 if (!byte_range_.ComputeBounds(blob_reader_->total_size())) { |
| 201 NotifyFailure(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE); | 198 NotifyFailure(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE); |
| 202 return; | 199 return; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } | 292 } |
| 296 } | 293 } |
| 297 | 294 |
| 298 response_info_.reset(new net::HttpResponseInfo()); | 295 response_info_.reset(new net::HttpResponseInfo()); |
| 299 response_info_->headers = headers; | 296 response_info_->headers = headers; |
| 300 | 297 |
| 301 NotifyHeadersComplete(); | 298 NotifyHeadersComplete(); |
| 302 } | 299 } |
| 303 | 300 |
| 304 } // namespace storage | 301 } // namespace storage |
| OLD | NEW |