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

Side by Side Diff: net/socket/tcp_client_socket_pool.h

Issue 1808001: Implement a 15 connection per proxy server limit. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Remove extra newline. Created 10 years, 7 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_
6 #define NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "base/timer.h" 14 #include "base/timer.h"
15 #include "net/base/host_port_pair.h"
15 #include "net/base/host_resolver.h" 16 #include "net/base/host_resolver.h"
16 #include "net/socket/client_socket_pool_base.h" 17 #include "net/socket/client_socket_pool_base.h"
17 #include "net/socket/client_socket_pool.h" 18 #include "net/socket/client_socket_pool.h"
18 19
19 namespace net { 20 namespace net {
20 21
21 class ClientSocketFactory; 22 class ClientSocketFactory;
22 23
23 class TCPSocketParams { 24 class TCPSocketParams {
24 public: 25 public:
26 TCPSocketParams(const HostPortPair& host_port_pair, RequestPriority priority,
27 const GURL& referrer, bool disable_resolver_cache)
28 : destination_(host_port_pair.host, host_port_pair.port) {
29 Initialize(priority, referrer, disable_resolver_cache);
30 }
31
32 // TODO(willchan): Update all unittests so we don't need this.
25 TCPSocketParams(const std::string& host, int port, RequestPriority priority, 33 TCPSocketParams(const std::string& host, int port, RequestPriority priority,
26 const GURL& referrer, bool disable_resolver_cache) 34 const GURL& referrer, bool disable_resolver_cache)
27 : destination_(host, port) { 35 : destination_(host, port) {
36 Initialize(priority, referrer, disable_resolver_cache);
37 }
38
39 HostResolver::RequestInfo destination() const { return destination_; }
40
41 private:
42 void Initialize(RequestPriority priority, const GURL& referrer,
43 bool disable_resolver_cache) {
28 // The referrer is used by the DNS prefetch system to correlate resolutions 44 // The referrer is used by the DNS prefetch system to correlate resolutions
29 // with the page that triggered them. It doesn't impact the actual addresses 45 // with the page that triggered them. It doesn't impact the actual addresses
30 // that we resolve to. 46 // that we resolve to.
31 destination_.set_referrer(referrer); 47 destination_.set_referrer(referrer);
32 destination_.set_priority(priority); 48 destination_.set_priority(priority);
33 if (disable_resolver_cache) 49 if (disable_resolver_cache)
34 destination_.set_allow_cached_response(false); 50 destination_.set_allow_cached_response(false);
35 } 51 }
36 52
37 HostResolver::RequestInfo destination() const { return destination_; }
38
39 private:
40 HostResolver::RequestInfo destination_; 53 HostResolver::RequestInfo destination_;
41 }; 54 };
42 55
43 // TCPConnectJob handles the host resolution necessary for socket creation 56 // TCPConnectJob handles the host resolution necessary for socket creation
44 // and the tcp connect. 57 // and the tcp connect.
45 class TCPConnectJob : public ConnectJob { 58 class TCPConnectJob : public ConnectJob {
46 public: 59 public:
47 TCPConnectJob(const std::string& group_name, 60 TCPConnectJob(const std::string& group_name,
48 const TCPSocketParams& params, 61 const TCPSocketParams& params,
49 base::TimeDelta timeout_duration, 62 base::TimeDelta timeout_duration,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 PoolBase base_; 187 PoolBase base_;
175 188
176 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool); 189 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool);
177 }; 190 };
178 191
179 REGISTER_SOCKET_PARAMS_FOR_POOL(TCPClientSocketPool, TCPSocketParams) 192 REGISTER_SOCKET_PARAMS_FOR_POOL(TCPClientSocketPool, TCPSocketParams)
180 193
181 } // namespace net 194 } // namespace net
182 195
183 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ 196 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698