| 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 13 matching lines...) Expand all Loading... |
| 24 higher_pool_(NULL), | 24 higher_pool_(NULL), |
| 25 reuse_type_(ClientSocketHandle::UNUSED), | 25 reuse_type_(ClientSocketHandle::UNUSED), |
| 26 callback_(base::Bind(&ClientSocketHandle::OnIOComplete, | 26 callback_(base::Bind(&ClientSocketHandle::OnIOComplete, |
| 27 base::Unretained(this))), | 27 base::Unretained(this))), |
| 28 is_ssl_error_(false) {} | 28 is_ssl_error_(false) {} |
| 29 | 29 |
| 30 ClientSocketHandle::~ClientSocketHandle() { | 30 ClientSocketHandle::~ClientSocketHandle() { |
| 31 Reset(); | 31 Reset(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void ClientSocketHandle::SetPriority(RequestPriority priority) { |
| 35 if (socket_) { |
| 36 // The priority of the handle is no longer relevant to the socket pool; |
| 37 // just return. |
| 38 return; |
| 39 } |
| 40 |
| 41 if (pool_) |
| 42 pool_->SetPriority(group_name_, this, priority); |
| 43 } |
| 44 |
| 34 void ClientSocketHandle::Reset() { | 45 void ClientSocketHandle::Reset() { |
| 35 ResetInternal(true); | 46 ResetInternal(true); |
| 36 ResetErrorState(); | 47 ResetErrorState(); |
| 37 } | 48 } |
| 38 | 49 |
| 39 void ClientSocketHandle::ResetInternal(bool cancel) { | 50 void ClientSocketHandle::ResetInternal(bool cancel) { |
| 40 // Was Init called? | 51 // Was Init called? |
| 41 if (!group_name_.empty()) { | 52 if (!group_name_.empty()) { |
| 42 // If so, we must have a pool. | 53 // If so, we must have a pool. |
| 43 CHECK(pool_); | 54 CHECK(pool_); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // Broadcast that the socket has been acquired. | 181 // Broadcast that the socket has been acquired. |
| 171 // TODO(eroman): This logging is not complete, in particular set_socket() and | 182 // TODO(eroman): This logging is not complete, in particular set_socket() and |
| 172 // release() socket. It ends up working though, since those methods are being | 183 // release() socket. It ends up working though, since those methods are being |
| 173 // used to layer sockets (and the destination sources are the same). | 184 // used to layer sockets (and the destination sources are the same). |
| 174 DCHECK(socket_.get()); | 185 DCHECK(socket_.get()); |
| 175 socket_->NetLog().BeginEvent(NetLogEventType::SOCKET_IN_USE, | 186 socket_->NetLog().BeginEvent(NetLogEventType::SOCKET_IN_USE, |
| 176 requesting_source_.ToEventParametersCallback()); | 187 requesting_source_.ToEventParametersCallback()); |
| 177 } | 188 } |
| 178 | 189 |
| 179 } // namespace net | 190 } // namespace net |
| OLD | NEW |