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

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

Issue 2429343004: [CachedAccessor] for window.document. (Closed)
Patch Set: Review feedback (and rebase) Created 4 years, 2 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.tmpl' import declare_enum_validation_variable, v8_value_t o_local_cpp_value %} 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t o_local_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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 {% if attribute.has_custom_getter %} 229 {% if attribute.has_custom_getter %}
230 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info); 230 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info);
231 {% else %} 231 {% else %}
232 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeGetter{{world _suffix}}(info); 232 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeGetter{{world _suffix}}(info);
233 {% endif %} 233 {% endif %}
234 } 234 }
235 {% endmacro %} 235 {% endmacro %}
236 236
237 237
238 {##############################################################################} 238 {##############################################################################}
239 {% macro attribute_cache_property_callback(attribute) %}
240 static v8::Local<v8::Private> {{attribute.name}}CachedAccessorCallback(v8::Isola te* isolate)
haraken 2016/10/24 12:55:43 I'm just curious, but when is the CachedAccessorCa
241 {
242 return V8PrivateProperty::get{{attribute.cached_accessor_name}}(isolate).get Private();
243 }
244 {% endmacro %}
245
246
247 {##############################################################################}
239 {% macro constructor_getter_callback(attribute, world_suffix) %} 248 {% macro constructor_getter_callback(attribute, world_suffix) %}
240 void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Local<v8::N ame> property, const v8::PropertyCallbackInfo<v8::Value>& info) 249 void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Local<v8::N ame> property, const v8::PropertyCallbackInfo<v8::Value>& info)
241 { 250 {
242 {% if attribute.deprecate_as %} 251 {% if attribute.deprecate_as %}
243 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); 252 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}});
244 {% endif %} 253 {% endif %}
245 254
246 {% if attribute.measure_as %} 255 {% if attribute.measure_as %}
247 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}} ); 256 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}} );
248 {% endif %} 257 {% endif %}
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 ' | '.join(attribute.access_control_list) %} 513 ' | '.join(attribute.access_control_list) %}
505 {% else %} 514 {% else %}
506 {% set access_control = 'v8::DEFAULT' %} 515 {% set access_control = 'v8::DEFAULT' %}
507 {% endif %} 516 {% endif %}
508 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % 517 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' %
509 ' | '.join(attribute.property_attributes) %} 518 ' | '.join(attribute.property_attributes) %}
510 {% set only_exposed_to_private_script = 519 {% set only_exposed_to_private_script =
511 'V8DOMConfiguration::OnlyExposedToPrivateScript' 520 'V8DOMConfiguration::OnlyExposedToPrivateScript'
512 if attribute.only_exposed_to_private_script else 521 if attribute.only_exposed_to_private_script else
513 'V8DOMConfiguration::ExposedToAllScripts' %} 522 'V8DOMConfiguration::ExposedToAllScripts' %}
523 {% set cached_accessor_callback =
524 '%sV8Internal::%sCachedAccessorCallback' % (cpp_class_or_partial, attribu te.name)
525 if attribute.is_cached_accessor else
526 'nullptr' %}
514 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' 527 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder'
515 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} 528 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %}
516 {% set attribute_configuration_list = [ 529 {% set attribute_configuration_list = [
517 '"%s"' % attribute.name, 530 '"%s"' % attribute.name,
518 getter_callback, 531 getter_callback,
519 setter_callback, 532 setter_callback,
520 getter_callback_for_main_world, 533 getter_callback_for_main_world,
521 setter_callback_for_main_world, 534 setter_callback_for_main_world,
535 cached_accessor_callback,
522 wrapper_type_info, 536 wrapper_type_info,
523 access_control, 537 access_control,
524 property_attribute, 538 property_attribute,
525 only_exposed_to_private_script, 539 only_exposed_to_private_script,
526 property_location(attribute), 540 property_location(attribute),
527 holder_check, 541 holder_check,
528 ] %} 542 ] %}
529 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} 543 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
530 {%- endmacro %} 544 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698