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

Unified Diff: base/openssl_util.h

Issue 4646001: Implement LoadTemporaryRoot for Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/net/base
Patch Set: New Win method & unittests Created 10 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 | net/base/cert_database_nss_unittest.cc » ('j') | net/base/cert_test_util.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/openssl_util.h
diff --git a/base/openssl_util.h b/base/openssl_util.h
index 1d290ae3ad0cd6dcb13206d943961ceb75bd2a8b..2897d7f63e5194ed4d6b3b650493aaaf2ecfe63f 100644
--- a/base/openssl_util.h
+++ b/base/openssl_util.h
@@ -16,8 +16,17 @@ namespace base {
template <typename T, void (*destructor)(T*)>
class ScopedOpenSSL {
public:
- explicit ScopedOpenSSL(T* ptr_) : ptr_(ptr_) { }
- ~ScopedOpenSSL() { if (ptr_) (*destructor)(ptr_); }
+ explicit ScopedOpenSSL(T* ptr) : ptr_(ptr) {}
+ ~ScopedOpenSSL() {
+ reset(NULL);
wtc 2010/11/23 00:30:11 Nit: since you let the argument default to NULL, y
+ }
+
+ void reset(T* p = NULL) {
+ if (ptr_ != p) {
+ (*destructor)(ptr_);
+ ptr_ = p;
+ }
+ }
T* get() const { return ptr_; }
« no previous file with comments | « no previous file | net/base/cert_database_nss_unittest.cc » ('j') | net/base/cert_test_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698