Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: net/ocsp/nss_ocsp.cc

Issue 11347039: Ensure that OCSPIOLoop is associated with right thread if restarted. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Edits Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698