Index: Source/bindings/templates/dictionary_v8.cpp |
diff --git a/Source/bindings/templates/dictionary_v8.cpp b/Source/bindings/templates/dictionary_v8.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ba8ba2db6dd0a47c522092dc021f4f513d6b3948 |
--- /dev/null |
+++ b/Source/bindings/templates/dictionary_v8.cpp |
@@ -0,0 +1,48 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! |
+ |
+#include "config.h" |
+{% filter conditional(conditional_string) %} |
+#include "{{v8_class}}.h" |
+ |
+{% for filename in cpp_includes if filename != '%s.h' % v8_class %} |
+#include "{{filename}}" |
+{% endfor %} |
+ |
+namespace WebCore { |
+ |
+{{cpp_class}}* {{v8_class}}::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value) |
+{ |
+ {{cpp_class}}* impl = {{cpp_class}}::create(); |
+ // FIXME: Do not use Dictionary and DictionaryHelper |
Nils Barth (inactive)
2014/07/18 21:52:35
Bug number?
bashi
2014/07/22 02:33:58
Done.
|
+ Dictionary dictionary(v8Value, isolate); |
+ {% for member in members %} |
+ impl->m_{{member.has_name}} = DictionaryHelper::get(dictionary, "{{member.name}}", impl->m_{{member.name}}); |
+ {% if member.default_value %} |
+ if (!impl->m_{{member.has_name}}) |
+ impl->{{member.setter_name}}({{member.default_value}}); |
+ {% endif %} |
+ {% endfor %} |
+ return impl; |
+} |
+ |
+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); |
+ {% for member in members %} |
+ if (impl->{{member.has_name}}()) |
+ v8Object->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}}); |
+ {% endif %} |
+ |
+ {% endfor %} |
+ return v8Object; |
+} |
+ |
+} // namespace WebCore |
+{% endfilter %} |