Chromium Code Reviews| Index: base/nss_util.cc |
| diff --git a/base/nss_util.cc b/base/nss_util.cc |
| index b411422bf142761298cc60e32b3f00066c4dbad7..6b07e87b5cb22812c8eb0d972a299b1d9add5a31 100644 |
| --- a/base/nss_util.cc |
| +++ b/base/nss_util.cc |
| @@ -78,6 +78,9 @@ FilePath GetInitialConfigDirectory() { |
| // |
| // 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; |
| @@ -219,6 +222,8 @@ class NSSInitSingleton { |
| #else |
| FilePath database_dir = GetInitialConfigDirectory(); |
| if (!database_dir.empty()) { |
| + // This duplicates the work which should have been done in EarlyNSSInit. |
| + // However, this function is idempotent so there's no harm done. |
| UseLocalCacheOfNSSDatabaseIfNFS(database_dir); |
| // Initialize with a persistent database (likely, ~/.pki/nssdb). |
| @@ -321,6 +326,14 @@ LazyInstance<NSSInitSingleton, LeakyLazyInstanceTraits<NSSInitSingleton> > |
| } // namespace |
| +void EarlyNSSInit() { |
| +#if defined(OS_LINUX) |
|
wtc
2011/01/13 00:07:02
This ifdef should be
#if defined(USE_NSS)
to m
|
| + FilePath database_dir = GetInitialConfigDirectory(); |
| + if (!database_dir.empty()) |
| + UseLocalCacheOfNSSDatabaseIfNFS(database_dir); |
| +#endif |
| +} |
| + |
| void EnsureNSPRInit() { |
| g_nspr_singleton.Get(); |
| } |