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

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

Issue 1883663005: Remove remaining binding layer RawPtr<>s. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value, check_origin_trial %} 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value, check_origin_trial %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% macro generate_method(method, world_suffix) %} 4 {% macro generate_method(method, world_suffix) %}
5 {% if method.returns_promise and method.has_exception_state %} 5 {% if method.returns_promise and method.has_exception_state %}
6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e) 6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e)
7 {% else %} 7 {% else %}
8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
9 {% endif %} 9 {% endif %}
10 { 10 {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (exceptionState.hadException()) 76 if (exceptionState.hadException())
77 v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.G etIsolate())).v8Value()); 77 v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.G etIsolate())).v8Value());
78 } 78 }
79 {% endif %} 79 {% endif %}
80 {% endmacro %} 80 {% endmacro %}
81 81
82 82
83 {######################################} 83 {######################################}
84 {% macro generate_arguments(method, world_suffix) %} 84 {% macro generate_arguments(method, world_suffix) %}
85 {% for argument in method.arguments %} 85 {% for argument in method.arguments %}
86 {{generate_argument_var_declaration(argument)}}; 86 {{argument.cpp_type}} {{argument.name}};
87 {% endfor %} 87 {% endfor %}
88 { 88 {
89 {% if method.has_optional_argument_without_default_value %} 89 {% if method.has_optional_argument_without_default_value %}
90 {# Count the effective number of arguments. (arg1, arg2, undefined) is 90 {# Count the effective number of arguments. (arg1, arg2, undefined) is
91 interpreted as two arguments are passed and (arg1, undefined, arg3) is 91 interpreted as two arguments are passed and (arg1, undefined, arg3) is
92 interpreted as three arguments are passed. #} 92 interpreted as three arguments are passed. #}
93 int numArgsPassed = info.Length(); 93 int numArgsPassed = info.Length();
94 while (numArgsPassed > 0) { 94 while (numArgsPassed > 0) {
95 if (!info[numArgsPassed - 1]->IsUndefined()) 95 if (!info[numArgsPassed - 1]->IsUndefined())
96 break; 96 break;
97 --numArgsPassed; 97 --numArgsPassed;
98 } 98 }
99 {% endif %} 99 {% endif %}
100 {% for argument in method.arguments %} 100 {% for argument in method.arguments %}
101 {% if argument.set_default_value %} 101 {% if argument.set_default_value %}
102 if (!info[{{argument.index}}]->IsUndefined()) { 102 if (!info[{{argument.index}}]->IsUndefined()) {
103 {{generate_argument(method, argument, world_suffix) | indent(8)}} 103 {{generate_argument(method, argument, world_suffix) | indent(8)}}
104 } else { 104 } else {
105 {{argument.set_default_value}}; 105 {{argument.set_default_value}};
106 } 106 }
107 {% else %} 107 {% else %}
108 {{generate_argument(method, argument, world_suffix) | indent}} 108 {{generate_argument(method, argument, world_suffix) | indent}}
109 {% endif %} 109 {% endif %}
110 {% endfor %} 110 {% endfor %}
111 } 111 }
112 {% endmacro %} 112 {% endmacro %}
113 113
114 114
115 {######################################} 115 {######################################}
116 {% macro generate_argument_var_declaration(argument) %}
117 {# FIXME: remove EventListener special case #}
118 {% if argument.idl_type == 'EventListener' %}
119 RawPtr<{{argument.idl_type}}> {{argument.name}}
120 {%- else %}
121 {{argument.cpp_type}} {{argument.name}}
122 {%- endif %}{# argument.idl_type == 'EventListener' #}
123 {% endmacro %}
124
125
126 {######################################}
127 {% macro generate_argument(method, argument, world_suffix) %} 116 {% macro generate_argument(method, argument, world_suffix) %}
128 {% if argument.is_optional_without_default_value %} 117 {% if argument.is_optional_without_default_value %}
129 {# Optional arguments without a default value generate an early call with 118 {# Optional arguments without a default value generate an early call with
130 fewer arguments if they are omitted. 119 fewer arguments if they are omitted.
131 Optional Dictionary arguments default to empty dictionary. #} 120 Optional Dictionary arguments default to empty dictionary. #}
132 if (UNLIKELY(numArgsPassed <= {{argument.index}})) { 121 if (UNLIKELY(numArgsPassed <= {{argument.index}})) {
133 {% if world_suffix %} 122 {% if world_suffix %}
134 {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argum ent.cpp_value) | indent}} 123 {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argum ent.cpp_value) | indent}}
135 {% else %} 124 {% else %}
136 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent}} 125 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent}}
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all 686 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all
698 if method.overloads else 687 if method.overloads else
699 method.runtime_enabled_function) %} 688 method.runtime_enabled_function) %}
700 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 689 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
701 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj ect, interfaceObject, signature, {{method.name}}MethodConfiguration); 690 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj ect, interfaceObject, signature, {{method.name}}MethodConfiguration);
702 {% endfilter %}{# runtime_enabled() #} 691 {% endfilter %}{# runtime_enabled() #}
703 {% endfilter %}{# exposed() #} 692 {% endfilter %}{# exposed() #}
704 {% endfor %} 693 {% endfor %}
705 {% endif %} 694 {% endif %}
706 {%- endmacro %} 695 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698