| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // | 94 // |
| 95 // An empty, trivial registerStatic() method is provided for all other class typ
es T. | 95 // An empty, trivial registerStatic() method is provided for all other class typ
es T. |
| 96 template<typename T> | 96 template<typename T> |
| 97 class CanRegisterStaticLocalReference { | 97 class CanRegisterStaticLocalReference { |
| 98 typedef char YesType; | 98 typedef char YesType; |
| 99 typedef struct NoType { | 99 typedef struct NoType { |
| 100 char padding[8]; | 100 char padding[8]; |
| 101 } NoType; | 101 } NoType; |
| 102 | 102 |
| 103 // Check if class T has public method "T* registerAsStaticReference()". | 103 // Check if class T has public method "T* registerAsStaticReference()". |
| 104 template<typename V> static YesType checkHasRegisterAsStaticReferenceMethod(
V* p, typename EnableIf<IsSubclass<V, typename std::remove_pointer<decltype(p->r
egisterAsStaticReference())>::type>::value>::Type* = 0); | 104 template<typename V> static YesType checkHasRegisterAsStaticReferenceMethod(
V* p, typename std::enable_if<WTF::IsBaseOf<typename std::remove_pointer<decltyp
e(p->registerAsStaticReference())>::type, V>::value>::Type* = 0); |
| 105 template<typename V> static NoType checkHasRegisterAsStaticReferenceMethod(.
..); | 105 template<typename V> static NoType checkHasRegisterAsStaticReferenceMethod(.
..); |
| 106 | 106 |
| 107 public: | 107 public: |
| 108 static const bool value = sizeof(YesType) + sizeof(T) == sizeof(checkHasRegi
sterAsStaticReferenceMethod<T>(nullptr)) + sizeof(T); | 108 static const bool value = sizeof(YesType) + sizeof(T) == sizeof(checkHasRegi
sterAsStaticReferenceMethod<T>(nullptr)) + sizeof(T); |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 template<typename T, bool = CanRegisterStaticLocalReference<T>::value> | 111 template<typename T, bool = CanRegisterStaticLocalReference<T>::value> |
| 112 class RegisterStaticLocalReference { | 112 class RegisterStaticLocalReference { |
| 113 public: | 113 public: |
| 114 static T* registerStatic(T* ptr) | 114 static T* registerStatic(T* ptr) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 129 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) WTF::RegisterStaticLo
calReference<Type>::registerStatic(Object) | 129 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) WTF::RegisterStaticLo
calReference<Type>::registerStatic(Object) |
| 130 #else | 130 #else |
| 131 #define WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE | 131 #define WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE |
| 132 #define LEAK_SANITIZER_IGNORE_OBJECT | 132 #define LEAK_SANITIZER_IGNORE_OBJECT |
| 133 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) Object | 133 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) Object |
| 134 #endif // USE(LEAK_SANITIZER) | 134 #endif // USE(LEAK_SANITIZER) |
| 135 | 135 |
| 136 } // namespace WTF | 136 } // namespace WTF |
| 137 | 137 |
| 138 #endif // WTF_LeakAnnotations_h | 138 #endif // WTF_LeakAnnotations_h |
| OLD | NEW |