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

Side by Side Diff: crypto/scoped_nss_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, 9 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 | « crypto/scoped_capi_types.h ('k') | device/hid/hid_connection_mac.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_NSS_TYPES_H_ 5 #ifndef CRYPTO_SCOPED_NSS_TYPES_H_
6 #define CRYPTO_SCOPED_NSS_TYPES_H_ 6 #define CRYPTO_SCOPED_NSS_TYPES_H_
7 7
8 #include <keyhi.h> 8 #include <keyhi.h>
9 #include <nss.h> 9 #include <nss.h>
10 #include <pk11pub.h> 10 #include <pk11pub.h>
(...skipping 13 matching lines...) Expand all
24 24
25 template <typename Type, void (*Destroyer)(Type*, PRBool), PRBool freeit> 25 template <typename Type, void (*Destroyer)(Type*, PRBool), PRBool freeit>
26 struct NSSDestroyer1 { 26 struct NSSDestroyer1 {
27 void operator()(Type* ptr) const { 27 void operator()(Type* ptr) const {
28 if (ptr) 28 if (ptr)
29 Destroyer(ptr, freeit); 29 Destroyer(ptr, freeit);
30 } 30 }
31 }; 31 };
32 32
33 // Define some convenient scopers around NSS pointers. 33 // Define some convenient scopers around NSS pointers.
34 typedef scoped_ptr_malloc< 34 typedef scoped_ptr<PK11Context,
35 PK11Context, NSSDestroyer1<PK11Context, 35 NSSDestroyer1<PK11Context, PK11_DestroyContext, PR_TRUE> >
36 PK11_DestroyContext, 36 ScopedPK11Context;
37 PR_TRUE> > ScopedPK11Context; 37 typedef scoped_ptr<PK11SlotInfo, NSSDestroyer<PK11SlotInfo, PK11_FreeSlot> >
38 typedef scoped_ptr_malloc< 38 ScopedPK11Slot;
39 PK11SlotInfo, NSSDestroyer<PK11SlotInfo, PK11_FreeSlot> > ScopedPK11Slot; 39 typedef scoped_ptr<PK11SlotList, NSSDestroyer<PK11SlotList, PK11_FreeSlotList> >
40 typedef scoped_ptr_malloc< 40 ScopedPK11SlotList;
41 PK11SlotList, NSSDestroyer<PK11SlotList, 41 typedef scoped_ptr<PK11SymKey, NSSDestroyer<PK11SymKey, PK11_FreeSymKey> >
42 PK11_FreeSlotList> > ScopedPK11SlotList; 42 ScopedPK11SymKey;
43 typedef scoped_ptr_malloc< 43 typedef scoped_ptr<SECKEYPublicKey,
44 PK11SymKey, NSSDestroyer<PK11SymKey, PK11_FreeSymKey> > ScopedPK11SymKey; 44 NSSDestroyer<SECKEYPublicKey, SECKEY_DestroyPublicKey> >
45 typedef scoped_ptr_malloc<
46 SECKEYPublicKey, NSSDestroyer<SECKEYPublicKey, SECKEY_DestroyPublicKey> >
47 ScopedSECKEYPublicKey; 45 ScopedSECKEYPublicKey;
48 typedef scoped_ptr_malloc< 46 typedef scoped_ptr<SECKEYPrivateKey,
49 SECKEYPrivateKey, NSSDestroyer<SECKEYPrivateKey, SECKEY_DestroyPrivateKey> > 47 NSSDestroyer<SECKEYPrivateKey, SECKEY_DestroyPrivateKey> >
50 ScopedSECKEYPrivateKey; 48 ScopedSECKEYPrivateKey;
51 typedef scoped_ptr_malloc< 49 typedef scoped_ptr<SECAlgorithmID,
52 SECAlgorithmID, NSSDestroyer1<SECAlgorithmID, 50 NSSDestroyer1<SECAlgorithmID, SECOID_DestroyAlgorithmID,
53 SECOID_DestroyAlgorithmID, 51 PR_TRUE> >
54 PR_TRUE> > ScopedSECAlgorithmID; 52 ScopedSECAlgorithmID;
55 typedef scoped_ptr_malloc< 53 typedef scoped_ptr<SECItem, NSSDestroyer1<SECItem, SECITEM_FreeItem, PR_TRUE> >
56 SECItem, NSSDestroyer1<SECItem, 54 ScopedSECItem;
57 SECITEM_FreeItem, 55 typedef scoped_ptr<PLArenaPool,
58 PR_TRUE> > ScopedSECItem; 56 NSSDestroyer1<PLArenaPool, PORT_FreeArena, PR_FALSE> >
59 typedef scoped_ptr_malloc< 57 ScopedPLArenaPool;
60 PLArenaPool, NSSDestroyer1<PLArenaPool,
61 PORT_FreeArena,
62 PR_FALSE> > ScopedPLArenaPool;
63 58
64 } // namespace crypto 59 } // namespace crypto
65 60
66 #endif // CRYPTO_SCOPED_NSS_TYPES_H_ 61 #endif // CRYPTO_SCOPED_NSS_TYPES_H_
OLDNEW
« no previous file with comments | « crypto/scoped_capi_types.h ('k') | device/hid/hid_connection_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698