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