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

Side by Side Diff: Source/bindings/templates/interface.cpp

Issue 140693016: IDL compiler: interface and integer types for special operations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Typo Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_configuration(attribute) %} 5 {% macro attribute_configuration(attribute) %}
6 {% set getter_callback = 6 {% set getter_callback =
7 '%sV8Internal::%sAttributeGetterCallback' % 7 '%sV8Internal::%sAttributeGetterCallback' %
8 (cpp_class, attribute.name) 8 (cpp_class, attribute.name)
9 if not attribute.constructor_type else 9 if not attribute.constructor_type else
10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %}
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 145
146 {##############################################################################} 146 {##############################################################################}
147 {% block indexed_property_setter %} 147 {% block indexed_property_setter %}
148 {% if indexed_property_setter and not indexed_property_setter.is_custom %} 148 {% if indexed_property_setter and not indexed_property_setter.is_custom %}
149 {% set setter = indexed_property_setter %} 149 {% set setter = indexed_property_setter %}
150 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 150 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
151 { 151 {
152 {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder()); 152 {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder());
153 {{setter.v8_value_to_local_cpp_value}}; 153 {{setter.v8_value_to_local_cpp_value}};
154 {% if setter.is_raises_exception %} 154 {% if setter.has_exception_state %}
155 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 155 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
156 {% endif %} 156 {% endif %}
157 {% if setter.has_strict_type_checking %} 157 {% if setter.has_strict_type_checking %}
158 {# Type checking for interface types (if interface not implemented, throw 158 {# Type checking for interface types (if interface not implemented, throw
159 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} 159 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
160 if (!isUndefinedOrNull(jsValue) && !V8{{setter.idl_type}}::hasInstance(jsVal ue, info.GetIsolate())) { 160 if (!isUndefinedOrNull(jsValue) && !V8{{setter.idl_type}}::hasInstance(jsVal ue, info.GetIsolate())) {
161 exceptionState.throwTypeError("The provided value is not of type '{{sett er.idl_type}}'."); 161 exceptionState.throwTypeError("The provided value is not of type '{{sett er.idl_type}}'.");
162 exceptionState.throwIfNeeded(); 162 exceptionState.throwIfNeeded();
163 return; 163 return;
164 } 164 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 if (info.Holder()->HasRealNamedCallbackProperty(name)) 312 if (info.Holder()->HasRealNamedCallbackProperty(name))
313 return; 313 return;
314 if (info.Holder()->HasRealNamedProperty(name)) 314 if (info.Holder()->HasRealNamedProperty(name))
315 return; 315 return;
316 316
317 {% endif %} 317 {% endif %}
318 {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder()); 318 {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder());
319 {# v8_value_to_local_cpp_value('DOMString', 'name', 'propertyName') #} 319 {# v8_value_to_local_cpp_value('DOMString', 'name', 'propertyName') #}
320 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ; 320 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ;
321 {{setter.v8_value_to_local_cpp_value}}; 321 {{setter.v8_value_to_local_cpp_value}};
322 {% if setter.is_raises_exception %} 322 {% if setter.has_exception_state %}
323 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 323 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
324 {% endif %} 324 {% endif %}
325 {% set setter_name = setter.name or 'anonymousNamedSetter' %} 325 {% set setter_name = setter.name or 'anonymousNamedSetter' %}
326 {% set setter_arguments = 326 {% set setter_arguments =
327 ['propertyName', 'propertyValue', 'exceptionState'] 327 ['propertyName', 'propertyValue', 'exceptionState']
328 if setter.is_raises_exception else 328 if setter.is_raises_exception else
329 ['propertyName', 'propertyValue'] %} 329 ['propertyName', 'propertyValue'] %}
330 bool result = collection->{{setter_name}}({{setter_arguments|join(', ')}}); 330 bool result = collection->{{setter_name}}({{setter_arguments|join(', ')}});
331 {% if setter.is_raises_exception %} 331 {% if setter.is_raises_exception %}
332 if (exceptionState.throwIfNeeded()) 332 if (exceptionState.throwIfNeeded())
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 fromInternalPointer(object)->deref(); 1182 fromInternalPointer(object)->deref();
1183 } 1183 }
1184 1184
1185 template<> 1185 template<>
1186 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1186 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1187 { 1187 {
1188 return toV8(impl, creationContext, isolate); 1188 return toV8(impl, creationContext, isolate);
1189 } 1189 }
1190 1190
1191 {% endblock %} 1191 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698