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

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

Issue 32323012: IDL compiler: move EventHandler null check out of generated bindings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 2 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 {##############################################################################} 1 {##############################################################################}
2 {% macro attribute_getter(attribute, world_suffix) %} 2 {% macro attribute_getter(attribute, world_suffix) %}
3 {% filter conditional(attribute.conditional_string) %} 3 {% filter conditional(attribute.conditional_string) %}
4 static void {{attribute.name}}AttributeGetter{{world_suffix}}(v8::Local<v8::Stri ng> name, const v8::PropertyCallbackInfo<v8::Value>& info) 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}(v8::Local<v8::Stri ng> name, const v8::PropertyCallbackInfo<v8::Value>& info)
5 { 5 {
6 {% if attribute.is_unforgeable %} 6 {% if attribute.is_unforgeable %}
7 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{ v8_class_name}}::GetTemplate(info.GetIsolate(), worldType(info.GetIsolate()))); 7 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{ v8_class_name}}::GetTemplate(info.GetIsolate(), worldType(info.GetIsolate())));
8 if (holder.IsEmpty()) 8 if (holder.IsEmpty())
9 return; 9 return;
10 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(holder); 10 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(holder);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 {% if not attribute.is_static %} 118 {% if not attribute.is_static %}
119 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder()); 119 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder());
120 {% endif %} 120 {% endif %}
121 {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %} 121 {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %}
122 if (!imp->document()) 122 if (!imp->document())
123 return; 123 return;
124 {% endif %} 124 {% endif %}
125 {% if attribute.idl_type != 'EventHandler' %} 125 {% if attribute.idl_type != 'EventHandler' %}
126 {{attribute.v8_value_to_local_cpp_value}}; 126 {{attribute.v8_value_to_local_cpp_value}};
127 {% else %}{# EventHandler hack #} 127 {% else %}{# EventHandler hack #}
128 {# Non-callable input should be treated as null #}
129 if (!jsValue->IsNull() && !jsValue->IsFunction())
130 jsValue = v8::Null(info.GetIsolate());
131 transferHiddenDependency(info.Holder(), {{attribute.event_handler_getter_exp ression}}, jsValue, {{v8_class_name}}::eventListenerCacheIndex, info.GetIsolate( )); 128 transferHiddenDependency(info.Holder(), {{attribute.event_handler_getter_exp ression}}, jsValue, {{v8_class_name}}::eventListenerCacheIndex, info.GetIsolate( ));
132 {% endif %} 129 {% endif %}
133 {% if attribute.enum_validation_expression %} 130 {% if attribute.enum_validation_expression %}
134 {# Setter ignores invalid enum values #} 131 {# Setter ignores invalid enum values #}
135 String string = cppValue; 132 String string = cppValue;
136 if (!({{attribute.enum_validation_expression}})) 133 if (!({{attribute.enum_validation_expression}}))
137 return; 134 return;
138 {% endif %} 135 {% endif %}
139 {% if attribute.is_reflect %} 136 {% if attribute.is_reflect %}
140 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 137 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 {% endif %} 178 {% endif %}
182 {% if attribute.has_custom_setter %} 179 {% if attribute.has_custom_setter %}
183 {{v8_class_name}}::{{attribute.name}}AttributeSetterCustom(name, jsValue, in fo); 180 {{v8_class_name}}::{{attribute.name}}AttributeSetterCustom(name, jsValue, in fo);
184 {% else %} 181 {% else %}
185 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffi x}}(name, jsValue, info); 182 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffi x}}(name, jsValue, info);
186 {% endif %} 183 {% endif %}
187 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 184 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
188 } 185 }
189 {% endfilter %} 186 {% endfilter %}
190 {% endmacro %} 187 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698