OLD | NEW |
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 {% else %}{# argument.is_optional #} | 152 {% else %}{# argument.is_optional #} |
153 if (info.Length() <= {{argument.index}} || !{% if argument.is_nullable %}(info[{
{argument.index}}]->IsFunction() || info[{{argument.index}}]->IsNull()){% else %
}info[{{argument.index}}]->IsFunction(){% endif %}) { | 153 if (info.Length() <= {{argument.index}} || !{% if argument.is_nullable %}(info[{
{argument.index}}]->IsFunction() || info[{{argument.index}}]->IsNull()){% else %
}info[{{argument.index}}]->IsFunction(){% endif %}) { |
154 {{throw_type_error(method, | 154 {{throw_type_error(method, |
155 '"The callback provided as parameter %s is not a function."' % | 155 '"The callback provided as parameter %s is not a function."' % |
156 (argument.index + 1)) | indent }} | 156 (argument.index + 1)) | indent }} |
157 return; | 157 return; |
158 } | 158 } |
159 {{argument.name}} = {% if argument.is_nullable %}info[{{argument.index}}]->IsNul
l() ? nullptr : {% endif %}V8{{argument.idl_type}}::create(v8::Handle<v8::Functi
on>::Cast(info[{{argument.index}}]), ScriptState::current(info.GetIsolate())); | 159 {{argument.name}} = {% if argument.is_nullable %}info[{{argument.index}}]->IsNul
l() ? nullptr : {% endif %}V8{{argument.idl_type}}::create(v8::Handle<v8::Functi
on>::Cast(info[{{argument.index}}]), ScriptState::current(info.GetIsolate())); |
160 {% endif %}{# argument.is_optional #} | 160 {% endif %}{# argument.is_optional #} |
161 {% endif %}{# argument.idl_type == 'EventListener' #} | 161 {% endif %}{# argument.idl_type == 'EventListener' #} |
162 {% elif argument.idl_type == 'SerializedScriptValue' %} | |
163 {{argument.name}} = SerializedScriptValue::create(info[{{argument.index}}], 0, 0
, exceptionState, info.GetIsolate()); | |
164 if (exceptionState.hadException()) { | |
165 {{throw_from_exception_state(method)}}; | |
166 return; | |
167 } | |
168 {% elif argument.is_variadic_wrapper_type %} | 162 {% elif argument.is_variadic_wrapper_type %} |
169 for (int i = {{argument.index}}; i < info.Length(); ++i) { | 163 for (int i = {{argument.index}}; i < info.Length(); ++i) { |
170 if (!V8{{argument.idl_type}}::hasInstance(info[i], info.GetIsolate())) { | 164 if (!V8{{argument.idl_type}}::hasInstance(info[i], info.GetIsolate())) { |
171 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % | 165 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % |
172 (argument.index + 1, argument.idl_type)) | in
dent(8)}} | 166 (argument.index + 1, argument.idl_type)) | in
dent(8)}} |
173 return; | 167 return; |
174 } | 168 } |
175 {{argument.name}}.append(V8{{argument.idl_type}}::toImpl(v8::Handle<v8::Obje
ct>::Cast(info[i]))); | 169 {{argument.name}}.append(V8{{argument.idl_type}}::toImpl(v8::Handle<v8::Obje
ct>::Cast(info[i]))); |
176 } | 170 } |
177 {% elif argument.is_dictionary %} | 171 {% elif argument.is_dictionary %} |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 if method.is_per_world_bindings else '0' %} | 621 if method.is_per_world_bindings else '0' %} |
628 {% set property_attribute = | 622 {% set property_attribute = |
629 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) | 623 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) |
630 if method.property_attributes else 'v8::None' %} | 624 if method.property_attributes else 'v8::None' %} |
631 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat
eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo
sedToAllScripts' %} | 625 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat
eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo
sedToAllScripts' %} |
632 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { | 626 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { |
633 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}},
{{method.length}}, {{only_exposed_to_private_script}}, | 627 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}},
{{method.length}}, {{only_exposed_to_private_script}}, |
634 }; | 628 }; |
635 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu
re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); | 629 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu
re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); |
636 {%- endmacro %} | 630 {%- endmacro %} |
OLD | NEW |