summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-13 23:01:55 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-13 23:01:55 +0000
commit087e666a6def2dbc38c3da8da05ec2c936111981 (patch)
tree5f3fa4e186ee3d2b663ad7d03d54d3ad40ce41ed
parentdbd327e9f5c005b88ff67c9275c03ffc8217fc5c (diff)
downloadchromium_src-087e666a6def2dbc38c3da8da05ec2c936111981.zip
chromium_src-087e666a6def2dbc38c3da8da05ec2c936111981.tar.gz
chromium_src-087e666a6def2dbc38c3da8da05ec2c936111981.tar.bz2
Revert r59289: "Eagerly set the IO loop used for OCSP."
eroman caught a race in it. BUG=36740 TEST=none Review URL: http://codereview.chromium.org/3376005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59299 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/io_thread.cc7
-rw-r--r--net/ocsp/nss_ocsp.cc45
-rw-r--r--net/ocsp/nss_ocsp.h5
3 files changed, 3 insertions, 54 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 7bbae8f..91ea106 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -24,7 +24,6 @@
#include "net/base/net_util.h"
#include "net/http/http_auth_filter.h"
#include "net/http/http_auth_handler_factory.h"
-#include "net/ocsp/nss_ocsp.h"
namespace {
@@ -176,12 +175,6 @@ void IOThread::ChangedToOnTheRecord() {
void IOThread::Init() {
BrowserProcessSubThread::Init();
- DCHECK_EQ(MessageLoop::TYPE_IO, message_loop()->type());
-
-#if defined(USE_NSS)
- net::SetMessageLoopForOCSP(static_cast<MessageLoopForIO*>(message_loop()));
-#endif // defined(USE_NSS)
-
DCHECK(!globals_);
globals_ = new Globals;
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc
index 28d2d1a..bd6a70b 100644
--- a/net/ocsp/nss_ocsp.cc
+++ b/net/ocsp/nss_ocsp.cc
@@ -17,7 +17,6 @@
#include "base/condition_variable.h"
#include "base/histogram.h"
#include "base/logging.h"
-#include "base/lock.h"
#include "base/message_loop.h"
#include "base/singleton.h"
#include "base/string_util.h"
@@ -33,15 +32,6 @@
namespace {
-// Protects |g_io_loop| and |g_io_loop_used|.
-static Lock g_io_loop_lock;
-
-// The io loop used for OCSP. Read only during OCSPInitSingleton's constructor.
-MessageLoopForIO* g_io_loop = NULL;
-// |g_io_loop_used| is set to true after read by OCSPInitSingleton's
-// constructor.
-bool g_io_loop_used = false;
-
const int kRecvBufferSize = 4096;
// All OCSP handlers should be called in the context of
@@ -110,13 +100,6 @@ class OCSPInitSingleton : public MessageLoop::DestructionObserver {
OCSPInitSingleton()
: io_loop_(MessageLoopForIO::current()) {
- {
- AutoLock lock(g_io_loop_lock);
- DCHECK(!g_io_loop_used);
- g_io_loop_used = true;
- if (g_io_loop)
- io_loop_ = g_io_loop;
- }
DCHECK(io_loop_);
io_loop_->AddDestructionObserver(this);
@@ -158,16 +141,9 @@ class OCSPInitSingleton : public MessageLoop::DestructionObserver {
virtual ~OCSPInitSingleton() {
// IO thread was already deleted before the singleton is deleted
// in AtExitManager.
- {
- AutoLock autolock(lock_);
- DCHECK(!io_loop_);
- DCHECK(!request_context_);
- }
- {
- AutoLock lock(g_io_loop_lock);
- g_io_loop_used = false;
- g_io_loop = NULL;
- }
+ AutoLock autolock(lock_);
+ DCHECK(!io_loop_);
+ DCHECK(!request_context_);
}
SEC_HttpClientFcn client_fcn_;
@@ -806,21 +782,6 @@ char* GetAlternateOCSPAIAInfo(CERTCertificate *cert) {
namespace net {
-void SetMessageLoopForOCSP(MessageLoopForIO* message_loop) {
- DCHECK(message_loop);
- AutoLock lock(g_io_loop_lock);
- if (g_io_loop) {
- LOG(DFATAL) << "Setting OCSP message loop more than once!";
- return;
- }
- if (g_io_loop_used) {
- LOG(DFATAL) << "Tried to set message loop for OCSP after "
- << "it's already been used by OCSPInitSingleton!";
- return;
- }
- g_io_loop = message_loop;
-}
-
void EnsureOCSPInit() {
Singleton<OCSPInitSingleton>::get();
}
diff --git a/net/ocsp/nss_ocsp.h b/net/ocsp/nss_ocsp.h
index 5dec05c..a31d025 100644
--- a/net/ocsp/nss_ocsp.h
+++ b/net/ocsp/nss_ocsp.h
@@ -6,15 +6,10 @@
#define NET_OCSP_NSS_OCSP_H_
#pragma once
-class MessageLoopForIO;
class URLRequestContext;
namespace net {
-// Sets the MessageLoop for OCSP. This should be called before EnsureOCSPInit()
-// if you want to control the message loop for OCSP.
-void SetMessageLoopForOCSP(MessageLoopForIO* message_loop);
-
// Initializes OCSP handlers for NSS. This must be called before any
// certificate verification functions. This function is thread-safe, and OCSP
// handlers will only ever be initialized once.