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

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: Response to review 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 | « net/ocsp/nss_ocsp.h ('k') | 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..5412cba46a7a804beb80c130504cd5d1fc54b4f3 100644
--- a/net/ocsp/nss_ocsp.cc
+++ b/net/ocsp/nss_ocsp.cc
@@ -78,6 +78,20 @@ class OCSPIOLoop {
void AddRequest(OCSPRequestSession* request);
void RemoveRequest(OCSPRequestSession* request);
+ // Clears internal state and calls |StartUsing()|. Should be called only in
+ // the context of testing.
+ void ReuseForTesting() {
+ {
+ base::AutoLock autolock(lock_);
+ DCHECK(MessageLoopForIO::current());
+ thread_checker_.DetachFromThread();
+ thread_checker_.CalledOnValidThread();
Nico 2013/11/05 03:01:30 As is, this is a no-op. You probably meant to DCHE
blundell 2013/11/05 16:01:33 This call is not a no-op: it associates |thread_ch
Nico 2013/11/05 16:29:54 Aha! This seems to be only place in the codebase w
+ shutdown_ = false;
+ used_ = false;
+ }
+ StartUsing();
+ }
+
private:
friend struct base::DefaultLazyInstanceTraits<OCSPIOLoop>;
@@ -934,6 +948,10 @@ void ShutdownNSSHttpIO() {
g_ocsp_io_loop.Get().Shutdown();
}
+void ResetNSSHttpIOForTesting() {
+ g_ocsp_io_loop.Get().ReuseForTesting();
+}
+
// This function would be called before NSS initialization.
void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) {
pthread_mutex_lock(&g_request_context_lock);
« no previous file with comments | « net/ocsp/nss_ocsp.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698