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

Side by Side Diff: crypto/nss_util.cc

Issue 11174006: Implement ScopedTestNSSDB instead of OpenTestNSSDB() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reland with suppression Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « crypto/nss_util.h ('k') | net/base/nss_cert_database_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "crypto/nss_util.h" 5 #include "crypto/nss_util.h"
6 #include "crypto/nss_util_internal.h" 6 #include "crypto/nss_util_internal.h"
7 7
8 #include <nss.h> 8 #include <nss.h>
9 #include <plarena.h> 9 #include <plarena.h>
10 #include <prerror.h> 10 #include <prerror.h>
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 LOG(ERROR) << "Failed to load NSS libraries."; 695 LOG(ERROR) << "Failed to load NSS libraries.";
696 } 696 }
697 #endif 697 #endif
698 } 698 }
699 699
700 bool CheckNSSVersion(const char* version) { 700 bool CheckNSSVersion(const char* version) {
701 return !!NSS_VersionCheck(version); 701 return !!NSS_VersionCheck(version);
702 } 702 }
703 703
704 #if defined(USE_NSS) 704 #if defined(USE_NSS)
705 bool OpenTestNSSDB() { 705 ScopedTestNSSDB::ScopedTestNSSDB()
706 return g_nss_singleton.Get().OpenTestNSSDB(); 706 : is_open_(g_nss_singleton.Get().OpenTestNSSDB()) {
707 }
708
709 ScopedTestNSSDB::~ScopedTestNSSDB() {
710 // TODO(mattm): Close the dababase once NSS 3.14 is required,
711 // which fixes https://bugzilla.mozilla.org/show_bug.cgi?id=588269
712 // Resource leaks are suppressed. http://crbug.com/156433 .
707 } 713 }
708 714
709 base::Lock* GetNSSWriteLock() { 715 base::Lock* GetNSSWriteLock() {
710 return g_nss_singleton.Get().write_lock(); 716 return g_nss_singleton.Get().write_lock();
711 } 717 }
712 718
713 AutoNSSWriteLock::AutoNSSWriteLock() : lock_(GetNSSWriteLock()) { 719 AutoNSSWriteLock::AutoNSSWriteLock() : lock_(GetNSSWriteLock()) {
714 // May be NULL if the lock is not needed in our version of NSS. 720 // May be NULL if the lock is not needed in our version of NSS.
715 if (lock_) 721 if (lock_)
716 lock_->Acquire(); 722 lock_->Acquire();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 778
773 PK11SlotInfo* GetPublicNSSKeySlot() { 779 PK11SlotInfo* GetPublicNSSKeySlot() {
774 return g_nss_singleton.Get().GetPublicNSSKeySlot(); 780 return g_nss_singleton.Get().GetPublicNSSKeySlot();
775 } 781 }
776 782
777 PK11SlotInfo* GetPrivateNSSKeySlot() { 783 PK11SlotInfo* GetPrivateNSSKeySlot() {
778 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); 784 return g_nss_singleton.Get().GetPrivateNSSKeySlot();
779 } 785 }
780 786
781 } // namespace crypto 787 } // namespace crypto
OLDNEW
« no previous file with comments | « crypto/nss_util.h ('k') | net/base/nss_cert_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698