Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: Source/bindings/core/v8/Dictionary.h

Issue 964553003: bindings: Use V8 MaybeLocal<> APIs in Dictionary class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/bindings/core/v8/Dictionary.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
« no previous file with comments | « no previous file | Source/bindings/core/v8/Dictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698