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

Side by Side Diff: crypto/scoped_capi_types.h

Issue 169193002: Convert scoped_ptr_malloc -> scoped_ptr, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 10 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 | « content/renderer/pepper/host_var_tracker_unittest.cc ('k') | crypto/scoped_nss_types.h » ('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 #ifndef CRYPTO_SCOPED_CAPI_TYPES_H_ 5 #ifndef CRYPTO_SCOPED_CAPI_TYPES_H_
6 #define CRYPTO_SCOPED_CAPI_TYPES_H_ 6 #define CRYPTO_SCOPED_CAPI_TYPES_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 #include <wincrypt.h> 9 #include <wincrypt.h>
10 10
(...skipping 24 matching lines...) Expand all
35 void operator()(CAPIHandle handle) const { 35 void operator()(CAPIHandle handle) const {
36 if (handle) { 36 if (handle) {
37 BOOL ok = Destroyer(handle, flags); 37 BOOL ok = Destroyer(handle, flags);
38 DCHECK(ok); 38 DCHECK(ok);
39 } 39 }
40 } 40 }
41 }; 41 };
42 42
43 // scoped_ptr-like class for the CryptoAPI cryptography and certificate 43 // scoped_ptr-like class for the CryptoAPI cryptography and certificate
44 // handles. Because these handles are defined as integer types, and not 44 // handles. Because these handles are defined as integer types, and not
45 // pointers, the existing scoped classes, such as scoped_ptr_malloc, are 45 // pointers, the existing scoped classes, such as scoped_ptr, are insufficient.
46 // insufficient. The semantics are the same as scoped_ptr. 46 // The semantics are the same as scoped_ptr.
47 template <class CAPIHandle, typename FreeProc> 47 template <class CAPIHandle, typename FreeProc>
48 class ScopedCAPIHandle { 48 class ScopedCAPIHandle {
49 public: 49 public:
50 explicit ScopedCAPIHandle(CAPIHandle handle = NULL) : handle_(handle) {} 50 explicit ScopedCAPIHandle(CAPIHandle handle = NULL) : handle_(handle) {}
51 51
52 ~ScopedCAPIHandle() { 52 ~ScopedCAPIHandle() {
53 reset(); 53 reset();
54 } 54 }
55 55
56 void reset(CAPIHandle handle = NULL) { 56 void reset(CAPIHandle handle = NULL) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 typedef ScopedCAPIHandle< 113 typedef ScopedCAPIHandle<
114 HCRYPTKEY, CAPIDestroyer<HCRYPTKEY, CryptDestroyKey> > ScopedHCRYPTKEY; 114 HCRYPTKEY, CAPIDestroyer<HCRYPTKEY, CryptDestroyKey> > ScopedHCRYPTKEY;
115 115
116 typedef ScopedCAPIHandle< 116 typedef ScopedCAPIHandle<
117 HCRYPTHASH, CAPIDestroyer<HCRYPTHASH, CryptDestroyHash> > ScopedHCRYPTHASH; 117 HCRYPTHASH, CAPIDestroyer<HCRYPTHASH, CryptDestroyHash> > ScopedHCRYPTHASH;
118 118
119 } // namespace crypto 119 } // namespace crypto
120 120
121 #endif // CRYPTO_SCOPED_CAPI_TYPES_H_ 121 #endif // CRYPTO_SCOPED_CAPI_TYPES_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/host_var_tracker_unittest.cc ('k') | crypto/scoped_nss_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698