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

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

Issue 2304453004: [Bindings] Expose V8 callback functions in generated code (Closed)
Patch Set: Expose call Callback functions in binding scripts Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/templates/constants.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value %} 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% macro attribute_getter(attribute, world_suffix) %} 4 {% macro attribute_getter(attribute, world_suffix) %}
5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}(
6 {%- if attribute.is_data_type_property %} 6 {%- if attribute.is_data_type_property %}
7 const v8::PropertyCallbackInfo<v8::Value>& info 7 const v8::PropertyCallbackInfo<v8::Value>& info
8 {%- else %} 8 {%- else %}
9 const v8::FunctionCallbackInfo<v8::Value>& info 9 const v8::FunctionCallbackInfo<v8::Value>& info
10 {%- endif %}) 10 {%- endif %})
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 {{cpp_value}} = "{{value}}"; 163 {{cpp_value}} = "{{value}}";
164 {% endfor %} 164 {% endfor %}
165 } else { 165 } else {
166 {{cpp_value}} = "{{reflect_invalid}}"; 166 {{cpp_value}} = "{{reflect_invalid}}";
167 } 167 }
168 {% endmacro %} 168 {% endmacro %}
169 169
170 170
171 {##############################################################################} 171 {##############################################################################}
172 {% macro attribute_getter_callback(attribute, world_suffix) %} 172 {% macro attribute_getter_callback(attribute, world_suffix) %}
173 static void {{attribute.name}}AttributeGetterCallback{{world_suffix}}( 173 void {{attribute.name}}AttributeGetterCallback{{world_suffix}}(
174 {%- if attribute.is_data_type_property %} 174 {%- if attribute.is_data_type_property %}
175 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info 175 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info
176 {%- else %} 176 {%- else %}
177 const v8::FunctionCallbackInfo<v8::Value>& info 177 const v8::FunctionCallbackInfo<v8::Value>& info
178 {%- endif %}) 178 {%- endif %})
179 { 179 {
180 {% if attribute.deprecate_as %} 180 {% if attribute.deprecate_as %}
181 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); 181 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}});
182 {% endif %} 182 {% endif %}
183 {% if attribute.measure_as %} 183 {% if attribute.measure_as %}
(...skipping 17 matching lines...) Expand all
201 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info); 201 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info);
202 {% else %} 202 {% else %}
203 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeGetter{{world _suffix}}(info); 203 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeGetter{{world _suffix}}(info);
204 {% endif %} 204 {% endif %}
205 } 205 }
206 {% endmacro %} 206 {% endmacro %}
207 207
208 208
209 {##############################################################################} 209 {##############################################################################}
210 {% macro constructor_getter_callback(attribute, world_suffix) %} 210 {% macro constructor_getter_callback(attribute, world_suffix) %}
211 static void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Loca l<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) 211 void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Local<v8::N ame> property, const v8::PropertyCallbackInfo<v8::Value>& info)
212 { 212 {
213 {% if attribute.deprecate_as %} 213 {% if attribute.deprecate_as %}
214 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); 214 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}});
215 {% endif %} 215 {% endif %}
216 {% if attribute.measure_as %} 216 {% if attribute.measure_as %}
217 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}} ); 217 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}} );
218 {% endif %} 218 {% endif %}
219 v8ConstructorAttributeGetter(property, info); 219 v8ConstructorAttributeGetter(property, info);
220 } 220 }
221 {% endmacro %} 221 {% endmacro %}
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 {# Post-set #} 345 {# Post-set #}
346 {% if attribute.cached_attribute_validation_method %} 346 {% if attribute.cached_attribute_validation_method %}
347 V8HiddenValue::deleteHiddenValue(ScriptState::current(info.GetIsolate()), ho lder, v8AtomicString(info.GetIsolate(), "{{attribute.name}}")); // Invalidate th e cached value. 347 V8HiddenValue::deleteHiddenValue(ScriptState::current(info.GetIsolate()), ho lder, v8AtomicString(info.GetIsolate(), "{{attribute.name}}")); // Invalidate th e cached value.
348 {% endif %} 348 {% endif %}
349 } 349 }
350 {% endmacro %} 350 {% endmacro %}
351 351
352 352
353 {##############################################################################} 353 {##############################################################################}
354 {% macro attribute_setter_callback(attribute, world_suffix) %} 354 {% macro attribute_setter_callback(attribute, world_suffix) %}
355 static void {{attribute.name}}AttributeSetterCallback{{world_suffix}}( 355 void {{attribute.name}}AttributeSetterCallback{{world_suffix}}(
356 {%- if attribute.is_data_type_property %} 356 {%- if attribute.is_data_type_property %}
357 v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInf o<void>& info 357 v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInf o<void>& info
358 {%- else %} 358 {%- else %}
359 const v8::FunctionCallbackInfo<v8::Value>& info 359 const v8::FunctionCallbackInfo<v8::Value>& info
360 {%- endif %}) 360 {%- endif %})
361 { 361 {
362 {% if not attribute.is_data_type_property %} 362 {% if not attribute.is_data_type_property %}
363 v8::Local<v8::Value> v8Value = info[0]; 363 v8::Local<v8::Value> v8Value = info[0];
364 {% endif %} 364 {% endif %}
365 {% if attribute.deprecate_as %} 365 {% if attribute.deprecate_as %}
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 setter_callback_for_main_world, 497 setter_callback_for_main_world,
498 wrapper_type_info, 498 wrapper_type_info,
499 access_control, 499 access_control,
500 property_attribute, 500 property_attribute,
501 only_exposed_to_private_script, 501 only_exposed_to_private_script,
502 property_location(attribute), 502 property_location(attribute),
503 holder_check, 503 holder_check,
504 ] %} 504 ] %}
505 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} 505 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
506 {%- endmacro %} 506 {%- endmacro %}
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/templates/constants.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698