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

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: Incorporated comments. Created 3 years, 10 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
« no previous file with comments | « net/socket/client_socket_handle.h ('k') | net/socket/client_socket_pool.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // Broadcast that the socket has been acquired. 182 // Broadcast that the socket has been acquired.
172 // 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
173 // 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
174 // used to layer sockets (and the destination sources are the same). 185 // used to layer sockets (and the destination sources are the same).
175 DCHECK(socket_.get()); 186 DCHECK(socket_.get());
176 socket_->NetLog().BeginEvent(NetLogEventType::SOCKET_IN_USE, 187 socket_->NetLog().BeginEvent(NetLogEventType::SOCKET_IN_USE,
177 requesting_source_.ToEventParametersCallback()); 188 requesting_source_.ToEventParametersCallback());
178 } 189 }
179 190
180 } // namespace net 191 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_handle.h ('k') | net/socket/client_socket_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698