OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 PL_ArenaFinish(); | 212 PL_ArenaFinish(); |
213 PRStatus prstatus = PR_Cleanup(); | 213 PRStatus prstatus = PR_Cleanup(); |
214 if (prstatus != PR_SUCCESS) { | 214 if (prstatus != PR_SUCCESS) { |
215 LOG(ERROR) << "PR_Cleanup failed; was NSPR initialized on wrong thread?"; | 215 LOG(ERROR) << "PR_Cleanup failed; was NSPR initialized on wrong thread?"; |
216 } | 216 } |
217 } | 217 } |
218 }; | 218 }; |
219 | 219 |
220 base::LazyInstance<NSPRInitSingleton, | 220 base::LazyInstance<NSPRInitSingleton, |
221 base::LeakyLazyInstanceTraits<NSPRInitSingleton> > | 221 base::LeakyLazyInstanceTraits<NSPRInitSingleton> > |
222 g_nspr_singleton(base::LINKER_INITIALIZED); | 222 g_nspr_singleton = LAZY_INSTANCE_INITIALIZER; |
223 | 223 |
224 class NSSInitSingleton { | 224 class NSSInitSingleton { |
225 public: | 225 public: |
226 #if defined(OS_CHROMEOS) | 226 #if defined(OS_CHROMEOS) |
227 void OpenPersistentNSSDB() { | 227 void OpenPersistentNSSDB() { |
228 if (!chromeos_user_logged_in_) { | 228 if (!chromeos_user_logged_in_) { |
229 // GetDefaultConfigDirectory causes us to do blocking IO on UI thread. | 229 // GetDefaultConfigDirectory causes us to do blocking IO on UI thread. |
230 // Temporarily allow it until we fix http://crbug.com/70119 | 230 // Temporarily allow it until we fix http://crbug.com/70119 |
231 base::ThreadRestrictions::ScopedAllowIO allow_io; | 231 base::ThreadRestrictions::ScopedAllowIO allow_io; |
232 chromeos_user_logged_in_ = true; | 232 chromeos_user_logged_in_ = true; |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 // is fixed, we will no longer need the lock. | 607 // is fixed, we will no longer need the lock. |
608 base::Lock write_lock_; | 608 base::Lock write_lock_; |
609 #endif // defined(USE_NSS) | 609 #endif // defined(USE_NSS) |
610 }; | 610 }; |
611 | 611 |
612 // static | 612 // static |
613 bool NSSInitSingleton::force_nodb_init_ = false; | 613 bool NSSInitSingleton::force_nodb_init_ = false; |
614 | 614 |
615 base::LazyInstance<NSSInitSingleton, | 615 base::LazyInstance<NSSInitSingleton, |
616 base::LeakyLazyInstanceTraits<NSSInitSingleton> > | 616 base::LeakyLazyInstanceTraits<NSSInitSingleton> > |
617 g_nss_singleton(base::LINKER_INITIALIZED); | 617 g_nss_singleton = LAZY_INSTANCE_INITIALIZER; |
618 | 618 |
619 } // namespace | 619 } // namespace |
620 | 620 |
621 #if defined(USE_NSS) | 621 #if defined(USE_NSS) |
622 void EarlySetupForNSSInit() { | 622 void EarlySetupForNSSInit() { |
623 FilePath database_dir = GetInitialConfigDirectory(); | 623 FilePath database_dir = GetInitialConfigDirectory(); |
624 if (!database_dir.empty()) | 624 if (!database_dir.empty()) |
625 UseLocalCacheOfNSSDatabaseIfNFS(database_dir); | 625 UseLocalCacheOfNSSDatabaseIfNFS(database_dir); |
626 } | 626 } |
627 #endif | 627 #endif |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 | 790 |
791 PK11SlotInfo* GetPublicNSSKeySlot() { | 791 PK11SlotInfo* GetPublicNSSKeySlot() { |
792 return g_nss_singleton.Get().GetPublicNSSKeySlot(); | 792 return g_nss_singleton.Get().GetPublicNSSKeySlot(); |
793 } | 793 } |
794 | 794 |
795 PK11SlotInfo* GetPrivateNSSKeySlot() { | 795 PK11SlotInfo* GetPrivateNSSKeySlot() { |
796 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); | 796 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); |
797 } | 797 } |
798 | 798 |
799 } // namespace crypto | 799 } // namespace crypto |
OLD | NEW |