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 {% if method.has_exception_state %} | 6 {% if method.has_exception_state %} |
7 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 7 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
8 {% endif %} | 8 {% endif %} |
9 {% if method.name in ['addEventListener', 'removeEventListener', | 9 {% if method.name in ['addEventListener', 'removeEventListener', |
10 'dispatchEvent'] %} | 10 'dispatchEvent'] %} |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 V8TRYCATCH_VOID(double, {{argument.name}}NativeValue, info[{{argument.index}}]->
NumberValue()); | 141 V8TRYCATCH_VOID(double, {{argument.name}}NativeValue, info[{{argument.index}}]->
NumberValue()); |
142 if (!std::isnan({{argument.name}}NativeValue)) | 142 if (!std::isnan({{argument.name}}NativeValue)) |
143 {# IDL type is used for clamping, for the right bounds, since different | 143 {# IDL type is used for clamping, for the right bounds, since different |
144 IDL integer types have same internal C++ type (int or unsigned) #} | 144 IDL integer types have same internal C++ type (int or unsigned) #} |
145 {{argument.name}} = clampTo<{{argument.idl_type}}>({{argument.name}}NativeVa
lue); | 145 {{argument.name}} = clampTo<{{argument.idl_type}}>({{argument.name}}NativeVa
lue); |
146 {% elif argument.idl_type == 'SerializedScriptValue' %} | 146 {% elif argument.idl_type == 'SerializedScriptValue' %} |
147 {{argument.cpp_type}} {{argument.name}} = SerializedScriptValue::create(info[{{a
rgument.index}}], 0, 0, exceptionState, info.GetIsolate()); | 147 {{argument.cpp_type}} {{argument.name}} = SerializedScriptValue::create(info[{{a
rgument.index}}], 0, 0, exceptionState, info.GetIsolate()); |
148 if (exceptionState.throwIfNeeded()) | 148 if (exceptionState.throwIfNeeded()) |
149 return; | 149 return; |
150 {% elif argument.is_variadic_wrapper_type %} | 150 {% elif argument.is_variadic_wrapper_type %} |
151 Vector<{{argument.cpp_type}} > {{argument.name}}; | 151 {{argument.vector_type}}<{{argument.cpp_type}} > {{argument.name}}; |
152 for (int i = {{argument.index}}; i < info.Length(); ++i) { | 152 for (int i = {{argument.index}}; i < info.Length(); ++i) { |
153 if (!V8{{argument.idl_type}}::hasInstance(info[i], info.GetIsolate())) { | 153 if (!V8{{argument.idl_type}}::hasInstance(info[i], info.GetIsolate())) { |
154 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % | 154 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % |
155 (argument.index + 1, argument.idl_type)) | in
dent(8)}} | 155 (argument.index + 1, argument.idl_type)) | in
dent(8)}} |
156 return; | 156 return; |
157 } | 157 } |
158 {{argument.name}}.append(V8{{argument.idl_type}}::toNative(v8::Handle<v8::Ob
ject>::Cast(info[i]))); | 158 {{argument.name}}.append(V8{{argument.idl_type}}::toNative(v8::Handle<v8::Ob
ject>::Cast(info[i]))); |
159 } | 159 } |
160 {% else %} | 160 {% else %} |
161 {{argument.v8_value_to_local_cpp_value}}; | 161 {{argument.v8_value_to_local_cpp_value}}; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 v8::Handle<v8::Object> wrapper = info.Holder(); | 437 v8::Handle<v8::Object> wrapper = info.Holder(); |
438 {% if is_constructor_raises_exception %} | 438 {% if is_constructor_raises_exception %} |
439 if (exceptionState.throwIfNeeded()) | 439 if (exceptionState.throwIfNeeded()) |
440 return; | 440 return; |
441 {% endif %} | 441 {% endif %} |
442 | 442 |
443 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8
_class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu
ration::Dependent); | 443 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8
_class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu
ration::Dependent); |
444 v8SetReturnValue(info, wrapper); | 444 v8SetReturnValue(info, wrapper); |
445 } | 445 } |
446 {% endmacro %} | 446 {% endmacro %} |
OLD | NEW |