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

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

Issue 42541: Prioritize which HTTP requests get a socket first by adding a priority level ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/base/client_socket_handle.h ('k') | net/base/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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/base/client_socket_handle.h" 5 #include "net/base/client_socket_handle.h"
6 6
7 #include "net/base/client_socket.h" 7 #include "net/base/client_socket.h"
8 #include "net/base/client_socket_pool.h" 8 #include "net/base/client_socket_pool.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 ClientSocketHandle::ClientSocketHandle(ClientSocketPool* pool) 12 ClientSocketHandle::ClientSocketHandle(ClientSocketPool* pool)
13 : pool_(pool), socket_(NULL) { 13 : pool_(pool), socket_(NULL) {
14 } 14 }
15 15
16 ClientSocketHandle::~ClientSocketHandle() { 16 ClientSocketHandle::~ClientSocketHandle() {
17 Reset(); 17 Reset();
18 } 18 }
19 19
20 int ClientSocketHandle::Init(const std::string& group_name, 20 int ClientSocketHandle::Init(const std::string& group_name,
21 int priority,
21 CompletionCallback* callback) { 22 CompletionCallback* callback) {
22 Reset(); 23 Reset();
23 group_name_ = group_name; 24 group_name_ = group_name;
24 return pool_->RequestSocket(this, callback); 25 return pool_->RequestSocket(this, priority, callback);
25 } 26 }
26 27
27 void ClientSocketHandle::Reset() { 28 void ClientSocketHandle::Reset() {
28 if (group_name_.empty()) // Was Init called? 29 if (group_name_.empty()) // Was Init called?
29 return; 30 return;
30 if (socket_) { 31 if (socket_) {
31 pool_->ReleaseSocket(this); 32 pool_->ReleaseSocket(this);
32 socket_ = NULL; 33 socket_ = NULL;
33 } else { 34 } else {
34 pool_->CancelRequest(this); 35 pool_->CancelRequest(this);
35 } 36 }
36 group_name_.clear(); 37 group_name_.clear();
37 } 38 }
38 39
39 } // namespace net 40 } // namespace net
OLDNEW
« no previous file with comments | « net/base/client_socket_handle.h ('k') | net/base/client_socket_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698