| Index: third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.h
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.h b/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.h
|
| index 3bbe969450019357733b0853080713e4dab72ab8..68d41787ddc5e1a9d633a37a114906aac2c41991 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.h
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.h
|
| @@ -23,21 +23,40 @@ class ScriptWrappableVisitor;
|
| * thread-specific list. They keep their wrappers and dependant objects alive
|
| * as long as they have pending activity.
|
| */
|
| -class CORE_EXPORT ActiveScriptWrappable : public GarbageCollectedMixin {
|
| - WTF_MAKE_NONCOPYABLE(ActiveScriptWrappable);
|
| +class CORE_EXPORT ActiveScriptWrappableBase : public GarbageCollectedMixin {
|
| + WTF_MAKE_NONCOPYABLE(ActiveScriptWrappableBase);
|
|
|
| public:
|
| - explicit ActiveScriptWrappable(ScriptWrappable*);
|
| + explicit ActiveScriptWrappableBase(ScriptWrappable*);
|
|
|
| static void traceActiveScriptWrappables(v8::Isolate*,
|
| ScriptWrappableVisitor*);
|
|
|
| + protected:
|
| + virtual bool isContextDestroyed(ActiveScriptWrappableBase*) const = 0;
|
| +
|
| private:
|
| ScriptWrappable* toScriptWrappable() const { return m_scriptWrappable; }
|
|
|
| ScriptWrappable* m_scriptWrappable;
|
| };
|
|
|
| +template <typename T>
|
| +class ActiveScriptWrappable : public ActiveScriptWrappableBase {
|
| + WTF_MAKE_NONCOPYABLE(ActiveScriptWrappable);
|
| +
|
| + public:
|
| + explicit ActiveScriptWrappable(ScriptWrappable* wrappable)
|
| + : ActiveScriptWrappableBase(wrappable) {}
|
| +
|
| + protected:
|
| + bool isContextDestroyed(ActiveScriptWrappableBase* object) const final {
|
| + return !(static_cast<T*>(object)->T::getExecutionContext)() ||
|
| + (static_cast<T*>(object)->T::getExecutionContext)()
|
| + ->isContextDestroyed();
|
| + }
|
| +};
|
| +
|
| } // namespace blink
|
|
|
| #endif // ActiveScriptWrappable_h
|
|
|