OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 BASE_CRYPTO_SCOPED_CAPI_TYPES_H_ | 5 #ifndef BASE_CRYPTO_SCOPED_CAPI_TYPES_H_ |
6 #define BASE_CRYPTO_SCOPED_CAPI_TYPES_H_ | 6 #define BASE_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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 if (handle_ != handle) { | 57 if (handle_ != handle) { |
58 free_(handle_); | 58 free_(handle_); |
59 handle_ = handle; | 59 handle_ = handle; |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 operator CAPIHandle() const { return handle_; } | 63 operator CAPIHandle() const { return handle_; } |
64 CAPIHandle get() const { return handle_; } | 64 CAPIHandle get() const { return handle_; } |
65 | 65 |
66 CAPIHandle* receive() { | 66 CAPIHandle* receive() { |
67 CHECK(handle_ == NULL); | 67 CHECK_EQ(NULL, handle_); |
68 return &handle_; | 68 return &handle_; |
69 } | 69 } |
70 | 70 |
71 bool operator==(CAPIHandle handle) const { | 71 bool operator==(CAPIHandle handle) const { |
72 return handle_ == handle; | 72 return handle_ == handle; |
73 } | 73 } |
74 | 74 |
75 bool operator!=(CAPIHandle handle) const { | 75 bool operator!=(CAPIHandle handle) const { |
76 return handle_ != handle; | 76 return handle_ != handle; |
77 } | 77 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 typedef ScopedCAPIHandle< | 116 typedef ScopedCAPIHandle< |
117 HCRYPTKEY, CAPIDestroyer<HCRYPTKEY, CryptDestroyKey> > ScopedHCRYPTKEY; | 117 HCRYPTKEY, CAPIDestroyer<HCRYPTKEY, CryptDestroyKey> > ScopedHCRYPTKEY; |
118 | 118 |
119 typedef ScopedCAPIHandle< | 119 typedef ScopedCAPIHandle< |
120 HCRYPTHASH, CAPIDestroyer<HCRYPTHASH, CryptDestroyHash> > ScopedHCRYPTHASH; | 120 HCRYPTHASH, CAPIDestroyer<HCRYPTHASH, CryptDestroyHash> > ScopedHCRYPTHASH; |
121 | 121 |
122 } // namespace base | 122 } // namespace base |
123 | 123 |
124 #endif // BASE_CRYPTO_SCOPED_CAPI_TYPES_H_ | 124 #endif // BASE_CRYPTO_SCOPED_CAPI_TYPES_H_ |
OLD | NEW |