OLD | NEW |
1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value, check_api_experiment %} | 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value, check_api_experiment %} |
2 | 2 |
3 {##############################################################################} | 3 {##############################################################################} |
4 {% macro generate_method(method, world_suffix) %} | 4 {% macro generate_method(method, world_suffix) %} |
5 {% filter conditional(method.conditional_string) %} | 5 {% filter conditional(method.conditional_string) %} |
6 {% if method.returns_promise and method.has_exception_state %} | 6 {% if method.returns_promise and method.has_exception_state %} |
7 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) | 7 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) |
8 {% else %} | 8 {% else %} |
9 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) | 9 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) |
10 {% endif %} | 10 {% endif %} |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 392 |
393 {##############################################################################} | 393 {##############################################################################} |
394 {# FIXME: We should return a rejected Promise if an error occurs in this | 394 {# FIXME: We should return a rejected Promise if an error occurs in this |
395 function when ALL methods in this overload return Promise. In order to do so, | 395 function when ALL methods in this overload return Promise. In order to do so, |
396 we must ensure either ALL or NO methods in this overload return Promise #} | 396 we must ensure either ALL or NO methods in this overload return Promise #} |
397 {% macro overload_resolution_method(overloads, world_suffix) %} | 397 {% macro overload_resolution_method(overloads, world_suffix) %} |
398 static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
nfo<v8::Value>& info) | 398 static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
nfo<v8::Value>& info) |
399 { | 399 { |
400 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{overloads
.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 400 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{overloads
.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
401 {% if overloads.measure_all_as %} | 401 {% if overloads.measure_all_as %} |
402 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{overloads.measure_all_as}}); | 402 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte
xt(info.GetIsolate()), UseCounter::{{overloads.measure_all_as}}); |
403 {% endif %} | 403 {% endif %} |
404 {% if overloads.deprecate_all_as %} | 404 {% if overloads.deprecate_all_as %} |
405 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{overloads.deprecate_all_as}}); | 405 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentExe
cutionContext(info.GetIsolate()), UseCounter::{{overloads.deprecate_all_as}}); |
406 {% endif %} | 406 {% endif %} |
407 {# First resolve by length #} | 407 {# First resolve by length #} |
408 {# 2. Initialize argcount to be min(maxarg, n). #} | 408 {# 2. Initialize argcount to be min(maxarg, n). #} |
409 switch (std::min({{overloads.maxarg}}, info.Length())) { | 409 switch (std::min({{overloads.maxarg}}, info.Length())) { |
410 {# 3. Remove from S all entries whose type list is not of length argcount. #
} | 410 {# 3. Remove from S all entries whose type list is not of length argcount. #
} |
411 {% for length, tests_methods in overloads.length_tests_methods %} | 411 {% for length, tests_methods in overloads.length_tests_methods %} |
412 {# 10. If i = d, then: #} | 412 {# 10. If i = d, then: #} |
413 case {{length}}: | 413 case {{length}}: |
414 {# Then resolve by testing argument #} | 414 {# Then resolve by testing argument #} |
415 {% for test, method in tests_methods %} | 415 {% for test, method in tests_methods %} |
416 {% if method.visible %} | 416 {% if method.visible %} |
417 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and | 417 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and |
418 method.runtime_enabled_function) %} | 418 method.runtime_enabled_function) %} |
419 if ({{test}}) { | 419 if ({{test}}) { |
420 {% if method.measure_as and not overloads.measure_all_as %} | 420 {% if method.measure_as and not overloads.measure_all_as %} |
421 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecut
ionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); | 421 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecut
ionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); |
422 {% endif %} | 422 {% endif %} |
423 {% if method.deprecate_as and not overloads.deprecate_all_as %} | 423 {% if method.deprecate_as and not overloads.deprecate_all_as %} |
424 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca
llingExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); | 424 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), cu
rrentExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); |
425 {% endif %} | 425 {% endif %} |
426 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info)
; | 426 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info)
; |
427 return; | 427 return; |
428 } | 428 } |
429 {% endfilter %} | 429 {% endfilter %} |
430 {% endif %} | 430 {% endif %} |
431 {% endfor %} | 431 {% endfor %} |
432 break; | 432 break; |
433 {% endfor %} | 433 {% endfor %} |
434 {% if is_partial or not overloads.has_partial_overloads %} | 434 {% if is_partial or not overloads.has_partial_overloads %} |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 {% endmacro %} | 498 {% endmacro %} |
499 | 499 |
500 {##############################################################################} | 500 {##############################################################################} |
501 {% macro method_callback(method, world_suffix) %} | 501 {% macro method_callback(method, world_suffix) %} |
502 {% filter conditional(method.conditional_string) %} | 502 {% filter conditional(method.conditional_string) %} |
503 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall
backInfo<v8::Value>& info) | 503 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall
backInfo<v8::Value>& info) |
504 { | 504 { |
505 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 505 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
506 {% if not method.overloads %}{# Overloaded methods are measured in overload_
resolution_method() #} | 506 {% if not method.overloads %}{# Overloaded methods are measured in overload_
resolution_method() #} |
507 {% if method.measure_as %} | 507 {% if method.measure_as %} |
508 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); | 508 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte
xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); |
509 {% endif %} | 509 {% endif %} |
510 {% if method.deprecate_as %} | 510 {% if method.deprecate_as %} |
511 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); | 511 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentExe
cutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); |
512 {% endif %} | 512 {% endif %} |
513 {% if method.is_api_experiment_enabled %} | 513 {% if method.is_api_experiment_enabled %} |
514 {{check_api_experiment(method) | indent}} | 514 {{check_api_experiment(method) | indent}} |
515 {% endif %} | 515 {% endif %} |
516 {% endif %}{# not method.overloads #} | 516 {% endif %}{# not method.overloads #} |
517 {% if world_suffix in method.activity_logging_world_list %} | 517 {% if world_suffix in method.activity_logging_world_list %} |
518 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo
ntext()); | 518 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo
ntext()); |
519 V8PerContextData* contextData = scriptState->perContextData(); | 519 V8PerContextData* contextData = scriptState->perContextData(); |
520 {% if method.activity_logging_world_check %} | 520 {% if method.activity_logging_world_check %} |
521 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac
tivityLogger()) | 521 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac
tivityLogger()) |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all | 709 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all |
710 if method.overloads else | 710 if method.overloads else |
711 method.runtime_enabled_function) %} | 711 method.runtime_enabled_function) %} |
712 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; | 712 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; |
713 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj
ect, interfaceObject, defaultSignature, {{method.name}}MethodConfiguration); | 713 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj
ect, interfaceObject, defaultSignature, {{method.name}}MethodConfiguration); |
714 {% endfilter %}{# runtime_enabled() #} | 714 {% endfilter %}{# runtime_enabled() #} |
715 {% endfilter %}{# exposed() #} | 715 {% endfilter %}{# exposed() #} |
716 {% endfor %} | 716 {% endfor %} |
717 {% endif %} | 717 {% endif %} |
718 {%- endmacro %} | 718 {%- endmacro %} |
OLD | NEW |