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 "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 DoneWithRequest(ABORTED); | 334 DoneWithRequest(ABORTED); |
| 335 transaction_.reset(); | 335 transaction_.reset(); |
| 336 response_info_ = NULL; | 336 response_info_ = NULL; |
| 337 } | 337 } |
| 338 | 338 |
| 339 void URLRequestHttpJob::StartTransaction() { | 339 void URLRequestHttpJob::StartTransaction() { |
| 340 if (request_->context()->network_delegate()) { | 340 if (request_->context()->network_delegate()) { |
| 341 int rv = request_->context()->network_delegate()->NotifyBeforeSendHeaders( | 341 int rv = request_->context()->network_delegate()->NotifyBeforeSendHeaders( |
| 342 request_, notify_before_headers_sent_callback_, | 342 request_, notify_before_headers_sent_callback_, |
| 343 &request_info_.extra_headers); | 343 &request_info_.extra_headers); |
| 344 // If an extension blocks the request, we rely on the callback to | 344 // If an extension blocks the request, we rely on the callback to |
|
mmenke
2012/09/07 17:27:51
Need a complete sentence here. "... the callback
vabr (Chromium)
2012/09/10 15:32:59
Oops, I deleted that by mistake. Restored the orig
| |
| 345 // StartTransactionInternal(). | |
| 346 if (rv == ERR_IO_PENDING) { | 345 if (rv == ERR_IO_PENDING) { |
| 347 SetBlockedOnDelegate(); | 346 SetBlockedOnDelegate(); |
| 348 return; | 347 return; |
| 349 } | 348 } |
| 349 MaybeStartTransactionInternal(rv); | |
| 350 return; | |
| 350 } | 351 } |
| 351 StartTransactionInternal(); | 352 StartTransactionInternal(); |
| 352 } | 353 } |
| 353 | 354 |
| 354 void URLRequestHttpJob::NotifyBeforeSendHeadersCallback(int result) { | 355 void URLRequestHttpJob::NotifyBeforeSendHeadersCallback(int result) { |
| 355 SetUnblockedOnDelegate(); | 356 SetUnblockedOnDelegate(); |
| 356 | 357 |
| 357 // Check that there are no callbacks to already canceled requests. | 358 // Check that there are no callbacks to already canceled requests. |
| 358 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); | 359 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); |
| 359 | 360 |
| 361 MaybeStartTransactionInternal(result); | |
| 362 } | |
| 363 | |
| 364 void URLRequestHttpJob::MaybeStartTransactionInternal(int result) { | |
| 360 if (result == OK) { | 365 if (result == OK) { |
| 361 StartTransactionInternal(); | 366 StartTransactionInternal(); |
| 362 } else { | 367 } else { |
| 363 std::string source("delegate"); | 368 std::string source("delegate"); |
| 364 request_->net_log().AddEvent(NetLog::TYPE_CANCELLED, | 369 request_->net_log().AddEvent(NetLog::TYPE_CANCELLED, |
| 365 NetLog::StringCallback("source", &source)); | 370 NetLog::StringCallback("source", &source)); |
| 366 NotifyCanceled(); | 371 NotifyCanceled(); |
| 372 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); | |
| 367 } | 373 } |
| 368 } | 374 } |
| 369 | 375 |
| 370 void URLRequestHttpJob::StartTransactionInternal() { | 376 void URLRequestHttpJob::StartTransactionInternal() { |
| 371 // NOTE: This method assumes that request_info_ is already setup properly. | 377 // NOTE: This method assumes that request_info_ is already setup properly. |
| 372 | 378 |
| 373 // If we already have a transaction, then we should restart the transaction | 379 // If we already have a transaction, then we should restart the transaction |
| 374 // with auth provided by auth_credentials_. | 380 // with auth provided by auth_credentials_. |
| 375 | 381 |
| 376 int rv; | 382 int rv; |
| (...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1628 | 1634 |
| 1629 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1635 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1630 awaiting_callback_ = false; | 1636 awaiting_callback_ = false; |
| 1631 } | 1637 } |
| 1632 | 1638 |
| 1633 void URLRequestHttpJob::OnDetachRequest() { | 1639 void URLRequestHttpJob::OnDetachRequest() { |
| 1634 http_transaction_delegate_->OnDetachRequest(); | 1640 http_transaction_delegate_->OnDetachRequest(); |
| 1635 } | 1641 } |
| 1636 | 1642 |
| 1637 } // namespace net | 1643 } // namespace net |
| OLD | NEW |