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

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: 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_setter_raises_exception %} 136 {% if attribute.is_setter_raises_exception %}
140 ExceptionState es(info.GetIsolate()); 137 ExceptionState es(info.GetIsolate());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 {% endif %} 172 {% endif %}
176 {% if attribute.has_custom_setter %} 173 {% if attribute.has_custom_setter %}
177 {{v8_class_name}}::{{attribute.name}}AttributeSetterCustom(name, jsValue, in fo); 174 {{v8_class_name}}::{{attribute.name}}AttributeSetterCustom(name, jsValue, in fo);
178 {% else %} 175 {% else %}
179 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffi x}}(name, jsValue, info); 176 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffi x}}(name, jsValue, info);
180 {% endif %} 177 {% endif %}
181 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 178 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
182 } 179 }
183 {% endfilter %} 180 {% endfilter %}
184 {% endmacro %} 181 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698