Index: net/ocsp/nss_ocsp.cc |
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc |
index cabda31dd046c86ee5ce96dd1e7f2b28cae1673c..763502101d393eb227c06dd5db0e5a12d0ababe0 100644 |
--- a/net/ocsp/nss_ocsp.cc |
+++ b/net/ocsp/nss_ocsp.cc |
@@ -59,6 +59,14 @@ class OCSPIOLoop { |
used_ = true; |
io_loop_ = MessageLoopForIO::current(); |
DCHECK(io_loop_); |
+ // In tests |g_ocsp_io_loop| may be shut down and restarted. Ensure that |
+ // the thread checker is associated with the correct thread after a restart |
+ // to avoid DCHECK's going off later. |
+ if (shutdown_) { |
+ thread_checker_.DetachFromThread(); |
+ thread_checker_.CalledOnValidThread(); |
+ shutdown_ = false; |
+ } |
Ryan Sleevi
2012/11/05 14:43:31
Perhaps moving this into an explicit Reset() metho
blundell
2012/11/05 15:19:02
I thought about factoring this out into its own me
Ryan Sleevi
2012/11/06 15:43:47
IMO, yeah. Makes it easier to separate out bugs-in
|
} |
// Called on IO loop. |
@@ -923,6 +931,8 @@ void SetMessageLoopForNSSHttpIO() { |
// Should not be called when g_ocsp_io_loop has already been used. |
DCHECK(!used); |
Ryan Sleevi
2012/11/05 14:43:31
What about the fact that this is not reset?
Attem
blundell
2012/11/05 15:19:02
used_ is set to false in Shutdown() (where shutdow
|
+ // Ensure that |g_ocsp_io_loop| is associated with the current message loop. |
+ g_ocsp_io_loop.Get().StartUsing(); |
Ryan Sleevi
2012/11/05 14:43:31
I'm not sure I understand the motivation here for
blundell
2012/11/05 15:19:02
|SetMessageLoopForNSSHttpIO| is called in |IOThrea
Ryan Sleevi
2012/11/06 15:43:47
I would prefer not to tightly couple these two (eg
|
} |
void EnsureNSSHttpIOInit() { |