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

Side by Side Diff: Source/bindings/templates/methods.cpp

Issue 52353003: IDL compiler: 3 more special types for methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revised Created 7 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 | Annotate | Revision Log
OLDNEW
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
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 %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/v8_types.py ('k') | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698