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

Unified Diff: net/ocsp/nss_ocsp.cc

Issue 9663017: net: add OCSP tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 9 months 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
Index: net/ocsp/nss_ocsp.cc
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc
index 1eb0b21d41a916d296a17d8beea7f0db97a9d1d0..5600f60ea0dc60b21e975c9d4ea9a7f04bc93e79 100644
--- a/net/ocsp/nss_ocsp.cc
+++ b/net/ocsp/nss_ocsp.cc
@@ -49,6 +49,8 @@ class OCSPIOLoop {
void StartUsing() {
base::AutoLock autolock(lock_);
used_ = true;
+ io_loop_ = MessageLoopForIO::current();
+ DCHECK(io_loop_);
}
// Called on IO loop.
@@ -456,8 +458,7 @@ class OCSPServerSession {
OCSPIOLoop::OCSPIOLoop()
: shutdown_(false),
used_(false),
- io_loop_(MessageLoopForIO::current()) {
- DCHECK(io_loop_);
+ io_loop_(NULL) {
}
OCSPIOLoop::~OCSPIOLoop() {
@@ -512,13 +513,6 @@ void OCSPIOLoop::AddRequest(OCSPRequestSession* request) {
}
void OCSPIOLoop::RemoveRequest(OCSPRequestSession* request) {
- {
- // Ignore if we've already shutdown.
- base::AutoLock auto_lock(lock_);
- if (shutdown_)
- return;
- }
-
DCHECK(ContainsKey(requests_, request));
requests_.erase(request);
}
@@ -527,9 +521,11 @@ void OCSPIOLoop::CancelAllRequests() {
std::set<OCSPRequestSession*> requests;
requests.swap(requests_);
- for (std::set<OCSPRequestSession*>::iterator it = requests.begin();
- it != requests.end(); ++it)
- (*it)->CancelURLRequest();
+ // We can't use an iterator here because CancelURLRequest will call back into
+ // us with RemoveRequest and mutate |requests_|.
+ while (!requests_.empty()) {
Ryan Sleevi 2012/03/13 23:06:39 This is surely wrong - the swap on line 522 should
agl 2012/03/13 23:44:03 Yes, sorry. That was a slip with git add -p, it sh
Ryan Sleevi 2012/03/13 23:50:20 For unit tests that are affected by such globals,
+ (*requests.begin())->CancelURLRequest();
+ }
}
OCSPNSSInitialization::OCSPNSSInitialization() {

Powered by Google App Engine
This is Rietveld 408576698