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

Unified Diff: net/ssl/ssl_client_session_cache_openssl.cc

Issue 1079943006: Make SSLClientSessionCacheOpenSSL thread-safe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « net/ssl/ssl_client_session_cache_openssl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_client_session_cache_openssl.cc
diff --git a/net/ssl/ssl_client_session_cache_openssl.cc b/net/ssl/ssl_client_session_cache_openssl.cc
index 4f67b9746daaedd099c720234b0068d8346ad08d..a0f03247a7a7aa6aad7270f73545a7261a0f338a 100644
--- a/net/ssl/ssl_client_session_cache_openssl.cc
+++ b/net/ssl/ssl_client_session_cache_openssl.cc
@@ -6,7 +6,6 @@
#include <utility>
-#include "base/logging.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
@@ -20,11 +19,6 @@ SSLClientSessionCacheOpenSSL::SSLClientSessionCacheOpenSSL(const Config& config)
}
SSLClientSessionCacheOpenSSL::~SSLClientSessionCacheOpenSSL() {
- // TODO(davidben): The session cache is currently a singleton, so it is
- // destroyed on a different thread than the one it's created on. When
- // https://crbug.com/458365 is fixed, this will no longer be an issue.
- thread_checker_.DetachFromThread();
-
Flush();
}
@@ -34,7 +28,7 @@ size_t SSLClientSessionCacheOpenSSL::size() const {
SSL_SESSION* SSLClientSessionCacheOpenSSL::Lookup(
const std::string& cache_key) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ base::AutoLock lock(lock_);
// Expire stale sessions.
lookups_since_flush_++;
@@ -55,7 +49,7 @@ SSL_SESSION* SSLClientSessionCacheOpenSSL::Lookup(
void SSLClientSessionCacheOpenSSL::Insert(const std::string& cache_key,
SSL_SESSION* session) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ base::AutoLock lock(lock_);
// Make a new entry.
CacheEntry* entry = new CacheEntry;
@@ -67,15 +61,13 @@ void SSLClientSessionCacheOpenSSL::Insert(const std::string& cache_key,
}
void SSLClientSessionCacheOpenSSL::Flush() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ base::AutoLock lock(lock_);
cache_.Clear();
}
void SSLClientSessionCacheOpenSSL::SetClockForTesting(
scoped_ptr<base::Clock> clock) {
- DCHECK(thread_checker_.CalledOnValidThread());
-
clock_ = clock.Pass();
}
« no previous file with comments | « net/ssl/ssl_client_session_cache_openssl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698