| OLD | NEW |
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro generate_method(method) %} | 2 {% macro generate_method(method) %} |
| 3 static void {{method.name}}Method(const v8::FunctionCallbackInfo<v8::Value>& arg
s) | 3 static void {{method.name}}Method(const v8::FunctionCallbackInfo<v8::Value>& arg
s) |
| 4 { | 4 { |
| 5 {% if method.number_of_required_arguments %} | 5 {% if method.number_of_required_arguments %} |
| 6 if (UNLIKELY(args.Length() < {{method.number_of_required_arguments}})) { | 6 if (UNLIKELY(args.Length() < {{method.number_of_required_arguments}})) { |
| 7 throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{
interface_name}}", ExceptionMessages::notEnoughArguments({{method.number_of_requ
ired_arguments}}, args.Length())), args.GetIsolate()); | 7 throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{
interface_name}}", ExceptionMessages::notEnoughArguments({{method.number_of_requ
ired_arguments}}, args.Length())), args.GetIsolate()); |
| 8 return; | 8 return; |
| 9 } | 9 } |
| 10 {% endif %} | 10 {% endif %} |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 {{argument.v8_value_to_local_cpp_value}}; | 34 {{argument.v8_value_to_local_cpp_value}}; |
| 35 {% endif %} | 35 {% endif %} |
| 36 {% if argument.enum_validation_expression %} | 36 {% if argument.enum_validation_expression %} |
| 37 {# Methods throw on invalid enum values: http://www.w3.org/TR/WebIDL/#idl-en
ums #} | 37 {# Methods throw on invalid enum values: http://www.w3.org/TR/WebIDL/#idl-en
ums #} |
| 38 String string = {{argument.name}}; | 38 String string = {{argument.name}}; |
| 39 if (!({{argument.enum_validation_expression}})) { | 39 if (!({{argument.enum_validation_expression}})) { |
| 40 throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{
interface_name}}", "parameter {{argument.index + 1}} ('" + string + "') is not a
valid enum value."), args.GetIsolate()); | 40 throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{
interface_name}}", "parameter {{argument.index + 1}} ('" + string + "') is not a
valid enum value."), args.GetIsolate()); |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 {% endif %} | 43 {% endif %} |
| 44 {% if argument.idl_type == 'Dictionary' %} |
| 45 if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) { |
| 46 throwTypeError(ExceptionMessages::failedToExecute("voidMethodDictionaryA
rg", "TestObjectPython", "parameter 1 ('dictionaryArg') is not an object."), arg
s.GetIsolate()); |
| 47 return; |
| 48 } |
| 49 {% endif %} |
| 44 {% endfor %} | 50 {% endfor %} |
| 45 {{method.cpp_method}}; | 51 {{method.cpp_method}}; |
| 46 } | 52 } |
| 47 {% endmacro %} | 53 {% endmacro %} |
| 48 | 54 |
| 49 | 55 |
| 50 {##############################################################################} | 56 {##############################################################################} |
| 51 {% macro method_callback(method) %} | 57 {% macro method_callback(method) %} |
| 52 static void {{method.name}}MethodCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& args) | 58 static void {{method.name}}MethodCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& args) |
| 53 { | 59 { |
| 54 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 60 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 55 {{cpp_class_name}}V8Internal::{{method.name}}Method(args); | 61 {{cpp_class_name}}V8Internal::{{method.name}}Method(args); |
| 56 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 62 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 57 } | 63 } |
| 58 {% endmacro %} | 64 {% endmacro %} |
| OLD | NEW |