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

Unified Diff: chrome/browser/io_thread.cc

Issue 10203002: Make URLRequestThrottlerManager a member of URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 941df163c21e324a7185ff08e05e3efa81002eb2..9b60df352e8beb34a6482d331779d6a13f4927e8 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -53,6 +53,7 @@
#include "net/proxy/proxy_config_service.h"
#include "net/proxy/proxy_script_fetcher_impl.h"
#include "net/proxy/proxy_service.h"
+#include "net/url_request/url_request_throttler_manager.h"
#if defined(USE_NSS)
#include "net/ocsp/nss_ocsp.h"
@@ -216,6 +217,7 @@ ConstructProxyScriptFetcherContext(IOThread::Globals* globals,
context->set_server_bound_cert_service(
globals->system_server_bound_cert_service.get());
context->set_network_delegate(globals->system_network_delegate.get());
+ context->set_throttler_manager(globals->throttler_manager.get());
eroman 2012/04/24 19:05:57 I'm not sure that we would ever want the ProxyScri
Jói 2012/04/27 13:20:26 Right, it checks each request for now, because ext
willchan no longer on Chromium 2012/04/27 17:39:25 Why don't we just check NULL in URLRequestHttpJob?
// TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
// system URLRequestContext too. There's no reason this should be tied to a
// profile.
@@ -242,6 +244,7 @@ ConstructSystemRequestContext(IOThread::Globals* globals,
context->set_cookie_store(globals->system_cookie_store.get());
context->set_server_bound_cert_service(
globals->system_server_bound_cert_service.get());
+ context->set_throttler_manager(globals->throttler_manager.get());
return context;
}
@@ -445,6 +448,15 @@ void IOThread::Init() {
globals_->proxy_script_fetcher_ftp_transaction_factory.reset(
new net::FtpNetworkLayer(globals_->host_resolver.get()));
+ globals_->throttler_manager.reset(new net::URLRequestThrottlerManager());
+ // Always done in production, disabled only for unit tests.
+ globals_->throttler_manager->set_enable_thread_checks(true);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableExtensionsHttpThrottling)) {
+ globals_->throttler_manager->set_enforce_throttling(false);
+ }
+ globals_->throttler_manager->set_net_log(net_log_);
+
globals_->proxy_script_fetcher_context =
ConstructProxyScriptFetcherContext(globals_, net_log_);

Powered by Google App Engine
This is Rietveld 408576698