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

Unified Diff: Source/bindings/templates/dictionary_v8.cpp

Issue 590443002: IDL: object type support for IDL dictionary (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 3 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 | « Source/bindings/scripts/v8_types.py ('k') | Source/bindings/tests/idls/core/TestDictionary.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/dictionary_v8.cpp
diff --git a/Source/bindings/templates/dictionary_v8.cpp b/Source/bindings/templates/dictionary_v8.cpp
index fc0bac90bb8ae7a6721222ef7200e14efc3455bc..1e34b333efa181f25b3e3f1334846278b46a653a 100644
--- a/Source/bindings/templates/dictionary_v8.cpp
+++ b/Source/bindings/templates/dictionary_v8.cpp
@@ -33,6 +33,11 @@ namespace blink {
exceptionState.throwTypeError("member {{member.name}} ('" + string + "') is not a valid enum value.");
return 0;
}
+ {% elif member.is_object %}
+ if (!{{member.name}}.isObject()) {
+ exceptionState.throwTypeError("member {{member.name}} is not an object.");
+ return 0;
+ }
{% endif %}
impl->{{member.setter_name}}({{member.name}});
} else if (block.HasCaught()) {
@@ -47,12 +52,16 @@ v8::Handle<v8::Value> toV8({{cpp_class}}* impl, v8::Handle<v8::Object> creationC
{
v8::Handle<v8::Object> v8Object = v8::Object::New(isolate);
{% for member in members %}
- if (impl->{{member.has_method_name}}())
+ if (impl->{{member.has_method_name}}()) {
+ {% if member.is_object %}
+ ASSERT(impl->{{member.name}}().isObject());
+ {% endif %}
v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value_to_v8_value}});
{% if member.v8_default_value %}
- else
+ } else {
v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.v8_default_value}});
{% endif %}
+ }
{% endfor %}
return v8Object;
}
« no previous file with comments | « Source/bindings/scripts/v8_types.py ('k') | Source/bindings/tests/idls/core/TestDictionary.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698