OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <keyhi.h> | 9 #include <keyhi.h> |
10 #include <nss.h> | 10 #include <nss.h> |
11 #include <pk11pub.h> | 11 #include <pk11pub.h> |
| 12 #include <plarena.h> |
12 | 13 |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 | 15 |
15 namespace crypto { | 16 namespace crypto { |
16 | 17 |
17 template <typename Type, void (*Destroyer)(Type*)> | 18 template <typename Type, void (*Destroyer)(Type*)> |
18 struct NSSDestroyer { | 19 struct NSSDestroyer { |
19 void operator()(Type* ptr) const { | 20 void operator()(Type* ptr) const { |
20 if (ptr) | 21 if (ptr) |
21 Destroyer(ptr); | 22 Destroyer(ptr); |
(...skipping 24 matching lines...) Expand all Loading... |
46 SECKEYPrivateKey, NSSDestroyer<SECKEYPrivateKey, SECKEY_DestroyPrivateKey> > | 47 SECKEYPrivateKey, NSSDestroyer<SECKEYPrivateKey, SECKEY_DestroyPrivateKey> > |
47 ScopedSECKEYPrivateKey; | 48 ScopedSECKEYPrivateKey; |
48 typedef scoped_ptr_malloc< | 49 typedef scoped_ptr_malloc< |
49 SECAlgorithmID, NSSDestroyer1<SECAlgorithmID, | 50 SECAlgorithmID, NSSDestroyer1<SECAlgorithmID, |
50 SECOID_DestroyAlgorithmID, | 51 SECOID_DestroyAlgorithmID, |
51 PR_TRUE> > ScopedSECAlgorithmID; | 52 PR_TRUE> > ScopedSECAlgorithmID; |
52 typedef scoped_ptr_malloc< | 53 typedef scoped_ptr_malloc< |
53 SECItem, NSSDestroyer1<SECItem, | 54 SECItem, NSSDestroyer1<SECItem, |
54 SECITEM_FreeItem, | 55 SECITEM_FreeItem, |
55 PR_TRUE> > ScopedSECItem; | 56 PR_TRUE> > ScopedSECItem; |
| 57 typedef scoped_ptr_malloc< |
| 58 PLArenaPool, NSSDestroyer1<PLArenaPool, |
| 59 PORT_FreeArena, |
| 60 PR_FALSE> > ScopedPLArenaPool; |
56 | 61 |
57 } // namespace crypto | 62 } // namespace crypto |
58 | 63 |
59 #endif // CRYPTO_SCOPED_NSS_TYPES_H_ | 64 #endif // CRYPTO_SCOPED_NSS_TYPES_H_ |
OLD | NEW |