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

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

Issue 826973002: replace COMPILE_ASSERT with static_assert in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply fixups Created 5 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
« no previous file with comments | « net/quic/port_suggester.cc ('k') | net/socket/client_socket_pool_manager_impl.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_pool_manager.h" 5 #include "net/socket/client_socket_pool_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 11 matching lines...) Expand all
22 namespace net { 22 namespace net {
23 23
24 namespace { 24 namespace {
25 25
26 // Limit of sockets of each socket pool. 26 // Limit of sockets of each socket pool.
27 int g_max_sockets_per_pool[] = { 27 int g_max_sockets_per_pool[] = {
28 256, // NORMAL_SOCKET_POOL 28 256, // NORMAL_SOCKET_POOL
29 256 // WEBSOCKET_SOCKET_POOL 29 256 // WEBSOCKET_SOCKET_POOL
30 }; 30 };
31 31
32 COMPILE_ASSERT(arraysize(g_max_sockets_per_pool) == 32 static_assert(arraysize(g_max_sockets_per_pool) ==
33 HttpNetworkSession::NUM_SOCKET_POOL_TYPES, 33 HttpNetworkSession::NUM_SOCKET_POOL_TYPES,
34 max_sockets_per_pool_length_mismatch); 34 "max sockets per pool length mismatch");
35 35
36 // Default to allow up to 6 connections per host. Experiment and tuning may 36 // Default to allow up to 6 connections per host. Experiment and tuning may
37 // try other values (greater than 0). Too large may cause many problems, such 37 // try other values (greater than 0). Too large may cause many problems, such
38 // as home routers blocking the connections!?!? See http://crbug.com/12066. 38 // as home routers blocking the connections!?!? See http://crbug.com/12066.
39 // 39 //
40 // WebSocket connections are long-lived, and should be treated differently 40 // WebSocket connections are long-lived, and should be treated differently
41 // than normal other connections. 6 connections per group sounded too small 41 // than normal other connections. 6 connections per group sounded too small
42 // for such use, thus we use a larger limit which was determined somewhat 42 // for such use, thus we use a larger limit which was determined somewhat
43 // arbitrarily. 43 // arbitrarily.
44 // TODO(yutak): Look at the usage and determine the right value after 44 // TODO(yutak): Look at the usage and determine the right value after
45 // WebSocket protocol stack starts to work. 45 // WebSocket protocol stack starts to work.
46 int g_max_sockets_per_group[] = { 46 int g_max_sockets_per_group[] = {
47 6, // NORMAL_SOCKET_POOL 47 6, // NORMAL_SOCKET_POOL
48 30 // WEBSOCKET_SOCKET_POOL 48 30 // WEBSOCKET_SOCKET_POOL
49 }; 49 };
50 50
51 COMPILE_ASSERT(arraysize(g_max_sockets_per_group) == 51 static_assert(arraysize(g_max_sockets_per_group) ==
52 HttpNetworkSession::NUM_SOCKET_POOL_TYPES, 52 HttpNetworkSession::NUM_SOCKET_POOL_TYPES,
53 max_sockets_per_group_length_mismatch); 53 "max sockets per group length mismatch");
54 54
55 // The max number of sockets to allow per proxy server. This applies both to 55 // The max number of sockets to allow per proxy server. This applies both to
56 // http and SOCKS proxies. See http://crbug.com/12066 and 56 // http and SOCKS proxies. See http://crbug.com/12066 and
57 // http://crbug.com/44501 for details about proxy server connection limits. 57 // http://crbug.com/44501 for details about proxy server connection limits.
58 int g_max_sockets_per_proxy_server[] = { 58 int g_max_sockets_per_proxy_server[] = {
59 kDefaultMaxSocketsPerProxyServer, // NORMAL_SOCKET_POOL 59 kDefaultMaxSocketsPerProxyServer, // NORMAL_SOCKET_POOL
60 kDefaultMaxSocketsPerProxyServer // WEBSOCKET_SOCKET_POOL 60 kDefaultMaxSocketsPerProxyServer // WEBSOCKET_SOCKET_POOL
61 }; 61 };
62 62
63 COMPILE_ASSERT(arraysize(g_max_sockets_per_proxy_server) == 63 static_assert(arraysize(g_max_sockets_per_proxy_server) ==
64 HttpNetworkSession::NUM_SOCKET_POOL_TYPES, 64 HttpNetworkSession::NUM_SOCKET_POOL_TYPES,
65 max_sockets_per_proxy_server_length_mismatch); 65 "max sockets per proxy server length mismatch");
66 66
67 // The meat of the implementation for the InitSocketHandleForHttpRequest, 67 // The meat of the implementation for the InitSocketHandleForHttpRequest,
68 // InitSocketHandleForRawConnect and PreconnectSocketsForHttpRequest methods. 68 // InitSocketHandleForRawConnect and PreconnectSocketsForHttpRequest methods.
69 int InitSocketPoolHelper(const GURL& request_url, 69 int InitSocketPoolHelper(const GURL& request_url,
70 const HttpRequestHeaders& request_extra_headers, 70 const HttpRequestHeaders& request_extra_headers,
71 int request_load_flags, 71 int request_load_flags,
72 RequestPriority request_priority, 72 RequestPriority request_priority,
73 HttpNetworkSession* session, 73 HttpNetworkSession* session,
74 const ProxyInfo& proxy_info, 74 const ProxyInfo& proxy_info,
75 bool force_spdy_over_ssl, 75 bool force_spdy_over_ssl,
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 int num_preconnect_streams) { 506 int num_preconnect_streams) {
507 return InitSocketPoolHelper( 507 return InitSocketPoolHelper(
508 request_url, request_extra_headers, request_load_flags, request_priority, 508 request_url, request_extra_headers, request_load_flags, request_priority,
509 session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn, 509 session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn,
510 ssl_config_for_origin, ssl_config_for_proxy, false, privacy_mode, net_log, 510 ssl_config_for_origin, ssl_config_for_proxy, false, privacy_mode, net_log,
511 num_preconnect_streams, NULL, HttpNetworkSession::NORMAL_SOCKET_POOL, 511 num_preconnect_streams, NULL, HttpNetworkSession::NORMAL_SOCKET_POOL,
512 OnHostResolutionCallback(), CompletionCallback()); 512 OnHostResolutionCallback(), CompletionCallback());
513 } 513 }
514 514
515 } // namespace net 515 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/port_suggester.cc ('k') | net/socket/client_socket_pool_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698