| 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 26ba1d8d02958298aacfc73daea5743ccbbce201..e88a4f6267e287ff7ddba3296ef6f65142d62d3f 100644
|
| --- a/third_party/WebKit/Source/wtf/StdLibExtras.h
|
| +++ b/third_party/WebKit/Source/wtf/StdLibExtras.h
|
| @@ -26,12 +26,13 @@
|
| #ifndef WTF_StdLibExtras_h
|
| #define WTF_StdLibExtras_h
|
|
|
| +#include <cstddef>
|
| #include "base/numerics/safe_conversions.h"
|
| +#include "wtf/Allocator.h"
|
| #include "wtf/Assertions.h"
|
| #include "wtf/CPU.h"
|
| #include "wtf/LeakAnnotations.h"
|
| #include "wtf/TypeTraits.h"
|
| -#include <cstddef>
|
|
|
| #if DCHECK_IS_ON()
|
| #include "wtf/Noncopyable.h"
|
| @@ -112,13 +113,24 @@ class StaticLocalWrapper<T, true> {
|
| // LEAK_SANITIZER_REGISTER_STATIC_LOCAL() use, it taking care of the grungy
|
| // details.
|
| //
|
| -#define DEFINE_STATIC_LOCAL(Type, Name, Arguments) \
|
| - DEFINE_STATIC_LOCAL_CHECK_THREADSAFE_ACCESS(Name); \
|
| - using WrappedTypeFor##Name = StaticLocalWrapper<Type>::WrapType; \
|
| - static WrappedTypeFor##Name* WrappedInstanceFor##Name = \
|
| - LEAK_SANITIZER_REGISTER_STATIC_LOCAL( \
|
| - WrappedTypeFor##Name, new WrappedTypeFor##Name Arguments); \
|
| - Type& Name = StaticLocalWrapper<Type>::unwrap(WrappedInstanceFor##Name);
|
| +
|
| +#define DEFINE_STATIC_LOCAL(Type, Name, Arguments) \
|
| + STATIC_ALLOCATED_SINGLETON() \
|
| + static StaticLocalWrapper<Type>::WrapType* WrappedInstanceFor##Name = \
|
| + LEAK_SANITIZER_REGISTER_STATIC_LOCAL( \
|
| + StaticLocalWrapper<Type>::WrapType, \
|
| + new StaticLocalWrapper<Type>::WrapType Arguments); \
|
| + DEFINE_STATIC_LOCAL_CHECK_THREADSAFE_ACCESS(Name); \
|
| + Type& Name = StaticLocalWrapper<Type>::unwrap(WrappedInstanceFor##Name)
|
| +
|
| +// Static local singletons that embed ScriptWrappable-derived objects are
|
| +// problematic (see issue 688569). The clang GC plugin issues warnings
|
| +// when encountering such singletons. If you cannot avoid introducing
|
| +// the static local and can prove that the ScriptWrappable reference is
|
| +// safe, you may use ALLOW_UNSAFE_SINGLETON() to disable the clang GC
|
| +// plugin check. See issue 688569 for more details.
|
| +//
|
| +#define ALLOW_UNSAFE_SINGLETON() GC_PLUGIN_IGNORE("crbug.com/688569")
|
|
|
| // 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
|
|
|