| Index: base/nss_util.cc
|
| diff --git a/base/nss_util.cc b/base/nss_util.cc
|
| index 8fdede3cb3fb176da1d75da7b3df2dd5045501b9..da678f0518a04a62f66fe2767985afd320b83f0e 100644
|
| --- a/base/nss_util.cc
|
| +++ b/base/nss_util.cc
|
| @@ -99,6 +99,9 @@ char* PK11PasswordFunc(PK11SlotInfo* slot, PRBool retry, void* arg) {
|
| //
|
| // TODO(wtc): port this function to other USE_NSS platforms. It is defined
|
| // only for OS_LINUX simply because the statfs structure is OS-specific.
|
| +//
|
| +// Because this function sets an environment variable it must be run before we
|
| +// go multi-threaded.
|
| void UseLocalCacheOfNSSDatabaseIfNFS(const FilePath& database_dir) {
|
| #if defined(OS_LINUX)
|
| struct statfs buf;
|
| @@ -240,6 +243,9 @@ class NSSInitSingleton {
|
| #else
|
| FilePath database_dir = GetInitialConfigDirectory();
|
| if (!database_dir.empty()) {
|
| + // This duplicates the work which should have been done in
|
| + // EarlySetupForNSSInit. However, this function is idempotent so there's
|
| + // no harm done.
|
| UseLocalCacheOfNSSDatabaseIfNFS(database_dir);
|
|
|
| // Initialize with a persistent database (likely, ~/.pki/nssdb).
|
| @@ -344,6 +350,14 @@ LazyInstance<NSSInitSingleton, LeakyLazyInstanceTraits<NSSInitSingleton> >
|
|
|
| } // namespace
|
|
|
| +#if defined(USE_NSS)
|
| +void EarlySetupForNSSInit() {
|
| + FilePath database_dir = GetInitialConfigDirectory();
|
| + if (!database_dir.empty())
|
| + UseLocalCacheOfNSSDatabaseIfNFS(database_dir);
|
| +}
|
| +#endif
|
| +
|
| void EnsureNSPRInit() {
|
| g_nspr_singleton.Get();
|
| }
|
|
|