| OLD | NEW |
| 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l
ocal_cpp_value %} | 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l
ocal_cpp_value %} |
| 2 | 2 |
| 3 | 3 |
| 4 {##############################################################################} | 4 {##############################################################################} |
| 5 {% macro generate_method(method, world_suffix) %} | 5 {% macro generate_method(method, world_suffix) %} |
| 6 {% filter conditional(method.conditional_string) %} | 6 {% filter conditional(method.conditional_string) %} |
| 7 {% if method.returns_promise and method.has_exception_state %} | 7 {% if method.returns_promise and method.has_exception_state %} |
| 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) | 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) |
| 9 {% else %} | 9 {% else %} |
| 10 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) | 10 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 createMinimumArityTypeErrorForMethod(info.GetIsolate(), "{{method.name}}", "{{in
terface_name}}", {{number_of_required_arguments}}, info.Length()) | 359 createMinimumArityTypeErrorForMethod(info.GetIsolate(), "{{method.name}}", "{{in
terface_name}}", {{number_of_required_arguments}}, info.Length()) |
| 360 {%- endif %} | 360 {%- endif %} |
| 361 {%- endmacro %} | 361 {%- endmacro %} |
| 362 | 362 |
| 363 | 363 |
| 364 {##############################################################################} | 364 {##############################################################################} |
| 365 {% macro runtime_determined_length_method(overloads) %} | 365 {% macro runtime_determined_length_method(overloads) %} |
| 366 static int {{overloads.name}}MethodLength() | 366 static int {{overloads.name}}MethodLength() |
| 367 { | 367 { |
| 368 {% for length, runtime_enabled_functions in overloads.runtime_determined_len
gths %} | 368 {% for length, runtime_enabled_functions in overloads.runtime_determined_len
gths %} |
| 369 {% for runtime_enabled_function in runtime_enabled_functions %} | 369 {% for runtime_enabled_function in runtime_enabled_functions %} |
| 370 {% filter runtime_enabled(runtime_enabled_function) %} | 370 {% filter runtime_enabled(runtime_enabled_function) %} |
| 371 return {{length}}; | 371 return {{length}}; |
| 372 {% endfilter %} | 372 {% endfilter %} |
| 373 {% endfor %} | 373 {% endfor %} |
| 374 {% endfor %} | 374 {% endfor %} |
| 375 } | 375 } |
| 376 {% endmacro %} | 376 {% endmacro %} |
| 377 | 377 |
| 378 | 378 |
| 379 {##############################################################################} | 379 {##############################################################################} |
| (...skipping 11 matching lines...) Expand all Loading... |
| 391 {% endmacro %} | 391 {% endmacro %} |
| 392 | 392 |
| 393 | 393 |
| 394 {##############################################################################} | 394 {##############################################################################} |
| 395 {# FIXME: We should return a rejected Promise if an error occurs in this | 395 {# FIXME: We should return a rejected Promise if an error occurs in this |
| 396 function when ALL methods in this overload return Promise. In order to do so, | 396 function when ALL methods in this overload return Promise. In order to do so, |
| 397 we must ensure either ALL or NO methods in this overload return Promise #} | 397 we must ensure either ALL or NO methods in this overload return Promise #} |
| 398 {% macro overload_resolution_method(overloads, world_suffix) %} | 398 {% macro overload_resolution_method(overloads, world_suffix) %} |
| 399 static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
nfo<v8::Value>& info) | 399 static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
nfo<v8::Value>& info) |
| 400 { | 400 { |
| 401 String errorMessage; |
| 402 ALLOW_UNUSED_LOCAL(errorMessage); |
| 401 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{overloads
.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 403 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{overloads
.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 402 {% if overloads.measure_all_as %} | 404 {% if overloads.measure_all_as %} |
| 403 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{overloads.measure_all_as}}); | 405 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{overloads.measure_all_as}}); |
| 404 {% endif %} | 406 {% endif %} |
| 405 {% if overloads.deprecate_all_as %} | 407 {% if overloads.deprecate_all_as %} |
| 406 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{overloads.deprecate_all_as}}); | 408 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{overloads.deprecate_all_as}}); |
| 407 {% endif %} | 409 {% endif %} |
| 408 {# First resolve by length #} | 410 {# First resolve by length #} |
| 409 {# 2. Initialize argcount to be min(maxarg, n). #} | 411 {# 2. Initialize argcount to be min(maxarg, n). #} |
| 410 switch (std::min({{overloads.maxarg}}, info.Length())) { | 412 switch (std::min({{overloads.maxarg}}, info.Length())) { |
| 411 {# 3. Remove from S all entries whose type list is not of length argcount. #
} | 413 {# 3. Remove from S all entries whose type list is not of length argcount. #
} |
| 412 {% for length, tests_methods in overloads.length_tests_methods %} | 414 {% for length, tests_methods in overloads.length_tests_methods %} |
| 413 {# 10. If i = d, then: #} | 415 {# 10. If i = d, then: #} |
| 414 case {{length}}: | 416 case {{length}}: |
| 415 {# Then resolve by testing argument #} | 417 {# Then resolve by testing argument #} |
| 416 {% for test, method in tests_methods %} | 418 {% for test, method in tests_methods %} |
| 417 {% if method.visible %} | 419 {% if method.visible %} |
| 418 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and | 420 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and |
| 419 method.runtime_enabled_function) %} | 421 method.runtime_enabled_function) %} |
| 422 {% filter experiment_enabled(not overloads.experimental_api_name_all and |
| 423 method.experimental_api_name, "errorMessage
") %} |
| 420 if ({{test}}) { | 424 if ({{test}}) { |
| 421 {% if method.measure_as and not overloads.measure_all_as %} | 425 {% if method.measure_as and not overloads.measure_all_as %} |
| 422 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecut
ionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); | 426 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecut
ionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); |
| 423 {% endif %} | 427 {% endif %} |
| 424 {% if method.deprecate_as and not overloads.deprecate_all_as %} | 428 {% if method.deprecate_as and not overloads.deprecate_all_as %} |
| 425 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca
llingExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); | 429 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca
llingExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); |
| 426 {% endif %} | 430 {% endif %} |
| 427 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info)
; | 431 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info)
; |
| 428 return; | 432 return; |
| 429 } | 433 } |
| 430 {% endfilter %} | 434 {% endfilter %} |
| 435 {% endfilter %} |
| 431 {% endif %} | 436 {% endif %} |
| 432 {% endfor %} | 437 {% endfor %} |
| 433 break; | 438 break; |
| 434 {% endfor %} | 439 {% endfor %} |
| 435 {% if is_partial or not overloads.has_partial_overloads %} | 440 {% if is_partial or not overloads.has_partial_overloads %} |
| 436 default: | 441 default: |
| 437 {# If methods are overloaded between interface and partial interface #} | 442 {# If methods are overloaded between interface and partial interface #} |
| 438 {# definitions, need to invoke methods defined in the partial #} | 443 {# definitions, need to invoke methods defined in the partial #} |
| 439 {# interface. #} | 444 {# interface. #} |
| 440 {# FIXME: we do not need to always generate this code. #} | 445 {# FIXME: we do not need to always generate this code. #} |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 V8DOMConfiguration::installMethod(isolate, {{instance_template}}, {{prototype_te
mplate}}, {{interface_template}}, {{signature}}, {{method.name}}MethodConfigurat
ion); | 698 V8DOMConfiguration::installMethod(isolate, {{instance_template}}, {{prototype_te
mplate}}, {{interface_template}}, {{signature}}, {{method.name}}MethodConfigurat
ion); |
| 694 {%- endmacro %} | 699 {%- endmacro %} |
| 695 | 700 |
| 696 {######################################} | 701 {######################################} |
| 697 {% macro install_conditionally_enabled_methods() %} | 702 {% macro install_conditionally_enabled_methods() %} |
| 698 {% if conditionally_enabled_methods %} | 703 {% if conditionally_enabled_methods %} |
| 699 {# Define operations with limited exposure #} | 704 {# Define operations with limited exposure #} |
| 700 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTempl
ate(isolate)); | 705 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTempl
ate(isolate)); |
| 701 ExecutionContext* executionContext = toExecutionContext(prototypeObject->Creatio
nContext()); | 706 ExecutionContext* executionContext = toExecutionContext(prototypeObject->Creatio
nContext()); |
| 702 ASSERT(executionContext); | 707 ASSERT(executionContext); |
| 708 String errorMessage; |
| 709 ALLOW_UNUSED_LOCAL(errorMessage); |
| 703 {% for method in conditionally_enabled_methods %} | 710 {% for method in conditionally_enabled_methods %} |
| 704 {% filter exposed(method.overloads.exposed_test_all | 711 {% filter exposed(method.overloads.exposed_test_all |
| 705 if method.overloads else | 712 if method.overloads else |
| 706 method.exposed_test) %} | 713 method.exposed_test) %} |
| 707 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all | 714 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all |
| 708 if method.overloads else | 715 if method.overloads else |
| 709 method.runtime_enabled_function) %} | 716 method.runtime_enabled_function) %} |
| 717 {% filter experiment_enabled(method.overloads.experimental_api_name_all |
| 718 if method.overloads else |
| 719 method.experimental_api_name, "errorMessage") %} |
| 710 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; | 720 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; |
| 711 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj
ect, interfaceObject, defaultSignature, {{method.name}}MethodConfiguration); | 721 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj
ect, interfaceObject, defaultSignature, {{method.name}}MethodConfiguration); |
| 722 {% endfilter %}{# experiment_enabled() #} |
| 712 {% endfilter %}{# runtime_enabled() #} | 723 {% endfilter %}{# runtime_enabled() #} |
| 713 {% endfilter %}{# exposed() #} | 724 {% endfilter %}{# exposed() #} |
| 714 {% endfor %} | 725 {% endfor %} |
| 715 {% endif %} | 726 {% endif %} |
| 716 {%- endmacro %} | 727 {%- endmacro %} |
| OLD | NEW |