Index: net/base/openssl_util.h |
diff --git a/net/base/openssl_util.h b/net/base/openssl_util.h |
index d4603c6666a3db5ef2a0886bbb8fd3d0cb412ea6..158d9a49810bbc9a977c43977cc985f321af6fbb 100644 |
--- a/net/base/openssl_util.h |
+++ b/net/base/openssl_util.h |
@@ -18,6 +18,13 @@ class ScopedSSL { |
explicit ScopedSSL(T* ptr_) : ptr_(ptr_) { } |
~ScopedSSL() { if (ptr_) (*destructor)(ptr_); } |
+ void reset(T* p = NULL) { |
+ if (ptr_ != p) { |
+ (*destructor)(ptr_); |
+ ptr_ = p; |
+ } |
+ } |
+ |
T* get() const { return ptr_; } |
private: |
@@ -33,12 +40,18 @@ class OpenSSLInitSingleton { |
private: |
friend struct DefaultSingletonTraits<OpenSSLInitSingleton>; |
+ friend class TestRootCerts; // For unit tests. |
OpenSSLInitSingleton(); |
~OpenSSLInitSingleton(); |
static void LockingCallback(int mode, int n, const char* file, int line); |
void OnLockingCallback(int mode, int n, const char* file, int line); |
+ // (Re-)initializes |store_| to the default state. This is used to revert |
+ // any modifications that TestRootCerts may have done, by initializing |
wtc
2010/11/18 02:12:49
Nit: remove the parentheses in "(Re-)initializes".
|
+ // |store_| to the default state. |
+ void ReinitializeStore(); |
+ |
ScopedSSL<SSL_CTX, SSL_CTX_free> ssl_ctx_; |
ScopedSSL<X509_STORE, X509_STORE_free> store_; |
// These locks are used and managed by OpenSSL via LockingCallback(). |