| Index: third_party/WebKit/Source/wtf/StdLibExtras.h
|
| diff --git a/third_party/WebKit/Source/wtf/StdLibExtras.h b/third_party/WebKit/Source/wtf/StdLibExtras.h
|
| index 62acd8582e0fdf7eee3a7b68cec156a9236f5512..623fd15af0436effed7eef24c8d001d64a5e7de6 100644
|
| --- a/third_party/WebKit/Source/wtf/StdLibExtras.h
|
| +++ b/third_party/WebKit/Source/wtf/StdLibExtras.h
|
| @@ -29,6 +29,7 @@
|
| #include "wtf/Assertions.h"
|
| #include "wtf/CPU.h"
|
| #include "wtf/CheckedArithmetic.h"
|
| +#include "wtf/LeakAnnotations.h"
|
| #include <cstddef>
|
|
|
| #if ENABLE(ASSERT)
|
| @@ -58,31 +59,30 @@ private:
|
| };
|
| #endif
|
|
|
| -// Use this to declare and define a static local variable (static T;) so that
|
| -// it is leaked so that its destructors are not called at exit.
|
| -#ifndef DEFINE_STATIC_LOCAL
|
| -
|
| +// Use DEFINE_STATIC_LOCAL() to declare and define a static local variable (static T;)
|
| +// so that it is leaked and its destructors are not called at exit.
|
| +//
|
| +// To cooperate with leak detection, the objects held onto by these local statics
|
| +// will in some cases have to be finalized prior to leak checking. This only applies
|
| +// to static references to Oilpan heap objects and what they transitively hold on to.
|
| +// LEAK_SANITIZER_REGISTER_STATIC_LOCAL() takes care of the details.
|
| +//
|
| #if ENABLE(ASSERT)
|
| #define DEFINE_STATIC_LOCAL(type, name, arguments) \
|
| static StaticLocalVerifier name##StaticLocalVerifier; \
|
| - ASSERT(name##StaticLocalVerifier.isNotRacy()); \
|
| - static type& name = *new type arguments
|
| + ASSERT(name##StaticLocalVerifier.isNotRacy()); \
|
| + static type& name = *LEAK_SANITIZER_REGISTER_STATIC_LOCAL(type, new type arguments)
|
| #else
|
| #define DEFINE_STATIC_LOCAL(type, name, arguments) \
|
| - static type& name = *new type arguments
|
| -#endif
|
| -
|
| + static type& name = *LEAK_SANITIZER_REGISTER_STATIC_LOCAL(type, new type arguments)
|
| #endif
|
|
|
| -
|
| // Use this to declare and define a static local pointer to a ref-counted object so that
|
| // it is leaked so that the object's destructors are not called at exit.
|
| // This macro should be used with ref-counted objects rather than DEFINE_STATIC_LOCAL macro,
|
| // as this macro does not lead to an extra memory allocation.
|
| -#ifndef DEFINE_STATIC_REF
|
| #define DEFINE_STATIC_REF(type, name, arguments) \
|
| static type* name = PassRefPtr<type>(arguments).leakRef();
|
| -#endif
|
|
|
| /*
|
| * The reinterpret_cast<Type1*>([pointer to Type2]) expressions - where
|
|
|