Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: base/crypto/capi_util.cc

Issue 6805019: Move crypto files out of base, to a top level directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixes comments by eroman Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/crypto/capi_util.h ('k') | base/crypto/crypto_module_blocking_password_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/crypto/capi_util.h"
6
7 #include "base/basictypes.h"
8 #include "base/memory/singleton.h"
9 #include "base/synchronization/lock.h"
10
11 namespace {
12
13 class CAPIUtilSingleton {
14 public:
15 static CAPIUtilSingleton* GetInstance() {
16 return Singleton<CAPIUtilSingleton>::get();
17 }
18
19 // Returns a lock to guard calls to CryptAcquireContext with
20 // CRYPT_DELETEKEYSET or CRYPT_NEWKEYSET.
21 base::Lock& acquire_context_lock() {
22 return acquire_context_lock_;
23 }
24
25 private:
26 friend class Singleton<CAPIUtilSingleton>;
27 friend struct DefaultSingletonTraits<CAPIUtilSingleton>;
28
29 CAPIUtilSingleton() {}
30
31 base::Lock acquire_context_lock_;
32
33 DISALLOW_COPY_AND_ASSIGN(CAPIUtilSingleton);
34 };
35
36 } // namespace
37
38 namespace base {
39
40 BOOL CryptAcquireContextLocked(HCRYPTPROV* prov,
41 LPCWSTR container,
42 LPCWSTR provider,
43 DWORD prov_type,
44 DWORD flags)
45 {
46 base::AutoLock lock(CAPIUtilSingleton::GetInstance()->acquire_context_lock());
47 return CryptAcquireContext(prov, container, provider, prov_type, flags);
48 }
49
50 } // namespace base
OLDNEW
« no previous file with comments | « base/crypto/capi_util.h ('k') | base/crypto/crypto_module_blocking_password_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698