blob: a9a70cdfef36ef40d3805034f92bb7cb706f94f0 [file] [log] [blame]
[email protected]4156b9a42011-03-10 23:36:161// 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
3// found in the LICENSE file.
4
[email protected]4b559b4d2011-04-14 17:37:145#include "crypto/mac_security_services_lock.h"
[email protected]4156b9a42011-03-10 23:36:166
avidd373b8b2015-12-21 21:34:437#include "base/macros.h"
[email protected]3b63f8f42011-03-28 01:54:158#include "base/memory/singleton.h"
[email protected]4156b9a42011-03-10 23:36:169#include "base/synchronization/lock.h"
10
11namespace {
12
[email protected]4156b9a42011-03-10 23:36:1613class SecurityServicesSingleton {
14 public:
15 static SecurityServicesSingleton* GetInstance() {
olli.raula36aa8be2015-09-10 11:14:2216 return base::Singleton<
17 SecurityServicesSingleton,
18 base::LeakySingletonTraits<SecurityServicesSingleton>>::get();
[email protected]4156b9a42011-03-10 23:36:1619 }
20
21 base::Lock& lock() { return lock_; }
22
23 private:
olli.raula36aa8be2015-09-10 11:14:2224 friend struct base::DefaultSingletonTraits<SecurityServicesSingleton>;
[email protected]4156b9a42011-03-10 23:36:1625
26 SecurityServicesSingleton() {}
27 ~SecurityServicesSingleton() {}
28
29 base::Lock lock_;
30
31 DISALLOW_COPY_AND_ASSIGN(SecurityServicesSingleton);
32};
33
34} // namespace
35
[email protected]4b559b4d2011-04-14 17:37:1436namespace crypto {
[email protected]4156b9a42011-03-10 23:36:1637
38base::Lock& GetMacSecurityServicesLock() {
39 return SecurityServicesSingleton::GetInstance()->lock();
40}
41
[email protected]4b559b4d2011-04-14 17:37:1442} // namespace crypto