| 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 generate_method(method, world_suffix) %} | 4 {% macro generate_method(method, world_suffix) %} |
| 5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) { | 5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) { |
| 6 {% filter format_remove_duplicates([ | 6 {% filter format_remove_duplicates([ |
| 7 'ExceptionState exceptionState', | 7 'ExceptionState exceptionState', |
| 8 'ScriptState* scriptState = ']) %} | 8 'ScriptState* scriptState = ']) %} |
| 9 {% set define_exception_state -%} | 9 {% set define_exception_state -%} |
| 10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kExecutionCon
text, "{{interface_name}}", "{{method.name}}"); | 10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kExecutionCon
text, "{{interface_name}}", "{{method.name}}"); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 333 } |
| 334 {% endmacro %} | 334 {% endmacro %} |
| 335 | 335 |
| 336 | 336 |
| 337 {##############################################################################} | 337 {##############################################################################} |
| 338 {% macro overload_resolution_method(overloads, world_suffix) %} | 338 {% macro overload_resolution_method(overloads, world_suffix) %} |
| 339 static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
nfo<v8::Value>& info) { | 339 static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
nfo<v8::Value>& info) { |
| 340 {% set fall_through_to_partial_overloads = not is_partial and overloads.has_pa
rtial_overloads %} | 340 {% set fall_through_to_partial_overloads = not is_partial and overloads.has_pa
rtial_overloads %} |
| 341 | 341 |
| 342 {% if overloads.measure_all_as %} | 342 {% if overloads.measure_all_as %} |
| 343 UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), UseCounter::k{{o
verloads.measure_all_as}}); | 343 UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), WebFeature::k{{o
verloads.measure_all_as}}); |
| 344 {% endif %} | 344 {% endif %} |
| 345 {% if overloads.deprecate_all_as %} | 345 {% if overloads.deprecate_all_as %} |
| 346 Deprecation::CountDeprecation(CurrentExecutionContext(info.GetIsolate()), UseC
ounter::k{{overloads.deprecate_all_as}}); | 346 Deprecation::CountDeprecation(CurrentExecutionContext(info.GetIsolate()), WebF
eature::k{{overloads.deprecate_all_as}}); |
| 347 {% endif %} | 347 {% endif %} |
| 348 | 348 |
| 349 {# First resolve by length #} | 349 {# First resolve by length #} |
| 350 {% if not fall_through_to_partial_overloads %} | 350 {% if not fall_through_to_partial_overloads %} |
| 351 bool isArityError = false; | 351 bool isArityError = false; |
| 352 {% endif %} | 352 {% endif %} |
| 353 {# 2. Initialize argcount to be min(maxarg, n). #} | 353 {# 2. Initialize argcount to be min(maxarg, n). #} |
| 354 switch (std::min({{overloads.maxarg}}, info.Length())) { | 354 switch (std::min({{overloads.maxarg}}, info.Length())) { |
| 355 {# 3. Remove from S all entries whose type list is not of length argcount. #
} | 355 {# 3. Remove from S all entries whose type list is not of length argcount. #
} |
| 356 {% for length, tests_methods in overloads.length_tests_methods %} | 356 {% for length, tests_methods in overloads.length_tests_methods %} |
| 357 {# 10. If i = d, then: #} | 357 {# 10. If i = d, then: #} |
| 358 case {{length}}: | 358 case {{length}}: |
| 359 {# Then resolve by testing argument #} | 359 {# Then resolve by testing argument #} |
| 360 {% for test, method in tests_methods %} | 360 {% for test, method in tests_methods %} |
| 361 {% if method.visible %} | 361 {% if method.visible %} |
| 362 {% filter runtime_enabled(not overloads.runtime_enabled_all and method.run
time_enabled_feature_name) %} | 362 {% filter runtime_enabled(not overloads.runtime_enabled_all and method.run
time_enabled_feature_name) %} |
| 363 if ({{test}}) { | 363 if ({{test}}) { |
| 364 {% if method.measure_as and not overloads.measure_all_as %} | 364 {% if method.measure_as and not overloads.measure_all_as %} |
| 365 UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), UseCounter
::k{{method.measure_as('Method')}}); | 365 UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), WebFeature
::k{{method.measure_as('Method')}}); |
| 366 {% endif %} | 366 {% endif %} |
| 367 {% if method.deprecate_as and not overloads.deprecate_all_as %} | 367 {% if method.deprecate_as and not overloads.deprecate_all_as %} |
| 368 Deprecation::CountDeprecation(CurrentExecutionContext(info.GetIsolate())
, UseCounter::k{{method.deprecate_as}}); | 368 Deprecation::CountDeprecation(CurrentExecutionContext(info.GetIsolate())
, WebFeature::k{{method.deprecate_as}}); |
| 369 {% endif %} | 369 {% endif %} |
| 370 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info); | 370 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info); |
| 371 return; | 371 return; |
| 372 } | 372 } |
| 373 {% endfilter %} | 373 {% endfilter %} |
| 374 {% endif %} | 374 {% endif %} |
| 375 {% endfor %} | 375 {% endfor %} |
| 376 break; | 376 break; |
| 377 {% endfor %}{# length, tests_methods #} | 377 {% endfor %}{# length, tests_methods #} |
| 378 {% if not fall_through_to_partial_overloads %} | 378 {% if not fall_through_to_partial_overloads %} |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 instance->postMessage(scriptState, message.Get(), transferables.message_ports,
exceptionState); | 474 instance->postMessage(scriptState, message.Get(), transferables.message_ports,
exceptionState); |
| 475 } | 475 } |
| 476 {% endmacro %} | 476 {% endmacro %} |
| 477 | 477 |
| 478 | 478 |
| 479 {##############################################################################} | 479 {##############################################################################} |
| 480 {% macro method_callback(method, world_suffix) %} | 480 {% macro method_callback(method, world_suffix) %} |
| 481 void {{v8_class_or_partial}}::{{method.name}}MethodCallback{{world_suffix}}(cons
t v8::FunctionCallbackInfo<v8::Value>& info) { | 481 void {{v8_class_or_partial}}::{{method.name}}MethodCallback{{world_suffix}}(cons
t v8::FunctionCallbackInfo<v8::Value>& info) { |
| 482 {% if not method.overloads %}{# Overloaded methods are measured in overload_re
solution_method() #} | 482 {% if not method.overloads %}{# Overloaded methods are measured in overload_re
solution_method() #} |
| 483 {% if method.measure_as %} | 483 {% if method.measure_as %} |
| 484 UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), UseCounter::k{{m
ethod.measure_as('Method')}}); | 484 UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), WebFeature::k{{m
ethod.measure_as('Method')}}); |
| 485 {% endif %} | 485 {% endif %} |
| 486 {% if method.deprecate_as %} | 486 {% if method.deprecate_as %} |
| 487 Deprecation::CountDeprecation(CurrentExecutionContext(info.GetIsolate()), UseC
ounter::k{{method.deprecate_as}}); | 487 Deprecation::CountDeprecation(CurrentExecutionContext(info.GetIsolate()), WebF
eature::k{{method.deprecate_as}}); |
| 488 {% endif %} | 488 {% endif %} |
| 489 {% endif %}{# not method.overloads #} | 489 {% endif %}{# not method.overloads #} |
| 490 {% if world_suffix in method.activity_logging_world_list %} | 490 {% if world_suffix in method.activity_logging_world_list %} |
| 491 {% if method.is_static %} | 491 {% if method.is_static %} |
| 492 ScriptState* scriptState = ScriptState::ForFunctionObject(info); | 492 ScriptState* scriptState = ScriptState::ForFunctionObject(info); |
| 493 {% else %} | 493 {% else %} |
| 494 ScriptState* scriptState = ScriptState::ForReceiverObject(info); | 494 ScriptState* scriptState = ScriptState::ForReceiverObject(info); |
| 495 {% endif %} | 495 {% endif %} |
| 496 V8PerContextData* contextData = scriptState->PerContextData(); | 496 V8PerContextData* contextData = scriptState->PerContextData(); |
| 497 if (contextData && contextData->ActivityLogger()) { | 497 if (contextData && contextData->ActivityLogger()) { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
[] = { | 649 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
[] = { |
| 650 {{method_configuration(method) | indent(2)}} | 650 {{method_configuration(method) | indent(2)}} |
| 651 }; | 651 }; |
| 652 for (const auto& methodConfig : {{method.name}}MethodConfiguration) | 652 for (const auto& methodConfig : {{method.name}}MethodConfiguration) |
| 653 V8DOMConfiguration::InstallMethod(isolate, world, v8::Local<v8::Object>(), pro
totypeObject, interfaceObject, signature, methodConfig); | 653 V8DOMConfiguration::InstallMethod(isolate, world, v8::Local<v8::Object>(), pro
totypeObject, interfaceObject, signature, methodConfig); |
| 654 {% endfilter %}{# runtime_enabled() #} | 654 {% endfilter %}{# runtime_enabled() #} |
| 655 {% endfilter %}{# exposed() #} | 655 {% endfilter %}{# exposed() #} |
| 656 {% endfilter %}{# secure_context() #} | 656 {% endfilter %}{# secure_context() #} |
| 657 {% endfor %} | 657 {% endfor %} |
| 658 {%- endmacro %} | 658 {%- endmacro %} |
| OLD | NEW |