summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc7
-rw-r--r--chrome/browser/profile.cc9
-rw-r--r--net/ocsp/nss_ocsp.cc12
-rw-r--r--net/ocsp/nss_ocsp.h1
4 files changed, 17 insertions, 12 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index c75243c..f9ae5e4 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -646,6 +646,13 @@ ChromeURLRequestContext::~ChromeURLRequestContext() {
if (appcache_service_.get() && appcache_service_->request_context() == this)
appcache_service_->set_request_context(NULL);
+#if defined(OS_LINUX)
+ if (this == net::GetURLRequestContextForOCSP()) {
+ // We are releasing the URLRequestContext used by OCSP handlers.
+ net::SetURLRequestContextForOCSP(NULL);
+ }
+#endif
+
NotificationService::current()->Notify(
NotificationType::URL_REQUEST_CONTEXT_RELEASED,
Source<URLRequestContext>(this),
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 2b6eb4e..75ba5c0 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -58,7 +58,6 @@
#include "webkit/database/database_tracker.h"
#if defined(OS_LINUX)
-#include "net/ocsp/nss_ocsp.h"
#include "chrome/browser/gtk/gtk_theme_provider.h"
#endif
@@ -776,14 +775,8 @@ ProfileImpl::~ProfileImpl() {
#endif
DeleteSpellCheckerImpl(false);
- if (default_request_context_ == request_context_) {
-#if defined(OS_LINUX)
- // We use default_request_context_ for OCSP.
- // Release URLRequestContext used in OCSP handlers.
- net::SetURLRequestContextForOCSP(NULL);
-#endif
+ if (default_request_context_ == request_context_)
default_request_context_ = NULL;
- }
CleanupRequestContext(request_context_);
CleanupRequestContext(media_request_context_);
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc
index ce9fc1a4..62e9c82d 100644
--- a/net/ocsp/nss_ocsp.cc
+++ b/net/ocsp/nss_ocsp.cc
@@ -50,8 +50,8 @@ class OCSPInitSingleton {
static void set_url_request_context(URLRequestContext* request_context) {
request_context_ = request_context;
}
- URLRequestContext* url_request_context() const {
- return request_context_.get();
+ static URLRequestContext* url_request_context() {
+ return request_context_;
}
private:
@@ -67,12 +67,12 @@ class OCSPInitSingleton {
MessageLoop* io_loop_; // I/O thread
// URLRequestContext for OCSP handlers.
- static scoped_refptr<URLRequestContext> request_context_;
+ static URLRequestContext* request_context_;
DISALLOW_COPY_AND_ASSIGN(OCSPInitSingleton);
};
-scoped_refptr<URLRequestContext> OCSPInitSingleton::request_context_;
+URLRequestContext* OCSPInitSingleton::request_context_ = NULL;
// Concrete class for SEC_HTTP_REQUEST_SESSION.
// Public methods except virtual methods of URLRequest::Delegate (On* methods)
@@ -530,4 +530,8 @@ void SetURLRequestContextForOCSP(URLRequestContext* request_context) {
OCSPInitSingleton::set_url_request_context(request_context);
}
+URLRequestContext* GetURLRequestContextForOCSP() {
+ return OCSPInitSingleton::url_request_context();
+}
+
} // namespace net
diff --git a/net/ocsp/nss_ocsp.h b/net/ocsp/nss_ocsp.h
index 9492cb71..1bacd76 100644
--- a/net/ocsp/nss_ocsp.h
+++ b/net/ocsp/nss_ocsp.h
@@ -16,6 +16,7 @@ void EnsureOCSPInit();
// Set URLRequestContext for OCSP handlers.
void SetURLRequestContextForOCSP(URLRequestContext* request_context);
+URLRequestContext* GetURLRequestContextForOCSP();
} // namespace net