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

Unified Diff: chrome/browser/net/net_pref_observer.cc

Issue 7283018: Introduce a policy to control the maximal number of connections per proxy server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/net_pref_observer.cc
diff --git a/chrome/browser/net/net_pref_observer.cc b/chrome/browser/net/net_pref_observer.cc
index 8a0d08e72032152cd7c1d5923063ba71e0b261d0..68a22ccedfd645fedd519cdcada114252372a0ff 100644
--- a/chrome/browser/net/net_pref_observer.cc
+++ b/chrome/browser/net/net_pref_observer.cc
@@ -15,6 +15,7 @@
#include "content/common/notification_type.h"
#include "content/common/notification_details.h"
#include "net/http/http_stream_factory.h"
+#include "net/socket/client_socket_pool_manager.h"
#include "net/url_request/url_request_throttler_manager.h"
namespace {
@@ -37,6 +38,7 @@ NetPrefObserver::NetPrefObserver(PrefService* prefs,
this);
spdy_disabled_.Init(prefs::kDisableSpdy, prefs, this);
http_throttling_enabled_.Init(prefs::kHttpThrottlingEnabled, prefs, this);
+ max_connections_per_proxy_.Init(prefs::kMaxConnectionsPerProxy, prefs, this);
ApplySettings(NULL);
}
@@ -68,6 +70,14 @@ void NetPrefObserver::ApplySettings(const std::string* pref_name) {
NewRunnableFunction(SetEnforceThrottlingOnThrottlerManager,
*http_throttling_enabled_));
}
+
+ if (!pref_name || *pref_name == prefs::kMaxConnectionsPerProxy) {
willchan no longer on Chromium 2011/06/29 22:54:55 There are a few issues here. First, this is only s
pastarmovj 2011/07/01 18:52:44 Ok i removed the dynamic marking from the policy a
+ // Make sure the value is not greater than 100 and nor smaller than the
+ // maximal number of connections allowed per group.
+ net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(
+ std::max(std::min(*max_connections_per_proxy_, 100),
+ net::ClientSocketPoolManager::max_sockets_per_group()));
+ }
}
// static
@@ -84,7 +94,9 @@ void NetPrefObserver::RegisterPrefs(PrefService* prefs) {
prefs->RegisterBooleanPref(prefs::kHttpThrottlingMayExperiment,
true,
PrefService::UNSYNCABLE_PREF);
-
+ prefs->RegisterIntegerPref(prefs::kMaxConnectionsPerProxy,
+ 32,
willchan no longer on Chromium 2011/06/29 22:54:55 This should probably use a default that is read fr
pastarmovj 2011/07/01 18:52:44 Done.
+ PrefService::UNSYNCABLE_PREF);
// This is the earliest point at which we can set up the trial, as
// it relies on prefs for parameterization.
CreateHttpThrottlingTrial(prefs);

Powered by Google App Engine
This is Rietveld 408576698