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

Side by Side Diff: crypto/cssm_init.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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
« no previous file with comments | « crypto/capi_util.cc ('k') | crypto/mac_security_services_lock.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "crypto/cssm_init.h" 5 #include "crypto/cssm_init.h"
6 6
7 #include <Security/SecBase.h> 7 #include <Security/SecBase.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/scoped_cftyperef.h" 10 #include "base/mac/scoped_cftyperef.h"
(...skipping 21 matching lines...) Expand all
32 return realloc(ptr, size); 32 return realloc(ptr, size);
33 } 33 }
34 34
35 void* CSSMCalloc(uint32 num, CSSM_SIZE size, void* alloc_ref) { 35 void* CSSMCalloc(uint32 num, CSSM_SIZE size, void* alloc_ref) {
36 return calloc(num, size); 36 return calloc(num, size);
37 } 37 }
38 38
39 class CSSMInitSingleton { 39 class CSSMInitSingleton {
40 public: 40 public:
41 static CSSMInitSingleton* GetInstance() { 41 static CSSMInitSingleton* GetInstance() {
42 return Singleton<CSSMInitSingleton, 42 return base::Singleton<CSSMInitSingleton, base::LeakySingletonTraits<
43 LeakySingletonTraits<CSSMInitSingleton> >::get(); 43 CSSMInitSingleton>>::get();
44 } 44 }
45 45
46 CSSM_CSP_HANDLE csp_handle() const { return csp_handle_; } 46 CSSM_CSP_HANDLE csp_handle() const { return csp_handle_; }
47 CSSM_CL_HANDLE cl_handle() const { return cl_handle_; } 47 CSSM_CL_HANDLE cl_handle() const { return cl_handle_; }
48 CSSM_TP_HANDLE tp_handle() const { return tp_handle_; } 48 CSSM_TP_HANDLE tp_handle() const { return tp_handle_; }
49 49
50 private: 50 private:
51 CSSMInitSingleton() 51 CSSMInitSingleton()
52 : inited_(false), csp_loaded_(false), cl_loaded_(false), 52 : inited_(false), csp_loaded_(false), cl_loaded_(false),
53 tp_loaded_(false), csp_handle_(CSSM_INVALID_HANDLE), 53 tp_loaded_(false), csp_handle_(CSSM_INVALID_HANDLE),
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 144
145 bool inited_; // True if CSSM_Init has been called successfully. 145 bool inited_; // True if CSSM_Init has been called successfully.
146 bool csp_loaded_; // True if gGuidAppleCSP has been loaded 146 bool csp_loaded_; // True if gGuidAppleCSP has been loaded
147 bool cl_loaded_; // True if gGuidAppleX509CL has been loaded. 147 bool cl_loaded_; // True if gGuidAppleX509CL has been loaded.
148 bool tp_loaded_; // True if gGuidAppleX509TP has been loaded. 148 bool tp_loaded_; // True if gGuidAppleX509TP has been loaded.
149 CSSM_CSP_HANDLE csp_handle_; 149 CSSM_CSP_HANDLE csp_handle_;
150 CSSM_CL_HANDLE cl_handle_; 150 CSSM_CL_HANDLE cl_handle_;
151 CSSM_TP_HANDLE tp_handle_; 151 CSSM_TP_HANDLE tp_handle_;
152 152
153 friend struct DefaultSingletonTraits<CSSMInitSingleton>; 153 friend struct base::DefaultSingletonTraits<CSSMInitSingleton>;
154 }; 154 };
155 155
156 } // namespace 156 } // namespace
157 157
158 namespace crypto { 158 namespace crypto {
159 159
160 void EnsureCSSMInit() { 160 void EnsureCSSMInit() {
161 CSSMInitSingleton::GetInstance(); 161 CSSMInitSingleton::GetInstance();
162 } 162 }
163 163
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 ScopedCSSMData::~ScopedCSSMData() { 197 ScopedCSSMData::~ScopedCSSMData() {
198 if (data_.Data) { 198 if (data_.Data) {
199 CSSMFree(data_.Data); 199 CSSMFree(data_.Data);
200 data_.Data = NULL; 200 data_.Data = NULL;
201 } 201 }
202 } 202 }
203 203
204 } // namespace crypto 204 } // namespace crypto
OLDNEW
« no previous file with comments | « crypto/capi_util.cc ('k') | crypto/mac_security_services_lock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698