Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: net/socket/client_socket_handle.cc

Issue 1898133002: Add reprioritization to socket pools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix glitch in ClientSocketHandle API contract. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 //
39 // TODO (rdsmith): Incorporate change in priority information into TCP
40 // params on this socket.
mmenke 2017/01/05 20:18:35 TransportSocketParams don't have a priority, no so
Randy Smith (Not in Mondays) 2017/01/13 23:05:44 Sorry, didn't mean TransportSocketParams, more TCP
41 return;
42 }
43
44 if (pool_)
mmenke 2017/01/05 20:18:35 Just destroying the socket seems to return it to t
Randy Smith (Not in Mondays) 2017/01/13 23:05:44 Believe the result of this comment was tracked at
mmenke 2017/01/17 18:56:31 That's right.
45 pool_->SetPriority(group_name_, this, priority);
mmenke 2017/01/05 20:18:35 Let me try and get a better...handle... on the li
Randy Smith (Not in Mondays) 2017/01/13 23:05:44 See last comment response :-}.
46 }
47
34 void ClientSocketHandle::Reset() { 48 void ClientSocketHandle::Reset() {
35 ResetInternal(true); 49 ResetInternal(true);
36 ResetErrorState(); 50 ResetErrorState();
37 } 51 }
38 52
39 void ClientSocketHandle::ResetInternal(bool cancel) { 53 void ClientSocketHandle::ResetInternal(bool cancel) {
40 // Was Init called? 54 // Was Init called?
41 if (!group_name_.empty()) { 55 if (!group_name_.empty()) {
42 // If so, we must have a pool. 56 // If so, we must have a pool.
43 CHECK(pool_); 57 CHECK(pool_);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Broadcast that the socket has been acquired. 184 // Broadcast that the socket has been acquired.
171 // TODO(eroman): This logging is not complete, in particular set_socket() and 185 // 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 186 // release() socket. It ends up working though, since those methods are being
173 // used to layer sockets (and the destination sources are the same). 187 // used to layer sockets (and the destination sources are the same).
174 DCHECK(socket_.get()); 188 DCHECK(socket_.get());
175 socket_->NetLog().BeginEvent(NetLogEventType::SOCKET_IN_USE, 189 socket_->NetLog().BeginEvent(NetLogEventType::SOCKET_IN_USE,
176 requesting_source_.ToEventParametersCallback()); 190 requesting_source_.ToEventParametersCallback());
177 } 191 }
178 192
179 } // namespace net 193 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698