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

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

Issue 2429343004: [CachedAccessor] for window.document. (Closed)
Patch Set: Fix expectation for global-interface-listing-expected, windows. Created 4 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
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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 {% if attribute.has_custom_getter %} 225 {% if attribute.has_custom_getter %}
226 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info); 226 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info);
227 {% else %} 227 {% else %}
228 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeGetter{{world_s uffix}}(info); 228 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeGetter{{world_s uffix}}(info);
229 {% endif %} 229 {% endif %}
230 } 230 }
231 {% endmacro %} 231 {% endmacro %}
232 232
233 233
234 {##############################################################################} 234 {##############################################################################}
235 {% macro attribute_cache_property_callback(attribute) %}
236 static v8::Local<v8::Private> {{attribute.name}}CachedAccessorCallback(v8::Isola te* isolate)
237 {
238 return V8PrivateProperty::get{{attribute.cached_accessor_name}}(isolate).get Private();
239 }
240 {% endmacro %}
241
242
243 {##############################################################################}
235 {% macro constructor_getter_callback(attribute, world_suffix) %} 244 {% macro constructor_getter_callback(attribute, world_suffix) %}
236 void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Local<v8::N ame> property, const v8::PropertyCallbackInfo<v8::Value>& info) { 245 void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Local<v8::N ame> property, const v8::PropertyCallbackInfo<v8::Value>& info) {
237 {% if attribute.deprecate_as %} 246 {% if attribute.deprecate_as %}
238 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentExec utionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); 247 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentExec utionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}});
239 {% endif %} 248 {% endif %}
240 249
241 {% if attribute.measure_as %} 250 {% if attribute.measure_as %}
242 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext (info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}}); 251 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext (info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}});
243 {% endif %} 252 {% endif %}
244 253
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 ' | '.join(attribute.access_control_list) %} 499 ' | '.join(attribute.access_control_list) %}
491 {% else %} 500 {% else %}
492 {% set access_control = 'v8::DEFAULT' %} 501 {% set access_control = 'v8::DEFAULT' %}
493 {% endif %} 502 {% endif %}
494 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % 503 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' %
495 ' | '.join(attribute.property_attributes) %} 504 ' | '.join(attribute.property_attributes) %}
496 {% set only_exposed_to_private_script = 505 {% set only_exposed_to_private_script =
497 'V8DOMConfiguration::OnlyExposedToPrivateScript' 506 'V8DOMConfiguration::OnlyExposedToPrivateScript'
498 if attribute.only_exposed_to_private_script else 507 if attribute.only_exposed_to_private_script else
499 'V8DOMConfiguration::ExposedToAllScripts' %} 508 'V8DOMConfiguration::ExposedToAllScripts' %}
509 {% set cached_accessor_callback =
510 '%sV8Internal::%sCachedAccessorCallback' % (cpp_class_or_partial, attribu te.name)
511 if attribute.is_cached_accessor else
512 'nullptr' %}
500 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' 513 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder'
501 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} 514 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %}
502 {% set attribute_configuration_list = [ 515 {% set attribute_configuration_list = [
503 '"%s"' % attribute.name, 516 '"%s"' % attribute.name,
504 getter_callback, 517 getter_callback,
505 setter_callback, 518 setter_callback,
506 getter_callback_for_main_world, 519 getter_callback_for_main_world,
507 setter_callback_for_main_world, 520 setter_callback_for_main_world,
521 cached_accessor_callback,
508 wrapper_type_info, 522 wrapper_type_info,
509 access_control, 523 access_control,
510 property_attribute, 524 property_attribute,
511 only_exposed_to_private_script, 525 only_exposed_to_private_script,
512 property_location(attribute), 526 property_location(attribute),
513 holder_check, 527 holder_check,
514 ] %} 528 ] %}
515 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} 529 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
516 {%- endmacro %} 530 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698