diff options
author | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-11 09:35:45 +0000 |
---|---|---|
committer | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-11 09:35:45 +0000 |
commit | 12c84e28a1eee00b8f2bb60c10395e9bf6007241 (patch) | |
tree | 4532fb4d65a980b155873c9ac35488eef53d16be /chrome | |
parent | fbf45bc40900fb2be79e5938831ffd0f5f4c7514 (diff) | |
download | chromium_src-12c84e28a1eee00b8f2bb60c10395e9bf6007241.zip chromium_src-12c84e28a1eee00b8f2bb60c10395e9bf6007241.tar.gz chromium_src-12c84e28a1eee00b8f2bb60c10395e9bf6007241.tar.bz2 |
Introduce a policy to control the maximal number of connections per proxy server.
BUG=63658
TEST=All policy unit_tests should pass.
Review URL: http://codereview.chromium.org/7326017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91998 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/policy/policy_templates.json | 18 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 12 | ||||
-rw-r--r-- | chrome/browser/browser_main.h | 3 | ||||
-rw-r--r-- | chrome/browser/browser_process_impl.cc | 10 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.cc | 4 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_provider_mac_unittest.cc | 5 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_provider_win_unittest.cc | 5 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 1 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 1 |
10 files changed, 55 insertions, 8 deletions
diff --git a/chrome/app/policy/policy_templates.json b/chrome/app/policy/policy_templates.json index 6e7e6cd..ab98226 100644 --- a/chrome/app/policy/policy_templates.json +++ b/chrome/app/policy/policy_templates.json @@ -94,7 +94,7 @@ # persistent IDs for all fields (but not for groups!) are needed. These are # specified by the 'id' keys of each policy. NEVER CHANGE EXISTING IDs, # because doing so would break the deployed wire format! -# For your editing convenience: highest ID currently used: 91 +# For your editing convenience: highest ID currently used: 92 # # Placeholders: # The following placeholder strings are automatically substituted: @@ -1593,6 +1593,22 @@ 'caption': '''Release channel''', 'desc': '''Specifies the release channel that this device should be locked to. This policy is a work in progress; currently, the user can still change the release channel even if it's specified by the policy.''' }, + { + 'name': 'MaxConnectionsPerProxy', + 'type': 'int', + 'supported_on': ['chrome_os:1.0-','chrome.*:14-'], + 'features': {'dynamic_refresh': 0}, + 'example_value': 32, + 'id': 92, + 'caption': '''Maximal number of concurrent connections to the proxy server''', + 'desc': '''Specifies the maximal number of simultanious connections to the proxy server. + + Some proxy servers can not handle high number of concurrent connections per client and this can be solved by setting this policy to a lower value. + + The value of this policy should be lower than 100 and higher than 6 and the default value is 32. + + Some web apps are known to consume many connections with hanging GETs, so lowering below 32 may lead to browser networking hangs if too many such web apps are open. Lower below the default at your own risk.''', + }, ], 'messages': { diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 4b1bd9d..67bd547 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -277,7 +277,9 @@ MetricsService* BrowserMainParts::SetupMetricsAndFieldTrials( // to send metrics. field_trial_list_.reset(new base::FieldTrialList(metrics->GetClientId())); - SetupFieldTrials(metrics->recording_active()); + SetupFieldTrials(metrics->recording_active(), + local_state->IsManagedPreference( + prefs::kMaxConnectionsPerProxy)); // Initialize FieldTrialSynchronizer system. This is a singleton and is used // for posting tasks via NewRunnableMethod. Its deleted when it goes out of @@ -633,7 +635,8 @@ MetricsService* BrowserMainParts::InitializeMetrics( return metrics; } -void BrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled) { +void BrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled, + bool proxy_policy_is_set) { if (metrics_recording_enabled) chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Start(); @@ -641,7 +644,10 @@ void BrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled) { // ProxyConnectionsFieldTrial(). ConnectionFieldTrial(); SocketTimeoutFieldTrial(); - ProxyConnectionsFieldTrial(); + // If a policy is defining the number of active connections this field test + // shoud not be performed. + if (!proxy_policy_is_set) + ProxyConnectionsFieldTrial(); prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); SpdyFieldTrial(); ConnectBackupJobsFieldTrial(); diff --git a/chrome/browser/browser_main.h b/chrome/browser/browser_main.h index e13a12d..85dce6f 100644 --- a/chrome/browser/browser_main.h +++ b/chrome/browser/browser_main.h @@ -147,7 +147,8 @@ class BrowserMainParts { const PrefService* local_state); // Add an invocation of your field trial init function to this method. - void SetupFieldTrials(bool metrics_recording_enabled); + void SetupFieldTrials(bool metrics_recording_enabled, + bool proxy_policy_is_set); // Members initialized on construction --------------------------------------- diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 1b35f11..a68073d 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -78,6 +78,7 @@ #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/common/notification_service.h" #include "ipc/ipc_logging.h" +#include "net/socket/client_socket_pool_manager.h" #include "net/url_request/url_request_context_getter.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/l10n/l10n_util.h" @@ -850,6 +851,15 @@ void BrowserProcessImpl::CreateLocalState() { // able so we need to have it when initializing the profiles. local_state_->RegisterFilePathPref(prefs::kDiskCacheDir, FilePath()); + // Another policy that needs to be defined before the net subsystem is + // initialized is MaxConnectionsPerProxy so we do it here. + local_state_->RegisterIntegerPref(prefs::kMaxConnectionsPerProxy, + net::kDefaultMaxSocketsPerProxyServer); + int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); + net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( + std::max(std::min(max_per_proxy, 99), + net::ClientSocketPoolManager::max_sockets_per_group())); + // This is observed by ChildProcessSecurityPolicy, which lives in content/ // though, so it can't register itself. local_state_->RegisterListPref(prefs::kDisabledSchemes); diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index 3e62c8d..cf44547 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -274,6 +274,8 @@ const ConfigurationPolicyPrefKeeper::PolicyToPreferenceMapEntry prefs::kEditBookmarksEnabled }, { Value::TYPE_BOOLEAN, kPolicyAllowFileSelectionDialogs, prefs::kAllowFileSelectionDialogs }, + { Value::TYPE_INTEGER, kPolicyMaxConnectionsPerProxy, + prefs::kMaxConnectionsPerProxy }, #if defined(OS_CHROMEOS) { Value::TYPE_BOOLEAN, kPolicyChromeOsLockOnIdleSuspend, @@ -1065,6 +1067,8 @@ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { key::kAllowFileSelectionDialogs }, { kPolicyDiskCacheDir, Value::TYPE_STRING, key::kDiskCacheDir }, + { kPolicyMaxConnectionsPerProxy, Value::TYPE_INTEGER, + key::kMaxConnectionsPerProxy }, #if defined(OS_CHROMEOS) { kPolicyChromeOsLockOnIdleSuspend, Value::TYPE_BOOLEAN, diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc index d209228..ca1449f 100644 --- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc @@ -273,7 +273,9 @@ INSTANTIATE_TEST_CASE_P( TypeAndName(kPolicyRestoreOnStartup, prefs::kRestoreOnStartup), TypeAndName(kPolicyPolicyRefreshRate, - prefs::kUserPolicyRefreshRate))); + prefs::kUserPolicyRefreshRate), + TypeAndName(kPolicyMaxConnectionsPerProxy, + prefs::kMaxConnectionsPerProxy))); // Test cases for the proxy policy settings. class ConfigurationPolicyPrefStoreProxyTest : public testing::Test { diff --git a/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc b/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc index 668492d..3a486cf 100644 --- a/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc +++ b/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc @@ -345,6 +345,9 @@ INSTANTIATE_TEST_CASE_P( key::kDisabledSchemes), PolicyTestParams::ForStringPolicy( kPolicyDiskCacheDir, - key::kDiskCacheDir))); + key::kDiskCacheDir), + PolicyTestParams::ForIntegerPolicy( + kPolicyMaxConnectionsPerProxy, + key::kMaxConnectionsPerProxy))); } // namespace policy diff --git a/chrome/browser/policy/configuration_policy_provider_win_unittest.cc b/chrome/browser/policy/configuration_policy_provider_win_unittest.cc index b14e5b5..b2cc3ce 100644 --- a/chrome/browser/policy/configuration_policy_provider_win_unittest.cc +++ b/chrome/browser/policy/configuration_policy_provider_win_unittest.cc @@ -503,6 +503,9 @@ INSTANTIATE_TEST_CASE_P( key::kDisabledSchemes), PolicyTestParams::ForStringPolicy( kPolicyDiskCacheDir, - key::kDiskCacheDir))); + key::kDiskCacheDir), + PolicyTestParams::ForIntegerPolicy( + kPolicyMaxConnectionsPerProxy, + key::kMaxConnectionsPerProxy))); } // namespace policy diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 6f1f4e5..0a71212 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -1325,6 +1325,7 @@ const char kCloudPrintRobotEmail[] = "cloud_print.robot_email"; // Preference to story proxy settings. const char kProxy[] = "proxy"; +const char kMaxConnectionsPerProxy[] = "net.max_connections_per_proxy"; // Preferences that are exclusivly used to store managed values for default // content settings. diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 3c4bc4b..af60b3c 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -457,6 +457,7 @@ extern const char kCloudPrintRobotRefreshToken[]; extern const char kCloudPrintRobotEmail[]; extern const char kProxy[]; +extern const char kMaxConnectionsPerProxy[]; extern const char kManagedDefaultCookiesSetting[]; extern const char kManagedDefaultImagesSetting[]; |