| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/field_trial.h" | 10 #include "base/field_trial.h" |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 DCHECK(rv != ERR_IO_PENDING); | 482 DCHECK(rv != ERR_IO_PENDING); |
| 483 DCHECK(user_callback_); | 483 DCHECK(user_callback_); |
| 484 | 484 |
| 485 // Since Run may result in Read being called, clear user_callback_ up front. | 485 // Since Run may result in Read being called, clear user_callback_ up front. |
| 486 CompletionCallback* c = user_callback_; | 486 CompletionCallback* c = user_callback_; |
| 487 user_callback_ = NULL; | 487 user_callback_ = NULL; |
| 488 c->Run(rv); | 488 c->Run(rv); |
| 489 } | 489 } |
| 490 | 490 |
| 491 void HttpNetworkTransaction::OnIOComplete(int result) { | 491 void HttpNetworkTransaction::OnIOComplete(int result) { |
| 492 DLOG(INFO) << " >> " << __FUNCTION__ << "()"; | |
| 493 int rv = DoLoop(result); | 492 int rv = DoLoop(result); |
| 494 if (rv != ERR_IO_PENDING) | 493 if (rv != ERR_IO_PENDING) |
| 495 DoCallback(rv); | 494 DoCallback(rv); |
| 496 } | 495 } |
| 497 | 496 |
| 498 int HttpNetworkTransaction::DoLoop(int result) { | 497 int HttpNetworkTransaction::DoLoop(int result) { |
| 499 DCHECK(next_state_ != STATE_NONE); | 498 DCHECK(next_state_ != STATE_NONE); |
| 500 | 499 |
| 501 int rv = result; | 500 int rv = result; |
| 502 do { | 501 do { |
| 503 DLOG(INFO) << " * " << __FUNCTION__ << "() state = " << next_state_; | |
| 504 State state = next_state_; | 502 State state = next_state_; |
| 505 next_state_ = STATE_NONE; | 503 next_state_ = STATE_NONE; |
| 506 switch (state) { | 504 switch (state) { |
| 507 case STATE_RESOLVE_PROXY: | 505 case STATE_RESOLVE_PROXY: |
| 508 DCHECK_EQ(OK, rv); | 506 DCHECK_EQ(OK, rv); |
| 509 TRACE_EVENT_BEGIN("http.resolve_proxy", request_, request_->url.spec()); | 507 TRACE_EVENT_BEGIN("http.resolve_proxy", request_, request_->url.spec()); |
| 510 rv = DoResolveProxy(); | 508 rv = DoResolveProxy(); |
| 511 break; | 509 break; |
| 512 case STATE_RESOLVE_PROXY_COMPLETE: | 510 case STATE_RESOLVE_PROXY_COMPLETE: |
| 513 rv = DoResolveProxyComplete(rv); | 511 rv = DoResolveProxyComplete(rv); |
| (...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1884 http_host_port_pair); | 1882 http_host_port_pair); |
| 1885 | 1883 |
| 1886 alternate_protocol_mode_ = kDoNotUseAlternateProtocol; | 1884 alternate_protocol_mode_ = kDoNotUseAlternateProtocol; |
| 1887 if (connection_->socket()) | 1885 if (connection_->socket()) |
| 1888 connection_->socket()->Disconnect(); | 1886 connection_->socket()->Disconnect(); |
| 1889 connection_->Reset(); | 1887 connection_->Reset(); |
| 1890 next_state_ = STATE_INIT_CONNECTION; | 1888 next_state_ = STATE_INIT_CONNECTION; |
| 1891 } | 1889 } |
| 1892 | 1890 |
| 1893 } // namespace net | 1891 } // namespace net |
| OLD | NEW |