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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/dictionary_v8.cpp

Issue 2183623004: Add IDLDictionaryBase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 {% from 'utilities.cpp' import declare_enum_validation_variable %} 1 {% from 'utilities.cpp' import declare_enum_validation_variable %}
2 {% include 'copyright_block.txt' %} 2 {% include 'copyright_block.txt' %}
3 #include "{{v8_original_class}}.h" 3 #include "{{v8_original_class}}.h"
4 4
5 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} 5 {% for filename in cpp_includes if filename != '%s.h' % v8_class %}
6 #include "{{filename}}" 6 #include "{{filename}}"
7 {% endfor %} 7 {% endfor %}
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return; 81 return;
82 } 82 }
83 {% endif %} 83 {% endif %}
84 impl.{{member.setter_name}}({{member.name}}); 84 impl.{{member.setter_name}}({{member.name}});
85 } 85 }
86 {% endfilter %} 86 {% endfilter %}
87 87
88 {% endfor %} 88 {% endfor %}
89 } 89 }
90 90
91 v8::Local<v8::Value> toV8(const {{cpp_class}}& impl, v8::Local<v8::Object> creat ionContext, v8::Isolate* isolate) 91 v8::Local<v8::Value> {{cpp_class}}::toV8Impl(v8::Local<v8::Object> creationConte xt, v8::Isolate* isolate) const
92 { 92 {
93 v8::Local<v8::Object> v8Object = v8::Object::New(isolate); 93 v8::Local<v8::Object> v8Object = v8::Object::New(isolate);
94 {% if parent_v8_class %} 94 if (!toV8{{cpp_class}}(*this, v8Object, creationContext, isolate))
95 if (!toV8{{parent_cpp_class}}(impl, v8Object, creationContext, isolate))
96 return v8::Local<v8::Value>();
97 {% endif %}
98 if (!toV8{{cpp_class}}(impl, v8Object, creationContext, isolate))
99 return v8::Local<v8::Value>(); 95 return v8::Local<v8::Value>();
100 return v8Object; 96 return v8Object;
101 } 97 }
102 98
103 bool toV8{{cpp_class}}(const {{cpp_class}}& impl, v8::Local<v8::Object> dictiona ry, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) 99 bool toV8{{cpp_class}}(const {{cpp_class}}& impl, v8::Local<v8::Object> dictiona ry, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
104 { 100 {
101 {% if parent_v8_class %}
102 if (!toV8{{parent_cpp_class}}(impl, dictionary, creationContext, isolate))
103 return false;
104
105 {% endif %}
105 {% for member in members %} 106 {% for member in members %}
106 if (impl.{{member.has_method_name}}()) { 107 if (impl.{{member.has_method_name}}()) {
107 {% if member.is_object %} 108 {% if member.is_object %}
108 ASSERT(impl.{{member.cpp_name}}().isObject()); 109 ASSERT(impl.{{member.cpp_name}}().isObject());
109 {% endif %} 110 {% endif %}
110 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentCon text(), v8String(isolate, "{{member.name}}"), {{member.cpp_value_to_v8_value}})) ) 111 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentCon text(), v8String(isolate, "{{member.name}}"), {{member.cpp_value_to_v8_value}})) )
111 return false; 112 return false;
112 {% if member.v8_default_value %} 113 {% if member.v8_default_value %}
113 } else { 114 } else {
114 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentCon text(), v8String(isolate, "{{member.name}}"), {{member.v8_default_value}}))) 115 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentCon text(), v8String(isolate, "{{member.name}}"), {{member.v8_default_value}})))
(...skipping 13 matching lines...) Expand all
128 } 129 }
129 130
130 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) 131 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState)
131 { 132 {
132 {{cpp_class}} impl; 133 {{cpp_class}} impl;
133 {{v8_class}}::toImpl(isolate, value, impl, exceptionState); 134 {{v8_class}}::toImpl(isolate, value, impl, exceptionState);
134 return impl; 135 return impl;
135 } 136 }
136 137
137 } // namespace blink 138 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698