summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/io_thread.cc12
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc16
-rw-r--r--chrome/browser/net/chrome_url_request_context.h1
-rw-r--r--chrome/browser/profile_impl.cc1
-rw-r--r--chrome/common/net/url_request_context_getter.cc3
-rw-r--r--chrome/common/net/url_request_context_getter.h15
6 files changed, 38 insertions, 10 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index b76e895..8c17fc65 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -26,6 +26,10 @@
#include "net/base/net_util.h"
#include "net/http/http_auth_filter.h"
#include "net/http/http_auth_handler_factory.h"
+#if defined(USE_NSS)
+#include "net/ocsp/nss_ocsp.h"
+#endif // defined(USE_NSS)
+#include "net/proxy/proxy_script_fetcher.h"
namespace {
@@ -159,6 +163,12 @@ void IOThread::ChangedToOnTheRecord() {
void IOThread::Init() {
BrowserProcessSubThread::Init();
+ DCHECK_EQ(MessageLoop::TYPE_IO, message_loop()->type());
+
+#if defined(USE_NSS)
+ net::SetMessageLoopForOCSP();
+#endif // defined(USE_NSS)
+
DCHECK(!globals_);
globals_ = new Globals;
@@ -206,6 +216,8 @@ void IOThread::CleanUp() {
globals_->host_resolver.get()->GetAsHostResolverImpl()->Shutdown();
}
+ net::EnsureNoProxyScriptFetches();
+
// We will delete the NetLog as part of CleanUpAfterMessageLoopDestruction()
// in case any of the message loop destruction observers try to access it.
deferred_net_log_to_delete_.reset(globals_->net_log.release());
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 9f053f3..28f7621 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -314,11 +314,6 @@ ChromeURLRequestContext* FactoryForOriginal::Create() {
appcache_service_->set_request_context(context);
-#if defined(USE_NSS)
- // TODO(ukai): find a better way to set the URLRequestContext for OCSP.
- net::SetURLRequestContextForOCSP(context);
-#endif
-
context->set_net_log(io_thread_globals->net_log.get());
return context;
}
@@ -559,6 +554,14 @@ URLRequestContext* ChromeURLRequestContextGetter::GetURLRequestContext() {
if (!url_request_context_) {
DCHECK(factory_.get());
url_request_context_ = factory_->Create();
+ if (is_main()) {
+ url_request_context_->set_is_main(true);
+#if defined(USE_NSS)
+ // TODO(ukai): find a better way to set the URLRequestContext for OCSP.
+ net::SetURLRequestContextForOCSP(url_request_context_);
+#endif
+ }
+
factory_.reset();
}
@@ -756,7 +759,8 @@ ChromeURLRequestContext::~ChromeURLRequestContext() {
}
#if defined(USE_NSS)
- if (this == net::GetURLRequestContextForOCSP()) {
+ if (is_main()) {
+ DCHECK_EQ(this, net::GetURLRequestContextForOCSP());
// We are releasing the URLRequestContext used by OCSP handlers.
net::SetURLRequestContextForOCSP(NULL);
}
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index 183ad4a..a580282 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -211,7 +211,6 @@ class ChromeURLRequestContext : public URLRequestContext {
bool is_off_the_record_;
private:
-
DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContext);
};
diff --git a/chrome/browser/profile_impl.cc b/chrome/browser/profile_impl.cc
index 899e068daa..4ef4363 100644
--- a/chrome/browser/profile_impl.cc
+++ b/chrome/browser/profile_impl.cc
@@ -713,6 +713,7 @@ URLRequestContextGetter* ProfileImpl::GetRequestContext() {
// created first.
if (!default_request_context_) {
default_request_context_ = request_context_;
+ request_context_->set_is_main(true);
// TODO(eroman): this isn't terribly useful anymore now that the
// URLRequestContext is constructed by the IO thread...
NotificationService::current()->Notify(
diff --git a/chrome/common/net/url_request_context_getter.cc b/chrome/common/net/url_request_context_getter.cc
index c53f782..57feb0e 100644
--- a/chrome/common/net/url_request_context_getter.cc
+++ b/chrome/common/net/url_request_context_getter.cc
@@ -10,7 +10,7 @@ net::CookieStore* URLRequestContextGetter::GetCookieStore() {
return GetURLRequestContext()->cookie_store();
}
-URLRequestContextGetter::URLRequestContextGetter() {}
+URLRequestContextGetter::URLRequestContextGetter() : is_main_(false) {}
URLRequestContextGetter::~URLRequestContextGetter() {}
@@ -28,4 +28,3 @@ void URLRequestContextGetter::OnDestruct() {
// If no IO message loop proxy was available, we will just leak memory.
// This is also true if the IO thread is gone.
}
-
diff --git a/chrome/common/net/url_request_context_getter.h b/chrome/common/net/url_request_context_getter.h
index 89b28b5..2b6ea82 100644
--- a/chrome/common/net/url_request_context_getter.h
+++ b/chrome/common/net/url_request_context_getter.h
@@ -35,6 +35,14 @@ class URLRequestContextGetter
// may be used).
virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() = 0;
+ // Controls whether or not the URLRequestContextGetter considers itself to be
+ // the the "main" URLRequestContextGetter. Note that each Profile will have a
+ // "default" URLRequestContextGetter. Therefore, "is_main" refers to the
+ // default URLRequestContextGetter for the "main" Profile.
+ // TODO(willchan): Move this code to ChromeURLRequestContextGetter, since this
+ // ia a browser process specific concept.
+ void set_is_main(bool is_main) { is_main_ = is_main; }
+
protected:
friend class DeleteTask<URLRequestContextGetter>;
friend struct URLRequestContextGetterTraits;
@@ -42,10 +50,16 @@ class URLRequestContextGetter
URLRequestContextGetter();
virtual ~URLRequestContextGetter();
+ bool is_main() const { return is_main_; }
+
private:
// OnDestruct is meant to ensure deletion on the thread on which the request
// IO happens.
void OnDestruct();
+
+ // Indicates whether or not this is the default URLRequestContextGetter for
+ // the main Profile.
+ bool is_main_;
};
struct URLRequestContextGetterTraits {
@@ -55,4 +69,3 @@ struct URLRequestContextGetterTraits {
};
#endif // CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_
-