| 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..3ceeffbfaf57129164c618c89d9e769f31bb77b4 100644
|
| --- a/third_party/WebKit/Source/wtf/StdLibExtras.h
|
| +++ b/third_party/WebKit/Source/wtf/StdLibExtras.h
|
| @@ -63,6 +63,8 @@ class WTF_EXPORT StaticLocalVerifier {
|
| namespace blink {
|
| template <typename T>
|
| class Persistent;
|
| +
|
| +class ScriptWrappable;
|
| };
|
|
|
| template <typename T,
|
| @@ -112,12 +114,19 @@ 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); \
|
| +#define DEFINE_STATIC_LOCAL(Type, Name, Arguments) \
|
| + DEFINE_STATIC_LOCAL_CHECK_THREADSAFE_ACCESS(Name); \
|
| + using WrappedTypeFor##Name = StaticLocalWrapper<Type>::WrapType; \
|
| + static_assert( \
|
| + !WTF::IsPersistentReferenceType<WrappedTypeFor##Name>::value || \
|
| + !WTF::IsSubclass<WTF::RemoveTemplate<WrappedTypeFor##Name, \
|
| + blink::Persistent>::type, \
|
| + blink::ScriptWrappable>::value, \
|
| + "It is unsafe to keep a static local singleton to a " \
|
| + "ScriptWrappable-derived object"); \
|
| + static WrappedTypeFor##Name* WrappedInstanceFor##Name = \
|
| + LEAK_SANITIZER_REGISTER_STATIC_LOCAL( \
|
| + WrappedTypeFor##Name, new WrappedTypeFor##Name Arguments); \
|
| Type& Name = StaticLocalWrapper<Type>::unwrap(WrappedInstanceFor##Name);
|
|
|
| // Use this to declare and define a static local pointer to a ref-counted object
|
|
|