Index: third_party/WebKit/Source/bindings/core/v8/ToV8ForCore.h |
diff --git a/third_party/WebKit/Source/bindings/core/v8/ToV8ForCore.h b/third_party/WebKit/Source/bindings/core/v8/ToV8ForCore.h |
index 077c84a3fb6ab127c64b592eb1baa12701cacd94..9fe40954c0f0440cb993b1899fd52edb096a4c28 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/ToV8ForCore.h |
+++ b/third_party/WebKit/Source/bindings/core/v8/ToV8ForCore.h |
@@ -8,6 +8,8 @@ |
// ToV8() provides C++ -> V8 conversion. Note that ToV8() can return an empty |
// handle. Call sites must check IsEmpty() before using return value. |
+#include "bindings/core/v8/IDLDictionaryBase.h" |
+#include "bindings/core/v8/ScriptValue.h" |
#include "bindings/core/v8/ToV8.h" |
#include "bindings/core/v8/V8NodeFilterCondition.h" |
#include "core/dom/ArrayBufferViewHelpers.h" |
@@ -52,6 +54,31 @@ inline v8::Local<v8::Value> ToV8(const V8NodeFilterCondition* value, |
return value ? value->Callback(isolate) : v8::Null(isolate).As<v8::Value>(); |
} |
+// Dictionary |
+ |
+inline v8::Local<v8::Value> ToV8(const IDLDictionaryBase& value, |
+ v8::Local<v8::Object> creation_context, |
+ v8::Isolate* isolate) { |
+ return value.ToV8Impl(creation_context, isolate); |
+} |
+ |
+// ScriptValue |
+ |
+inline v8::Local<v8::Value> ToV8(const ScriptValue& value, |
+ v8::Local<v8::Object> creation_context, |
+ v8::Isolate* isolate) { |
+ if (value.IsEmpty()) |
+ return v8::Undefined(isolate); |
+ return value.V8Value(); |
+} |
+ |
+// Cannot define in ScriptValue because of the circular dependency between toV8 |
+// and ScriptValue |
+template <typename T> |
+inline ScriptValue ScriptValue::From(ScriptState* script_state, T&& value) { |
+ return ScriptValue(script_state, ToV8(std::forward<T>(value), script_state)); |
+} |
+ |
} // namespace blink |
#endif // ToV8ForCore_h |