| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/socket/client_socket_pool.h" | 13 #include "net/socket/client_socket_pool.h" |
| 14 #include "net/socket/client_socket_pool_histograms.h" | 14 #include "net/socket/client_socket_pool_histograms.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 ClientSocketHandle::ClientSocketHandle() | 18 ClientSocketHandle::ClientSocketHandle() |
| 19 : is_initialized_(false), | 19 : is_initialized_(false), |
| 20 pool_(NULL), | 20 pool_(NULL), |
| 21 higher_pool_(NULL), | 21 higher_pool_(NULL), |
| 22 reuse_type_(ClientSocketHandle::UNUSED), | 22 reuse_type_(ClientSocketHandle::UNUSED), |
| 23 callback_(base::Bind(&ClientSocketHandle::OnIOComplete, | 23 callback_(base::Bind(&ClientSocketHandle::OnIOComplete, |
| 24 base::Unretained(this))), | 24 base::Unretained(this))), |
| 25 is_ssl_error_(false) {} | 25 is_ssl_error_(false) { |
| 26 } |
| 26 | 27 |
| 27 ClientSocketHandle::~ClientSocketHandle() { | 28 ClientSocketHandle::~ClientSocketHandle() { |
| 28 Reset(); | 29 Reset(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 void ClientSocketHandle::Reset() { | 32 void ClientSocketHandle::Reset() { |
| 32 ResetInternal(true); | 33 ResetInternal(true); |
| 33 ResetErrorState(); | 34 ResetErrorState(); |
| 34 } | 35 } |
| 35 | 36 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 default: | 177 default: |
| 177 NOTREACHED(); | 178 NOTREACHED(); |
| 178 break; | 179 break; |
| 179 } | 180 } |
| 180 | 181 |
| 181 // Broadcast that the socket has been acquired. | 182 // Broadcast that the socket has been acquired. |
| 182 // TODO(eroman): This logging is not complete, in particular set_socket() and | 183 // TODO(eroman): This logging is not complete, in particular set_socket() and |
| 183 // release() socket. It ends up working though, since those methods are being | 184 // release() socket. It ends up working though, since those methods are being |
| 184 // used to layer sockets (and the destination sources are the same). | 185 // used to layer sockets (and the destination sources are the same). |
| 185 DCHECK(socket_.get()); | 186 DCHECK(socket_.get()); |
| 186 socket_->NetLog().BeginEvent( | 187 socket_->NetLog().BeginEvent(NetLog::TYPE_SOCKET_IN_USE, |
| 187 NetLog::TYPE_SOCKET_IN_USE, | 188 requesting_source_.ToEventParametersCallback()); |
| 188 requesting_source_.ToEventParametersCallback()); | |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace net | 191 } // namespace net |
| OLD | NEW |