summaryrefslogtreecommitdiffstats
path: root/chrome/browser/io_thread.cc
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-16 23:37:25 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-16 23:37:25 +0000
commit77feb46ee8d7e7b2a174714fa17e830573f01476 (patch)
tree9fb167adaaca9932dc904a02b37a272773861807 /chrome/browser/io_thread.cc
parent43549a8f2bb09da994c640f07962188bdecd78c3 (diff)
downloadchromium_src-77feb46ee8d7e7b2a174714fa17e830573f01476.zip
chromium_src-77feb46ee8d7e7b2a174714fa17e830573f01476.tar.gz
chromium_src-77feb46ee8d7e7b2a174714fa17e830573f01476.tar.bz2
Switch to using the system request context for OCSP.
This gets rid of all the ugly "is_main" logic for URLRequestContext. BUG=none TEST=none Review URL: http://codereview.chromium.org/7013071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/io_thread.cc')
-rw-r--r--chrome/browser/io_thread.cc30
1 files changed, 26 insertions, 4 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 8aa6e01..78b2165 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -45,14 +45,15 @@
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_network_layer.h"
#include "net/http/http_network_session.h"
-#if defined(USE_NSS)
-#include "net/ocsp/nss_ocsp.h"
-#endif // defined(USE_NSS)
#include "net/proxy/proxy_config_service.h"
#include "net/proxy/proxy_script_fetcher_impl.h"
#include "net/proxy/proxy_service.h"
#include "webkit/glue/webkit_glue.h"
+#if defined(USE_NSS)
+#include "net/ocsp/nss_ocsp.h"
+#endif // defined(USE_NSS)
+
namespace {
// Custom URLRequestContext used by requests which aren't associated with a
@@ -66,6 +67,25 @@ class URLRequestContextWithUserAgent : public net::URLRequestContext {
}
};
+// Used for the "system" URLRequestContext. If this grows more complicated, then
+// consider inheriting directly from URLRequestContext rather than using
+// implementation inheritance.
+class SystemURLRequestContext : public URLRequestContextWithUserAgent {
+ public:
+ SystemURLRequestContext() {
+#if defined(USE_NSS)
+ net::SetURLRequestContextForOCSP(this);
+#endif // defined(USE_NSS)
+ }
+
+ private:
+ virtual ~SystemURLRequestContext() {
+#if defined(USE_NSS)
+ net::SetURLRequestContextForOCSP(NULL);
+#endif // defined(USE_NSS)
+ }
+};
+
net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
@@ -180,6 +200,8 @@ class LoggingNetworkChangeObserver
DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver);
};
+// Create a separate request context for PAC fetches to avoid reference cycles.
+// See IOThread::Globals for details.
scoped_refptr<net::URLRequestContext>
ConstructProxyScriptFetcherContext(IOThread::Globals* globals,
net::NetLog* net_log) {
@@ -206,7 +228,7 @@ scoped_refptr<net::URLRequestContext>
ConstructSystemRequestContext(IOThread::Globals* globals,
net::NetLog* net_log) {
scoped_refptr<net::URLRequestContext> context(
- new URLRequestContextWithUserAgent);
+ new SystemURLRequestContext);
context->set_net_log(net_log);
context->set_host_resolver(globals->host_resolver.get());
context->set_cert_verifier(globals->cert_verifier.get());