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