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

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

Issue 1051023003: Change ClientSocketPoolManager::InitSocketHandleForHttpRequest and friends (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 // ClientSocketPoolManager manages access to all ClientSocketPools. It's a 5 // ClientSocketPoolManager manages access to all ClientSocketPools. It's a
6 // simple container for all of them. Most importantly, it handles the lifetime 6 // simple container for all of them. Most importantly, it handles the lifetime
7 // and destruction order properly. 7 // and destruction order properly.
8 8
9 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ 9 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_
10 #define NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ 10 #define NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_
(...skipping 26 matching lines...) Expand all
37 class SSLClientSocketPool; 37 class SSLClientSocketPool;
38 38
39 struct SSLConfig; 39 struct SSLConfig;
40 40
41 // This should rather be a simple constant but Windows shared libs doesn't 41 // This should rather be a simple constant but Windows shared libs doesn't
42 // really offer much flexiblity in exporting contants. 42 // really offer much flexiblity in exporting contants.
43 enum DefaultMaxValues { kDefaultMaxSocketsPerProxyServer = 32 }; 43 enum DefaultMaxValues { kDefaultMaxSocketsPerProxyServer = 32 };
44 44
45 class NET_EXPORT_PRIVATE ClientSocketPoolManager { 45 class NET_EXPORT_PRIVATE ClientSocketPoolManager {
46 public: 46 public:
47 enum SocketGroupType { NORMAL_GROUP, SSL_GROUP, FTP_GROUP };
mmenke 2015/04/07 16:36:58 It's not clear what a group type is, particular wi
Ryan Hamilton 2015/04/07 19:07:31 Done. Hopefully this helps. now that the force_spd
48
49 // Returns the correct socket group type for |scheme|.
50 static SocketGroupType GroupTypeFromScheme(const std::string& scheme);
51
47 ClientSocketPoolManager(); 52 ClientSocketPoolManager();
48 virtual ~ClientSocketPoolManager(); 53 virtual ~ClientSocketPoolManager();
49 54
50 // The setter methods below affect only newly created socket pools after the 55 // The setter methods below affect only newly created socket pools after the
51 // methods are called. Normally they should be called at program startup 56 // methods are called. Normally they should be called at program startup
52 // before any ClientSocketPoolManagerImpl is created. 57 // before any ClientSocketPoolManagerImpl is created.
53 static int max_sockets_per_pool(HttpNetworkSession::SocketPoolType pool_type); 58 static int max_sockets_per_pool(HttpNetworkSession::SocketPoolType pool_type);
54 static void set_max_sockets_per_pool( 59 static void set_max_sockets_per_pool(
55 HttpNetworkSession::SocketPoolType pool_type, 60 HttpNetworkSession::SocketPoolType pool_type,
56 int socket_count); 61 int socket_count);
(...skipping 26 matching lines...) Expand all
83 }; 88 };
84 89
85 // A helper method that uses the passed in proxy information to initialize a 90 // A helper method that uses the passed in proxy information to initialize a
86 // ClientSocketHandle with the relevant socket pool. Use this method for 91 // ClientSocketHandle with the relevant socket pool. Use this method for
87 // HTTP/HTTPS requests. |ssl_config_for_origin| is only used if the request 92 // HTTP/HTTPS requests. |ssl_config_for_origin| is only used if the request
88 // uses SSL and |ssl_config_for_proxy| is used if the proxy server is HTTPS. 93 // uses SSL and |ssl_config_for_proxy| is used if the proxy server is HTTPS.
89 // |resolution_callback| will be invoked after the the hostname is 94 // |resolution_callback| will be invoked after the the hostname is
90 // resolved. If |resolution_callback| does not return OK, then the 95 // resolved. If |resolution_callback| does not return OK, then the
91 // connection will be aborted with that value. 96 // connection will be aborted with that value.
92 int InitSocketHandleForHttpRequest( 97 int InitSocketHandleForHttpRequest(
93 const GURL& request_url, 98 ClientSocketPoolManager::SocketGroupType group_type,
99 const HostPortPair& endpoint,
94 const HttpRequestHeaders& request_extra_headers, 100 const HttpRequestHeaders& request_extra_headers,
95 int request_load_flags, 101 int request_load_flags,
96 RequestPriority request_priority, 102 RequestPriority request_priority,
97 HttpNetworkSession* session, 103 HttpNetworkSession* session,
98 const ProxyInfo& proxy_info, 104 const ProxyInfo& proxy_info,
99 bool force_spdy_over_ssl, 105 bool force_spdy_over_ssl,
100 bool want_spdy_over_npn, 106 bool want_spdy_over_npn,
mmenke 2015/04/07 16:36:58 Could you document these two parameters, while you
Ryan Hamilton 2015/04/07 19:07:30 Done. I'm not a fan of "want_spdy_over_npn" as a n
mmenke 2015/04/07 19:24:16 Maybe require_spdy_over_npn? (The imperative seem
101 const SSLConfig& ssl_config_for_origin, 107 const SSLConfig& ssl_config_for_origin,
102 const SSLConfig& ssl_config_for_proxy, 108 const SSLConfig& ssl_config_for_proxy,
103 PrivacyMode privacy_mode, 109 PrivacyMode privacy_mode,
104 const BoundNetLog& net_log, 110 const BoundNetLog& net_log,
105 ClientSocketHandle* socket_handle, 111 ClientSocketHandle* socket_handle,
106 const OnHostResolutionCallback& resolution_callback, 112 const OnHostResolutionCallback& resolution_callback,
107 const CompletionCallback& callback); 113 const CompletionCallback& callback);
108 114
109 // A helper method that uses the passed in proxy information to initialize a 115 // A helper method that uses the passed in proxy information to initialize a
110 // ClientSocketHandle with the relevant socket pool. Use this method for 116 // ClientSocketHandle with the relevant socket pool. Use this method for
111 // HTTP/HTTPS requests for WebSocket handshake. 117 // HTTP/HTTPS requests for WebSocket handshake.
112 // |ssl_config_for_origin| is only used if the request 118 // |ssl_config_for_origin| is only used if the request
113 // uses SSL and |ssl_config_for_proxy| is used if the proxy server is HTTPS. 119 // uses SSL and |ssl_config_for_proxy| is used if the proxy server is HTTPS.
114 // |resolution_callback| will be invoked after the the hostname is 120 // |resolution_callback| will be invoked after the the hostname is
115 // resolved. If |resolution_callback| does not return OK, then the 121 // resolved. If |resolution_callback| does not return OK, then the
116 // connection will be aborted with that value. 122 // connection will be aborted with that value.
117 // This function uses WEBSOCKET_SOCKET_POOL socket pools. 123 // This function uses WEBSOCKET_SOCKET_POOL socket pools.
118 int InitSocketHandleForWebSocketRequest( 124 int InitSocketHandleForWebSocketRequest(
119 const GURL& request_url, 125 ClientSocketPoolManager::SocketGroupType group_type,
126 const HostPortPair& endpoint,
120 const HttpRequestHeaders& request_extra_headers, 127 const HttpRequestHeaders& request_extra_headers,
121 int request_load_flags, 128 int request_load_flags,
122 RequestPriority request_priority, 129 RequestPriority request_priority,
123 HttpNetworkSession* session, 130 HttpNetworkSession* session,
124 const ProxyInfo& proxy_info, 131 const ProxyInfo& proxy_info,
125 bool force_spdy_over_ssl, 132 bool force_spdy_over_ssl,
126 bool want_spdy_over_npn, 133 bool want_spdy_over_npn,
127 const SSLConfig& ssl_config_for_origin, 134 const SSLConfig& ssl_config_for_origin,
128 const SSLConfig& ssl_config_for_proxy, 135 const SSLConfig& ssl_config_for_proxy,
129 PrivacyMode privacy_mode, 136 PrivacyMode privacy_mode,
(...skipping 28 matching lines...) Expand all
158 const SSLConfig& ssl_config_for_origin, 165 const SSLConfig& ssl_config_for_origin,
159 const SSLConfig& ssl_config_for_proxy, 166 const SSLConfig& ssl_config_for_proxy,
160 PrivacyMode privacy_mode, 167 PrivacyMode privacy_mode,
161 const BoundNetLog& net_log, 168 const BoundNetLog& net_log,
162 ClientSocketHandle* socket_handle, 169 ClientSocketHandle* socket_handle,
163 const CompletionCallback& callback); 170 const CompletionCallback& callback);
164 171
165 // Similar to InitSocketHandleForHttpRequest except that it initiates the 172 // Similar to InitSocketHandleForHttpRequest except that it initiates the
166 // desired number of preconnect streams from the relevant socket pool. 173 // desired number of preconnect streams from the relevant socket pool.
167 int PreconnectSocketsForHttpRequest( 174 int PreconnectSocketsForHttpRequest(
168 const GURL& request_url, 175 ClientSocketPoolManager::SocketGroupType group_type,
176 const HostPortPair& endpoint,
169 const HttpRequestHeaders& request_extra_headers, 177 const HttpRequestHeaders& request_extra_headers,
170 int request_load_flags, 178 int request_load_flags,
171 RequestPriority request_priority, 179 RequestPriority request_priority,
172 HttpNetworkSession* session, 180 HttpNetworkSession* session,
173 const ProxyInfo& proxy_info, 181 const ProxyInfo& proxy_info,
174 bool force_spdy_over_ssl, 182 bool force_spdy_over_ssl,
175 bool want_spdy_over_npn, 183 bool want_spdy_over_npn,
176 const SSLConfig& ssl_config_for_origin, 184 const SSLConfig& ssl_config_for_origin,
177 const SSLConfig& ssl_config_for_proxy, 185 const SSLConfig& ssl_config_for_proxy,
178 PrivacyMode privacy_mode, 186 PrivacyMode privacy_mode,
179 const BoundNetLog& net_log, 187 const BoundNetLog& net_log,
180 int num_preconnect_streams); 188 int num_preconnect_streams);
181 189
182 } // namespace net 190 } // namespace net
183 191
184 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ 192 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698