diff options
Diffstat (limited to 'base/nss_init.cc')
-rw-r--r-- | base/nss_init.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/base/nss_init.cc b/base/nss_init.cc new file mode 100644 index 0000000..6427e94 --- /dev/null +++ b/base/nss_init.cc @@ -0,0 +1,35 @@ +// Copyright (c) 2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/nss_init.h" + +#include "base/logging.h" +#include "base/singleton.h" + +// Include this header last, since NSS will define "Lock" in an enum. +// https://bugzilla.mozilla.org/show_bug.cgi?id=455424 +#include <nss.h> + +namespace base { + +namespace { + +class NSSInitSingleton { + public: + NSSInitSingleton() { + CHECK(NSS_NoDB_Init(".") == SECSuccess); + } + + ~NSSInitSingleton() { + NSS_Shutdown(); + } +}; + +} // namespace + +void EnsureNSSInit() { + Singleton<NSSInitSingleton>::get(); +} + +} // namespace base |