| OLD | NEW |
| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 {{cpp_value}} = "{{value}}"; | 181 {{cpp_value}} = "{{value}}"; |
| 182 {% endfor %} | 182 {% endfor %} |
| 183 } else { | 183 } else { |
| 184 {{cpp_value}} = "{{reflect_invalid}}"; | 184 {{cpp_value}} = "{{reflect_invalid}}"; |
| 185 } | 185 } |
| 186 {% endmacro %} | 186 {% endmacro %} |
| 187 | 187 |
| 188 | 188 |
| 189 {##############################################################################} | 189 {##############################################################################} |
| 190 {% macro attribute_getter_callback(attribute, world_suffix) %} | 190 {% macro attribute_getter_callback(attribute, world_suffix) %} |
| 191 {{exported}}void {{attribute.name}}AttributeGetterCallback{{world_suffix}}( | 191 void {{v8_class_or_partial}}::{{attribute.name}}AttributeGetterCallback{{world_s
uffix}}( |
| 192 {%- if attribute.is_data_type_property %} | 192 {%- if attribute.is_data_type_property %} |
| 193 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info | 193 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info |
| 194 {%- else %} | 194 {%- else %} |
| 195 const v8::FunctionCallbackInfo<v8::Value>& info | 195 const v8::FunctionCallbackInfo<v8::Value>& info |
| 196 {%- endif %}) { | 196 {%- endif %}) { |
| 197 {% if attribute.deprecate_as %} | 197 {% if attribute.deprecate_as %} |
| 198 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{attribute.deprecate_as}}); | 198 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{attribute.deprecate_as}}); |
| 199 {% endif %} | 199 {% endif %} |
| 200 | 200 |
| 201 {% if attribute.measure_as %} | 201 {% if attribute.measure_as %} |
| (...skipping 20 matching lines...) Expand all Loading... |
| 222 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info); | 222 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info); |
| 223 {% else %} | 223 {% else %} |
| 224 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeGetter{{world_s
uffix}}(info); | 224 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeGetter{{world_s
uffix}}(info); |
| 225 {% endif %} | 225 {% endif %} |
| 226 } | 226 } |
| 227 {% endmacro %} | 227 {% endmacro %} |
| 228 | 228 |
| 229 | 229 |
| 230 {##############################################################################} | 230 {##############################################################################} |
| 231 {% macro attribute_cache_property_callback(attribute) %} | 231 {% macro attribute_cache_property_callback(attribute) %} |
| 232 {{exported}}v8::Local<v8::Private> {{attribute.name}}CachedAccessorCallback(v8::
Isolate* isolate) | 232 v8::Local<v8::Private> {{v8_class_or_partial}}::{{attribute.name}}CachedAccessor
Callback(v8::Isolate* isolate) |
| 233 { | 233 { |
| 234 return V8PrivateProperty::get{{attribute.cached_accessor_name}}(isolate).get
Private(); | 234 return V8PrivateProperty::get{{attribute.cached_accessor_name}}(isolate).get
Private(); |
| 235 } | 235 } |
| 236 {% endmacro %} | 236 {% endmacro %} |
| 237 | 237 |
| 238 | 238 |
| 239 {##############################################################################} | 239 {##############################################################################} |
| 240 {% macro constructor_getter_callback(attribute, world_suffix) %} | 240 {% macro constructor_getter_callback(attribute, world_suffix) %} |
| 241 {{exported}}void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8:
:Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { | 241 void {{v8_class_or_partial}}::{{attribute.name}}ConstructorGetterCallback{{world
_suffix}}(v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value
>& info) { |
| 242 {% if attribute.deprecate_as %} | 242 {% if attribute.deprecate_as %} |
| 243 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{attribute.deprecate_as}}); | 243 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{attribute.deprecate_as}}); |
| 244 {% endif %} | 244 {% endif %} |
| 245 | 245 |
| 246 {% if attribute.measure_as %} | 246 {% if attribute.measure_as %} |
| 247 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{at
tribute.measure_as('ConstructorGetter')}}); | 247 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{at
tribute.measure_as('ConstructorGetter')}}); |
| 248 {% endif %} | 248 {% endif %} |
| 249 | 249 |
| 250 v8ConstructorAttributeGetter(property, info); | 250 v8ConstructorAttributeGetter(property, info); |
| 251 } | 251 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 // Invalidate the cached value. | 359 // Invalidate the cached value. |
| 360 V8HiddenValue::deleteHiddenValue(ScriptState::forFunctionObject(info), holder,
v8AtomicString(info.GetIsolate(), "{{attribute.name}}")); | 360 V8HiddenValue::deleteHiddenValue(ScriptState::forFunctionObject(info), holder,
v8AtomicString(info.GetIsolate(), "{{attribute.name}}")); |
| 361 {% endif %} | 361 {% endif %} |
| 362 } | 362 } |
| 363 {% endfilter %}{# format_remove_duplicates #} | 363 {% endfilter %}{# format_remove_duplicates #} |
| 364 {% endmacro %} | 364 {% endmacro %} |
| 365 | 365 |
| 366 | 366 |
| 367 {##############################################################################} | 367 {##############################################################################} |
| 368 {% macro attribute_setter_callback(attribute, world_suffix) %} | 368 {% macro attribute_setter_callback(attribute, world_suffix) %} |
| 369 {{exported}}void {{attribute.name}}AttributeSetterCallback{{world_suffix}}( | 369 void {{v8_class_or_partial}}::{{attribute.name}}AttributeSetterCallback{{world_s
uffix}}( |
| 370 {%- if attribute.is_data_type_property %} | 370 {%- if attribute.is_data_type_property %} |
| 371 v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInf
o<void>& info | 371 v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInf
o<void>& info |
| 372 {%- else %} | 372 {%- else %} |
| 373 const v8::FunctionCallbackInfo<v8::Value>& info | 373 const v8::FunctionCallbackInfo<v8::Value>& info |
| 374 {%- endif %}) { | 374 {%- endif %}) { |
| 375 {% if not attribute.is_data_type_property %} | 375 {% if not attribute.is_data_type_property %} |
| 376 v8::Local<v8::Value> v8Value = info[0]; | 376 v8::Local<v8::Value> v8Value = info[0]; |
| 377 {% endif %} | 377 {% endif %} |
| 378 | 378 |
| 379 {% if attribute.deprecate_as %} | 379 {% if attribute.deprecate_as %} |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 {% endif %} | 417 {% endif %} |
| 418 } | 418 } |
| 419 {% endmacro %} | 419 {% endmacro %} |
| 420 | 420 |
| 421 | 421 |
| 422 {##############################################################################} | 422 {##############################################################################} |
| 423 {% macro attribute_configuration(attribute) %} | 423 {% macro attribute_configuration(attribute) %} |
| 424 {% from 'utilities.cpp.tmpl' import property_location %} | 424 {% from 'utilities.cpp.tmpl' import property_location %} |
| 425 {% if attribute.constructor_type %} | 425 {% if attribute.constructor_type %} |
| 426 {% set getter_callback = | 426 {% set getter_callback = |
| 427 '%sV8Internal::%sConstructorGetterCallback' % (cpp_class_or_partial, attr
ibute.name) | 427 '%s::%sConstructorGetterCallback' % (v8_class_or_partial, attribute.name) |
| 428 if attribute.needs_constructor_getter_callback else | 428 if attribute.needs_constructor_getter_callback else |
| 429 'v8ConstructorAttributeGetter' %} | 429 'v8ConstructorAttributeGetter' %} |
| 430 {% set setter_callback = '0' %} | 430 {% set setter_callback = 'nullptr' %} |
| 431 {% else %}{# regular attributes #} | 431 {% else %}{# regular attributes #} |
| 432 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % | 432 {% set getter_callback = '%s::%sAttributeGetterCallback' % |
| 433 (cpp_class_or_partial, attribute.name) %} | 433 (v8_class_or_partial, attribute.name) %} |
| 434 {% set setter_callback = '%sV8Internal::%sAttributeSetterCallback' % | 434 {% set setter_callback = '%s::%sAttributeSetterCallback' % |
| 435 (cpp_class_or_partial, attribute.name) | 435 (v8_class_or_partial, attribute.name) |
| 436 if attribute.has_setter else '0' %} | 436 if attribute.has_setter else 'nullptr' %} |
| 437 {% endif %} | 437 {% endif %} |
| 438 {% set getter_callback_for_main_world = | 438 {% set getter_callback_for_main_world = |
| 439 '%sForMainWorld' % getter_callback | 439 '%sForMainWorld' % getter_callback |
| 440 if attribute.is_per_world_bindings else '0' %} | 440 if attribute.is_per_world_bindings else 'nullptr' %} |
| 441 {% set setter_callback_for_main_world = | 441 {% set setter_callback_for_main_world = |
| 442 '%sForMainWorld' % setter_callback | 442 '%sForMainWorld' % setter_callback |
| 443 if attribute.is_per_world_bindings and attribute.has_setter else '0' %} | 443 if attribute.is_per_world_bindings and attribute.has_setter else 'nullptr
' %} |
| 444 {% set wrapper_type_info = | 444 {% set wrapper_type_info = |
| 445 'const_cast<WrapperTypeInfo*>(&V8%s::wrapperTypeInfo)' % | 445 'const_cast<WrapperTypeInfo*>(&V8%s::wrapperTypeInfo)' % attribute.constr
uctor_type |
| 446 attribute.constructor_type | 446 if attribute.constructor_type else 'nullptr' %} |
| 447 if attribute.constructor_type else '0' %} | |
| 448 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % | 447 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % |
| 449 ' | '.join(attribute.property_attributes) %} | 448 ' | '.join(attribute.property_attributes) %} |
| 450 {% set cached_accessor_callback = | 449 {% set cached_accessor_callback = |
| 451 '%sV8Internal::%sCachedAccessorCallback' % (cpp_class_or_partial, attribu
te.name) | 450 '%s::%sCachedAccessorCallback' % (v8_class_or_partial, attribute.name) |
| 452 if attribute.is_cached_accessor else | 451 if attribute.is_cached_accessor else |
| 453 'nullptr' %} | 452 'nullptr' %} |
| 454 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' | 453 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' |
| 455 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} | 454 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} |
| 456 {% set attribute_configuration_list = [ | 455 {% set attribute_configuration_list = [ |
| 457 '"%s"' % attribute.name, | 456 '"%s"' % attribute.name, |
| 458 getter_callback, | 457 getter_callback, |
| 459 setter_callback, | 458 setter_callback, |
| 460 getter_callback_for_main_world, | 459 getter_callback_for_main_world, |
| 461 setter_callback_for_main_world, | 460 setter_callback_for_main_world, |
| 462 cached_accessor_callback, | 461 cached_accessor_callback, |
| 463 wrapper_type_info, | 462 wrapper_type_info, |
| 464 property_attribute, | 463 property_attribute, |
| 465 property_location(attribute), | 464 property_location(attribute), |
| 466 holder_check, | 465 holder_check, |
| 467 ] %} | 466 ] %} |
| 468 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 467 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 469 {%- endmacro %} | 468 {%- endmacro %} |
| OLD | NEW |