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

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

Issue 1035623002: bindings: Use Maybe APIs in ScriptPromise (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
Index: Source/bindings/core/v8/ScriptValue.h
diff --git a/Source/bindings/core/v8/ScriptValue.h b/Source/bindings/core/v8/ScriptValue.h
index 7ad2aecaed7c51507d12e55ea33d1dd2cecd2704..73b366d0cbe4fd67e4690ed372e1f78c823ac2d0 100644
--- a/Source/bindings/core/v8/ScriptValue.h
+++ b/Source/bindings/core/v8/ScriptValue.h
@@ -67,6 +67,14 @@ public:
ASSERT(isEmpty() || m_scriptState);
}
+ template <typename T>
+ ScriptValue(ScriptState* scriptState, v8::MaybeLocal<T> value)
+ : m_scriptState(scriptState)
+ , m_value(value.IsEmpty() ? nullptr : SharedPersistent<v8::Value>::create(value.ToLocalChecked(), scriptState->isolate()))
+ {
+ ASSERT(isEmpty() || m_scriptState);
+ }
+
ScriptValue(const ScriptValue& value)
: m_scriptState(value.m_scriptState)
, m_value(value.m_value)
@@ -84,6 +92,11 @@ public:
return m_scriptState ? m_scriptState->isolate() : v8::Isolate::GetCurrent();
}
+ v8::Local<v8::Context> context() const
+ {
+ return m_scriptState ? isolate()->GetCurrentContext() : v8::Local<v8::Context>();
haraken 2015/03/25 04:29:59 This seems wrong. We need to use m_scriptState->co
bashi 2015/03/25 04:56:00 Done.
+ }
+
ScriptValue& operator=(const ScriptValue& value)
{
if (this != &value) {

Powered by Google App Engine
This is Rietveld 408576698