Chromium Code Reviews| 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 bool was_ignored_by_handler = | |
| 315 ResourceRequestInfoImpl::ForRequest(request_)->WasIgnoredByHandler(); | |
| 316 | |
| 317 DCHECK(status.status() != net::URLRequestStatus::IO_PENDING); | |
| 318 // If this check fails, then we're in an inconsistent state because all | |
| 319 // requests ignored by the handler should be canceled (which should result in | |
| 320 // the ERR_ABORTED error code). | |
| 321 DCHECK(!was_ignored_by_handler || error_code == net::ERR_ABORTED); | |
| 322 | |
| 323 // TODO(mkosiba): Fix up cases where we create a URLRequestStatus | |
| 324 // with a status() != SUCCESS and an error_code() == net::OK. | |
| 325 if (status.status() == net::URLRequestStatus::CANCELED && | |
| 326 error_code == net::OK) | |
|
darin (slow to review)
2012/08/31 16:15:51
nit: indentation... realize you are probably align
mkosiba (inactive)
2012/09/06 18:30:22
no idea how the indent ended up this way, certainl
| |
| 327 error_code = net::ERR_ABORTED; | |
| 328 else if (status.status() == net::URLRequestStatus::FAILED && | |
| 329 error_code == net::OK) | |
| 330 error_code = net::ERR_FAILED; | |
|
mmenke
2012/08/31 16:17:23
Random nit: Should also use brackets when the pre
darin (slow to review)
2012/08/31 16:55:51
Agreed. I had a similar thought, but didn't reali
mkosiba (inactive)
2012/09/06 18:30:22
Done.
| |
| 331 | |
| 312 filter_->Send(new ResourceMsg_RequestComplete(routing_id_, | 332 filter_->Send(new ResourceMsg_RequestComplete(routing_id_, |
| 313 request_id, | 333 request_id, |
| 314 status, | 334 error_code, |
| 335 was_ignored_by_handler, | |
| 315 security_info, | 336 security_info, |
| 316 completion_time)); | 337 completion_time)); |
| 317 | 338 |
| 318 // If we still have a read buffer, then see about caching it for later... | 339 // 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 | 340 // 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. | 341 // have to perform an explicit check on the status code. |
| 321 if (g_spare_read_buffer || | 342 if (g_spare_read_buffer || |
| 322 net::URLRequestStatus::SUCCESS != status.status()) { | 343 net::URLRequestStatus::SUCCESS != status.status()) { |
| 323 read_buffer_ = NULL; | 344 read_buffer_ = NULL; |
| 324 } else if (read_buffer_.get()) { | 345 } else if (read_buffer_.get()) { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 352 } | 373 } |
| 353 | 374 |
| 354 void AsyncResourceHandler::ResumeIfDeferred() { | 375 void AsyncResourceHandler::ResumeIfDeferred() { |
| 355 if (did_defer_) { | 376 if (did_defer_) { |
| 356 did_defer_ = false; | 377 did_defer_ = false; |
| 357 controller()->Resume(); | 378 controller()->Resume(); |
| 358 } | 379 } |
| 359 } | 380 } |
| 360 | 381 |
| 361 } // namespace content | 382 } // namespace content |
| OLD | NEW |