| 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/socket/client_socket_handle.h" | 5 #include "net/socket/client_socket_handle.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 15 #include "net/socket/client_socket_pool.h" | 15 #include "net/socket/client_socket_pool.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 ClientSocketHandle::ClientSocketHandle() | 19 ClientSocketHandle::ClientSocketHandle() |
| 20 : is_initialized_(false), | 20 : is_initialized_(false), |
| 21 pool_(NULL), | 21 pool_(NULL), |
| 22 higher_pool_(NULL), | 22 higher_pool_(NULL), |
| 23 reuse_type_(ClientSocketHandle::UNUSED), | 23 reuse_type_(ClientSocketHandle::UNUSED), |
| 24 callback_(base::Bind(&ClientSocketHandle::OnIOComplete, | 24 callback_(base::Bind(&ClientSocketHandle::OnIOComplete, |
| 25 base::Unretained(this))), | 25 base::Unretained(this))), |
| 26 is_ssl_error_(false), | 26 is_ssl_error_(false) {} |
| 27 ssl_failure_state_(SSL_FAILURE_NONE) { | |
| 28 } | |
| 29 | 27 |
| 30 ClientSocketHandle::~ClientSocketHandle() { | 28 ClientSocketHandle::~ClientSocketHandle() { |
| 31 Reset(); | 29 Reset(); |
| 32 } | 30 } |
| 33 | 31 |
| 34 void ClientSocketHandle::Reset() { | 32 void ClientSocketHandle::Reset() { |
| 35 ResetInternal(true); | 33 ResetInternal(true); |
| 36 ResetErrorState(); | 34 ResetErrorState(); |
| 37 } | 35 } |
| 38 | 36 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 69 idle_time_ = base::TimeDelta(); | 67 idle_time_ = base::TimeDelta(); |
| 70 init_time_ = base::TimeTicks(); | 68 init_time_ = base::TimeTicks(); |
| 71 setup_time_ = base::TimeDelta(); | 69 setup_time_ = base::TimeDelta(); |
| 72 connect_timing_ = LoadTimingInfo::ConnectTiming(); | 70 connect_timing_ = LoadTimingInfo::ConnectTiming(); |
| 73 pool_id_ = -1; | 71 pool_id_ = -1; |
| 74 } | 72 } |
| 75 | 73 |
| 76 void ClientSocketHandle::ResetErrorState() { | 74 void ClientSocketHandle::ResetErrorState() { |
| 77 is_ssl_error_ = false; | 75 is_ssl_error_ = false; |
| 78 ssl_error_response_info_ = HttpResponseInfo(); | 76 ssl_error_response_info_ = HttpResponseInfo(); |
| 79 ssl_failure_state_ = SSL_FAILURE_NONE; | |
| 80 pending_http_proxy_connection_.reset(); | 77 pending_http_proxy_connection_.reset(); |
| 81 } | 78 } |
| 82 | 79 |
| 83 LoadState ClientSocketHandle::GetLoadState() const { | 80 LoadState ClientSocketHandle::GetLoadState() const { |
| 84 CHECK(!is_initialized()); | 81 CHECK(!is_initialized()); |
| 85 CHECK(!group_name_.empty()); | 82 CHECK(!group_name_.empty()); |
| 86 // Because of http://crbug.com/37810 we may not have a pool, but have | 83 // Because of http://crbug.com/37810 we may not have a pool, but have |
| 87 // just a raw socket. | 84 // just a raw socket. |
| 88 if (!pool_) | 85 if (!pool_) |
| 89 return LOAD_STATE_IDLE; | 86 return LOAD_STATE_IDLE; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // TODO(eroman): This logging is not complete, in particular set_socket() and | 166 // TODO(eroman): This logging is not complete, in particular set_socket() and |
| 170 // release() socket. It ends up working though, since those methods are being | 167 // release() socket. It ends up working though, since those methods are being |
| 171 // used to layer sockets (and the destination sources are the same). | 168 // used to layer sockets (and the destination sources are the same). |
| 172 DCHECK(socket_.get()); | 169 DCHECK(socket_.get()); |
| 173 socket_->NetLog().BeginEvent( | 170 socket_->NetLog().BeginEvent( |
| 174 NetLog::TYPE_SOCKET_IN_USE, | 171 NetLog::TYPE_SOCKET_IN_USE, |
| 175 requesting_source_.ToEventParametersCallback()); | 172 requesting_source_.ToEventParametersCallback()); |
| 176 } | 173 } |
| 177 | 174 |
| 178 } // namespace net | 175 } // namespace net |
| OLD | NEW |