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

Side by Side Diff: sky/engine/bindings/templates/methods.cpp

Issue 671173006: Remove lots of machinery related to inline event handlers. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 {##############################################################################} 1 {##############################################################################}
2 {% macro generate_method(method, world_suffix) %} 2 {% macro generate_method(method, world_suffix) %}
3 {% filter conditional(method.conditional_string) %} 3 {% filter conditional(method.conditional_string) %}
4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
5 { 5 {
6 {# Local variables #} 6 {# Local variables #}
7 {% if method.has_exception_state %} 7 {% if method.has_exception_state %}
8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
9 {% endif %} 9 {% endif %}
10 {# Overloaded methods have length checked during overload resolution #} 10 {# Overloaded methods have length checked during overload resolution #}
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi nedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasI nstance(info[{{argument.index}}], info.GetIsolate())) { 128 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi nedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasI nstance(info[{{argument.index}}], info.GetIsolate())) {
129 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % 129 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' %
130 (argument.index + 1, argument.idl_type)) | indent }} 130 (argument.index + 1, argument.idl_type)) | indent }}
131 return; 131 return;
132 } 132 }
133 {% endif %}{# argument.has_type_checking_interface #} 133 {% endif %}{# argument.has_type_checking_interface #}
134 {% if argument.is_callback_interface %} 134 {% if argument.is_callback_interface %}
135 {# FIXME: remove EventListener special case #} 135 {# FIXME: remove EventListener special case #}
136 {% if argument.idl_type == 'EventListener' %} 136 {% if argument.idl_type == 'EventListener' %}
137 {% if method.name == 'removeEventListener' or method.name == 'removeListener' %} 137 {% if method.name == 'removeEventListener' or method.name == 'removeListener' %}
138 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOnly); 138 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i nfo.GetIsolate()), info[{{argument.index}}], ListenerFindOnly);
139 {% else %}{# method.name == 'addEventListener' #} 139 {% else %}{# method.name == 'addEventListener' #}
140 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOrCreate); 140 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i nfo.GetIsolate()), info[{{argument.index}}], ListenerFindOrCreate);
141 {% endif %}{# method.name #} 141 {% endif %}{# method.name #}
142 {% else %}{# argument.idl_type == 'EventListener' #} 142 {% else %}{# argument.idl_type == 'EventListener' #}
143 {# Callback functions must be functions: 143 {# Callback functions must be functions:
144 http://www.w3.org/TR/WebIDL/#es-callback-function #} 144 http://www.w3.org/TR/WebIDL/#es-callback-function #}
145 {% if argument.is_optional %} 145 {% if argument.is_optional %}
146 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind ex}}])) { 146 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind ex}}])) {
147 if (!info[{{argument.index}}]->IsFunction()) { 147 if (!info[{{argument.index}}]->IsFunction()) {
148 {{throw_type_error(method, 148 {{throw_type_error(method,
149 '"The callback provided as parameter %s is not a function."' % 149 '"The callback provided as parameter %s is not a function."' %
150 (argument.index + 1)) | indent(8)}} 150 (argument.index + 1)) | indent(8)}}
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 if method.is_per_world_bindings else '0' %} 629 if method.is_per_world_bindings else '0' %}
630 {% set property_attribute = 630 {% set property_attribute =
631 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es) 631 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es)
632 if method.property_attributes else 'v8::None' %} 632 if method.property_attributes else 'v8::None' %}
633 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %} 633 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %}
634 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = { 634 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = {
635 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}}, 635 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}},
636 }; 636 };
637 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); 637 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate);
638 {%- endmacro %} 638 {%- endmacro %}
OLDNEW
« no previous file with comments | « sky/engine/bindings/scripts/v8_attributes.py ('k') | sky/engine/bindings/tests/idls/TestImplements.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698