| OLD | NEW |
| 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 BASE_MEMORY_SCOPED_GENERIC_OBJ_H_ | 5 #ifndef BASE_MEMORY_SCOPED_GENERIC_OBJ_H_ |
| 6 #define BASE_MEMORY_SCOPED_GENERIC_OBJ_H_ | 6 #define BASE_MEMORY_SCOPED_GENERIC_OBJ_H_ |
| 7 #pragma once | |
| 8 | 7 |
| 9 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 11 | 10 |
| 12 // ScopedGenericObj<> is patterned after scoped_ptr_malloc<>, except | 11 // ScopedGenericObj<> is patterned after scoped_ptr_malloc<>, except |
| 13 // that it assumes the template argument is typedef'ed to a pointer | 12 // that it assumes the template argument is typedef'ed to a pointer |
| 14 // type. It does not support retain/release semantics. It takes as its | 13 // type. It does not support retain/release semantics. It takes as its |
| 15 // second template argument a functor which frees the object. | 14 // second template argument a functor which frees the object. |
| 16 // | 15 // |
| 17 // Example (Mac-specific): | 16 // Example (Mac-specific): |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 bool operator==(C* p, const ScopedGenericObj<C, FP>& b) { | 120 bool operator==(C* p, const ScopedGenericObj<C, FP>& b) { |
| 122 return p == b.get(); | 121 return p == b.get(); |
| 123 } | 122 } |
| 124 | 123 |
| 125 template<class C, class FP> inline | 124 template<class C, class FP> inline |
| 126 bool operator!=(C* p, const ScopedGenericObj<C, FP>& b) { | 125 bool operator!=(C* p, const ScopedGenericObj<C, FP>& b) { |
| 127 return p != b.get(); | 126 return p != b.get(); |
| 128 } | 127 } |
| 129 | 128 |
| 130 #endif // BASE_MEMORY_SCOPED_GENERIC_OBJ_H_ | 129 #endif // BASE_MEMORY_SCOPED_GENERIC_OBJ_H_ |
| OLD | NEW |