OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 18 matching lines...) Expand all Loading... |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #ifndef WTF_LeakAnnotations_h | 32 #ifndef WTF_LeakAnnotations_h |
33 #define WTF_LeakAnnotations_h | 33 #define WTF_LeakAnnotations_h |
34 | 34 |
35 // This file defines macros for working with LeakSanitizer, allowing memory | 35 // This file defines macros for working with LeakSanitizer, allowing memory |
36 // and allocations to be registered as exempted from LSan consideration. | 36 // and allocations to be registered as exempted from LSan consideration. |
37 | 37 |
38 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
39 #if USE(LEAK_SANITIZER) | 39 #if defined(LEAK_SANITIZER) |
40 #include "wtf/AddressSanitizer.h" | 40 #include "wtf/AddressSanitizer.h" |
41 #include "wtf/TypeTraits.h" | 41 #include "wtf/TypeTraits.h" |
42 #endif | 42 #endif |
43 | 43 |
44 namespace WTF { | 44 namespace WTF { |
45 | 45 |
46 #if USE(LEAK_SANITIZER) | 46 #if defined(LEAK_SANITIZER) |
47 class LeakSanitizerDisabler { | 47 class LeakSanitizerDisabler { |
48 WTF_MAKE_NONCOPYABLE(LeakSanitizerDisabler); | 48 WTF_MAKE_NONCOPYABLE(LeakSanitizerDisabler); |
49 | 49 |
50 public: | 50 public: |
51 LeakSanitizerDisabler() { __lsan_disable(); } | 51 LeakSanitizerDisabler() { __lsan_disable(); } |
52 | 52 |
53 ~LeakSanitizerDisabler() { __lsan_enable(); } | 53 ~LeakSanitizerDisabler() { __lsan_enable(); } |
54 }; | 54 }; |
55 | 55 |
56 // WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE: all allocations made in the | 56 // WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE: all allocations made in the |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 return static_cast<T*>(ptr->registerAsStaticReference()); | 128 return static_cast<T*>(ptr->registerAsStaticReference()); |
129 } | 129 } |
130 }; | 130 }; |
131 | 131 |
132 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) \ | 132 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) \ |
133 WTF::RegisterStaticLocalReference<Type>::registerStatic(Object) | 133 WTF::RegisterStaticLocalReference<Type>::registerStatic(Object) |
134 #else | 134 #else |
135 #define WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE | 135 #define WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE |
136 #define LEAK_SANITIZER_IGNORE_OBJECT(X) ((void)0) | 136 #define LEAK_SANITIZER_IGNORE_OBJECT(X) ((void)0) |
137 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) Object | 137 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) Object |
138 #endif // USE(LEAK_SANITIZER) | 138 #endif // defined(LEAK_SANITIZER) |
139 | 139 |
140 } // namespace WTF | 140 } // namespace WTF |
141 | 141 |
142 #endif // WTF_LeakAnnotations_h | 142 #endif // WTF_LeakAnnotations_h |
OLD | NEW |