| 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 "content/browser/renderer_host/async_resource_handler.h" | 5 #include "content/browser/renderer_host/async_resource_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 302 |
| 303 // TODO(gavinp): Remove this CHECK when we figure out the cause of | 303 // TODO(gavinp): Remove this CHECK when we figure out the cause of |
| 304 // http://crbug.com/124680 . This check mirrors closely check in | 304 // http://crbug.com/124680 . This check mirrors closely check in |
| 305 // WebURLLoaderImpl::OnCompletedRequest that routes this message to a WebCore | 305 // WebURLLoaderImpl::OnCompletedRequest that routes this message to a WebCore |
| 306 // ResourceHandleInternal which asserts on its state and crashes. By crashing | 306 // ResourceHandleInternal which asserts on its state and crashes. By crashing |
| 307 // when the message is sent, we should get better crash reports. | 307 // when the message is sent, we should get better crash reports. |
| 308 CHECK(status.status() != net::URLRequestStatus::SUCCESS || | 308 CHECK(status.status() != net::URLRequestStatus::SUCCESS || |
| 309 sent_received_response_msg_); | 309 sent_received_response_msg_); |
| 310 | 310 |
| 311 TimeTicks completion_time = TimeTicks::Now(); | 311 TimeTicks completion_time = TimeTicks::Now(); |
| 312 |
| 313 int error_code = status.error(); |
| 314 if (status.status() == net::URLRequestStatus::IO_PENDING) |
| 315 error_code = net::ERR_IO_PENDING; |
| 316 else if (status.status() == net::URLRequestStatus::CANCELED && |
| 317 error_code == net::OK) |
| 318 error_code = net::ERR_ABORTED; |
| 319 else if (status.status() == net::URLRequestStatus::FAILED && |
| 320 error_code == net::OK) |
| 321 error_code = net::ERR_FAILED; |
| 322 |
| 312 filter_->Send(new ResourceMsg_RequestComplete(routing_id_, | 323 filter_->Send(new ResourceMsg_RequestComplete(routing_id_, |
| 313 request_id, | 324 request_id, |
| 314 status, | 325 error_code, |
| 326 false, |
| 315 security_info, | 327 security_info, |
| 316 completion_time)); | 328 completion_time)); |
| 317 | 329 |
| 318 // If we still have a read buffer, then see about caching it for later... | 330 // If we still have a read buffer, then see about caching it for later... |
| 319 // Note that we have to make sure the buffer is not still being used, so we | 331 // Note that we have to make sure the buffer is not still being used, so we |
| 320 // have to perform an explicit check on the status code. | 332 // have to perform an explicit check on the status code. |
| 321 if (g_spare_read_buffer || | 333 if (g_spare_read_buffer || |
| 322 net::URLRequestStatus::SUCCESS != status.status()) { | 334 net::URLRequestStatus::SUCCESS != status.status()) { |
| 323 read_buffer_ = NULL; | 335 read_buffer_ = NULL; |
| 324 } else if (read_buffer_.get()) { | 336 } else if (read_buffer_.get()) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 352 } | 364 } |
| 353 | 365 |
| 354 void AsyncResourceHandler::ResumeIfDeferred() { | 366 void AsyncResourceHandler::ResumeIfDeferred() { |
| 355 if (did_defer_) { | 367 if (did_defer_) { |
| 356 did_defer_ = false; | 368 did_defer_ = false; |
| 357 controller()->Resume(); | 369 controller()->Resume(); |
| 358 } | 370 } |
| 359 } | 371 } |
| 360 | 372 |
| 361 } // namespace content | 373 } // namespace content |
| OLD | NEW |