| 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 "jingle/glue/proxy_resolving_client_socket.h" | 5 #include "jingle/glue/proxy_resolving_client_socket.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/profiler/scoped_tracker.h" |
| 12 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 13 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
| 14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 15 #include "net/http/http_auth_controller.h" | 16 #include "net/http/http_auth_controller.h" |
| 16 #include "net/http/http_network_session.h" | 17 #include "net/http/http_network_session.h" |
| 17 #include "net/http/proxy_client_socket.h" | 18 #include "net/http/proxy_client_socket.h" |
| 18 #include "net/socket/client_socket_handle.h" | 19 #include "net/socket/client_socket_handle.h" |
| 19 #include "net/socket/client_socket_pool_manager.h" | 20 #include "net/socket/client_socket_pool_manager.h" |
| 20 #include "net/url_request/url_request_context.h" | 21 #include "net/url_request/url_request_context.h" |
| 21 #include "net/url_request/url_request_context_getter.h" | 22 #include "net/url_request/url_request_context_getter.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 ssl_config_, net::PRIVACY_MODE_DISABLED, bound_net_log_, transport_.get(), | 208 ssl_config_, net::PRIVACY_MODE_DISABLED, bound_net_log_, transport_.get(), |
| 208 connect_callback_); | 209 connect_callback_); |
| 209 if (status != net::ERR_IO_PENDING) { | 210 if (status != net::ERR_IO_PENDING) { |
| 210 // Since this method is always called asynchronously. it is OK to call | 211 // Since this method is always called asynchronously. it is OK to call |
| 211 // ProcessConnectDone synchronously. | 212 // ProcessConnectDone synchronously. |
| 212 ProcessConnectDone(status); | 213 ProcessConnectDone(status); |
| 213 } | 214 } |
| 214 } | 215 } |
| 215 | 216 |
| 216 void ProxyResolvingClientSocket::ProcessConnectDone(int status) { | 217 void ProxyResolvingClientSocket::ProcessConnectDone(int status) { |
| 218 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455884 is fixed. |
| 219 tracked_objects::ScopedTracker tracking_profile( |
| 220 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 221 "455884 ProxyResolvingClientSocket::ProcessConnectDone")); |
| 217 if (status != net::OK) { | 222 if (status != net::OK) { |
| 218 // If the connection fails, try another proxy. | 223 // If the connection fails, try another proxy. |
| 219 status = ReconsiderProxyAfterError(status); | 224 status = ReconsiderProxyAfterError(status); |
| 220 // ReconsiderProxyAfterError either returns an error (in which case it is | 225 // ReconsiderProxyAfterError either returns an error (in which case it is |
| 221 // not reconsidering a proxy) or returns ERR_IO_PENDING if it is considering | 226 // not reconsidering a proxy) or returns ERR_IO_PENDING if it is considering |
| 222 // another proxy. | 227 // another proxy. |
| 223 DCHECK_NE(status, net::OK); | 228 DCHECK_NE(status, net::OK); |
| 224 if (status == net::ERR_IO_PENDING) | 229 if (status == net::ERR_IO_PENDING) |
| 225 // Proxy reconsideration pending. Return. | 230 // Proxy reconsideration pending. Return. |
| 226 return; | 231 return; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 return false; | 427 return false; |
| 423 } | 428 } |
| 424 | 429 |
| 425 void ProxyResolvingClientSocket::CloseTransportSocket() { | 430 void ProxyResolvingClientSocket::CloseTransportSocket() { |
| 426 if (transport_.get() && transport_->socket()) | 431 if (transport_.get() && transport_->socket()) |
| 427 transport_->socket()->Disconnect(); | 432 transport_->socket()->Disconnect(); |
| 428 transport_.reset(); | 433 transport_.reset(); |
| 429 } | 434 } |
| 430 | 435 |
| 431 } // namespace jingle_glue | 436 } // namespace jingle_glue |
| OLD | NEW |