| 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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 void ClientSocketHandle::ResetInternal(bool cancel) { | 38 void ClientSocketHandle::ResetInternal(bool cancel) { |
| 39 // Was Init called? | 39 // Was Init called? |
| 40 if (!group_name_.empty()) { | 40 if (!group_name_.empty()) { |
| 41 // If so, we must have a pool. | 41 // If so, we must have a pool. |
| 42 CHECK(pool_); | 42 CHECK(pool_); |
| 43 if (is_initialized()) { | 43 if (is_initialized()) { |
| 44 if (socket_) { | 44 if (socket_) { |
| 45 socket_->NetLog().EndEvent(NetLogEventType::SOCKET_IN_USE); | 45 socket_->NetLog().EndEvent(NetLogEventType::SOCKET_IN_USE); |
| 46 // Release the socket back to the ClientSocketPool so it can be | 46 // Release the socket back to the ClientSocketPool so it can be |
| 47 // deleted or reused. | 47 // deleted or reused. |
| 48 pool_->ReleaseSocket(group_name_, std::move(socket_), pool_id_); | 48 pool_->ReleaseSocket(group_name_, std::move(socket_), pool_id_, |
| 49 connect_timing_); |
| 49 } else { | 50 } else { |
| 50 // If the handle has been initialized, we should still have a | 51 // If the handle has been initialized, we should still have a |
| 51 // socket. | 52 // socket. |
| 52 NOTREACHED(); | 53 NOTREACHED(); |
| 53 } | 54 } |
| 54 } else if (cancel) { | 55 } else if (cancel) { |
| 55 // If we did not get initialized yet and we have a socket | 56 // If we did not get initialized yet and we have a socket |
| 56 // request pending, cancel it. | 57 // request pending, cancel it. |
| 57 pool_->CancelRequest(group_name_, this); | 58 pool_->CancelRequest(group_name_, this); |
| 58 } | 59 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Broadcast that the socket has been acquired. | 167 // Broadcast that the socket has been acquired. |
| 167 // TODO(eroman): This logging is not complete, in particular set_socket() and | 168 // TODO(eroman): This logging is not complete, in particular set_socket() and |
| 168 // release() socket. It ends up working though, since those methods are being | 169 // release() socket. It ends up working though, since those methods are being |
| 169 // used to layer sockets (and the destination sources are the same). | 170 // used to layer sockets (and the destination sources are the same). |
| 170 DCHECK(socket_.get()); | 171 DCHECK(socket_.get()); |
| 171 socket_->NetLog().BeginEvent(NetLogEventType::SOCKET_IN_USE, | 172 socket_->NetLog().BeginEvent(NetLogEventType::SOCKET_IN_USE, |
| 172 requesting_source_.ToEventParametersCallback()); | 173 requesting_source_.ToEventParametersCallback()); |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace net | 176 } // namespace net |
| OLD | NEW |