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

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

Issue 740453004: IDL: Basic dictionary inheritance support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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/templates/dictionary_v8.cpp
diff --git a/Source/bindings/templates/dictionary_v8.cpp b/Source/bindings/templates/dictionary_v8.cpp
index 438268b6d4edece589712b62d1dbc5e3d3635d79..769f5ef44d67fb4e911f36455adc62950eb1bf29 100644
--- a/Source/bindings/templates/dictionary_v8.cpp
+++ b/Source/bindings/templates/dictionary_v8.cpp
@@ -22,6 +22,12 @@ void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, {
return;
}
+ {% if parent_v8_class %}
+ {{parent_v8_class}}::toImpl(isolate, v8Value, impl, exceptionState);
+ if (exceptionState.hadException())
+ return;
+
+ {% endif %}
// FIXME: Do not use Dictionary and DictionaryHelper
// https://crbug.com/321462
Dictionary dictionary(v8Value, isolate);
@@ -55,20 +61,28 @@ void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, {
v8::Handle<v8::Value> toV8({{cpp_class}}& impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
v8::Handle<v8::Object> v8Object = v8::Object::New(isolate);
+ {% if parent_v8_class %}
+ toV8{{parent_cpp_class}}(impl, v8Object, creationContext, isolate);
+ {% endif %}
+ toV8{{cpp_class}}(impl, v8Object, creationContext, isolate);
+ return v8Object;
+}
+
+void toV8{{cpp_class}}({{cpp_class}}& impl, v8::Handle<v8::Object> dictionary, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
{% for member in members %}
if (impl.{{member.has_method_name}}()) {
{% if member.is_object %}
ASSERT(impl.{{member.cpp_name}}().isObject());
{% endif %}
- v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value_to_v8_value}});
+ dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value_to_v8_value}});
{% if member.v8_default_value %}
} else {
- v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.v8_default_value}});
+ dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.v8_default_value}});
{% endif %}
}
{% endfor %}
- return v8Object;
}
} // namespace blink
« no previous file with comments | « Source/bindings/templates/dictionary_v8.h ('k') | Source/bindings/tests/idls/core/TestDictionaryDerived.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698