Chromium Code Reviews| Index: Source/bindings/core/v8/Dictionary.h |
| diff --git a/Source/bindings/core/v8/Dictionary.h b/Source/bindings/core/v8/Dictionary.h |
| index 5860f34414e00be8276216d35edc9ca8d684d6e0..69c577bb779166ca87caf9a15993cf99806f0849 100644 |
| --- a/Source/bindings/core/v8/Dictionary.h |
| +++ b/Source/bindings/core/v8/Dictionary.h |
| @@ -29,6 +29,7 @@ |
| #include "bindings/core/v8/ExceptionMessages.h" |
| #include "bindings/core/v8/ExceptionState.h" |
| #include "bindings/core/v8/Nullable.h" |
| +#include "bindings/core/v8/ScriptState.h" |
| #include "bindings/core/v8/ScriptValue.h" |
| #include "bindings/core/v8/V8Binding.h" |
| #include "bindings/core/v8/V8BindingMacros.h" |
| @@ -44,12 +45,12 @@ namespace blink { |
| // Dictionary class provides ways to retrieve property values as C++ objects |
| // from a V8 object. Instances of this class must not outlive V8's handle scope |
| // because they hold a V8 value without putting it on persistent handles. |
| -class Dictionary { |
| +class Dictionary final : public ScriptState::Observer { |
|
haraken
2015/03/03 05:12:15
ScriptState::Observer is just intended to be used
bashi
2015/03/03 05:56:28
I see.
|
| ALLOW_ONLY_INLINE_ALLOCATION(); |
| public: |
| Dictionary(); |
| Dictionary(const v8::Handle<v8::Value>& options, v8::Isolate*, ExceptionState&); |
| - ~Dictionary(); |
| + virtual ~Dictionary(); |
| Dictionary& operator=(const Dictionary&); |
| @@ -120,11 +121,21 @@ public: |
| bool hasProperty(const String&) const; |
| v8::Isolate* isolate() const { return m_isolate; } |
| + // Used by DictionaryHelper. This context could be an empty handle and |
| + // should be used only for V8 APIs which return MaybeLocal<T>. |
| + v8::Local<v8::Context> context() const { return m_context; } |
| bool getKey(const String& key, v8::Local<v8::Value>&) const; |
| private: |
| + // ScriptState::Observer implementation |
| + virtual void willDisposeScriptState(ScriptState*) override; |
| + |
| + void subscribeScriptStateDisposal(); |
| + void unsubscribeScriptStateDisposal(); |
| + |
| v8::Handle<v8::Value> m_options; |
| + v8::Local<v8::Context> m_context; |
|
bashi
2015/03/03 04:25:05
Should we hold ScriptState instead of v8::Local<v8
haraken
2015/03/03 05:12:15
A big YES. If a DOM object needs to keep some scri
bashi
2015/03/03 05:56:28
Yeah, relying on RefPtr looks much better, and wil
haraken
2015/03/03 06:12:14
I'm sorry for not being clear.
Using GetCurrentCo
|
| v8::Isolate* m_isolate; |
| ExceptionState* m_exceptionState; |
| }; |