OLD | NEW |
1 {##############################################################################} | 1 {##############################################################################} |
2 {% macro generate_method(method, world_suffix) %} | 2 {% macro generate_method(method, world_suffix) %} |
3 {% filter conditional(method.conditional_string) %} | 3 {% filter conditional(method.conditional_string) %} |
4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) | 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) |
5 { | 5 { |
6 {# Local variables #} | 6 {# Local variables #} |
7 {% if method.has_exception_state %} | 7 {% if method.has_exception_state %} |
8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
9 {% endif %} | 9 {% endif %} |
10 {# Overloaded methods have length checked during overload resolution #} | 10 {# Overloaded methods have length checked during overload resolution #} |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 357 |
358 {##############################################################################} | 358 {##############################################################################} |
359 {# FIXME: We should return a rejected Promise if an error occurs in this | 359 {# FIXME: We should return a rejected Promise if an error occurs in this |
360 function when ALL methods in this overload return Promise. In order to do so, | 360 function when ALL methods in this overload return Promise. In order to do so, |
361 we must ensure either ALL or NO methods in this overload return Promise #} | 361 we must ensure either ALL or NO methods in this overload return Promise #} |
362 {% macro overload_resolution_method(overloads, world_suffix) %} | 362 {% macro overload_resolution_method(overloads, world_suffix) %} |
363 static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
nfo<v8::Value>& info) | 363 static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
nfo<v8::Value>& info) |
364 { | 364 { |
365 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{overloads
.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 365 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{overloads
.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
366 {% if overloads.measure_all_as %} | 366 {% if overloads.measure_all_as %} |
367 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{
overloads.measure_all_as}}); | 367 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{overloads.measure_all_as}}); |
368 {% endif %} | 368 {% endif %} |
369 {% if overloads.deprecate_all_as %} | 369 {% if overloads.deprecate_all_as %} |
370 UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), Use
Counter::{{overloads.deprecate_all_as}}); | 370 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{overloads.deprecate_all_as}}); |
371 {% endif %} | 371 {% endif %} |
372 {# First resolve by length #} | 372 {# First resolve by length #} |
373 {# 2. Initialize argcount to be min(maxarg, n). #} | 373 {# 2. Initialize argcount to be min(maxarg, n). #} |
374 switch (std::min({{overloads.maxarg}}, info.Length())) { | 374 switch (std::min({{overloads.maxarg}}, info.Length())) { |
375 {# 3. Remove from S all entries whose type list is not of length argcount. #
} | 375 {# 3. Remove from S all entries whose type list is not of length argcount. #
} |
376 {% for length, tests_methods in overloads.length_tests_methods %} | 376 {% for length, tests_methods in overloads.length_tests_methods %} |
377 {# 10. If i = d, then: #} | 377 {# 10. If i = d, then: #} |
378 case {{length}}: | 378 case {{length}}: |
379 {# Then resolve by testing argument #} | 379 {# Then resolve by testing argument #} |
380 {% for test, method in tests_methods %} | 380 {% for test, method in tests_methods %} |
381 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and | 381 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and |
382 method.runtime_enabled_function) %} | 382 method.runtime_enabled_function) %} |
383 if ({{test}}) { | 383 if ({{test}}) { |
384 {% if method.measure_as and not overloads.measure_all_as %} | 384 {% if method.measure_as and not overloads.measure_all_as %} |
385 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCou
nter::{{method.measure_as}}); | 385 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecut
ionContext(info.GetIsolate()), UseCounter::{{method.measure_as}}); |
386 {% endif %} | 386 {% endif %} |
387 {% if method.deprecate_as and not overloads.deprecate_all_as %} | 387 {% if method.deprecate_as and not overloads.deprecate_all_as %} |
388 UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate
()), UseCounter::{{method.deprecate_as}}); | 388 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca
llingExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); |
389 {% endif %} | 389 {% endif %} |
390 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info)
; | 390 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info)
; |
391 return; | 391 return; |
392 } | 392 } |
393 {% endfilter %} | 393 {% endfilter %} |
394 {% endfor %} | 394 {% endfor %} |
395 break; | 395 break; |
396 {% endfor %} | 396 {% endfor %} |
397 default: | 397 default: |
398 {# Invalid arity, throw error #} | 398 {# Invalid arity, throw error #} |
(...skipping 18 matching lines...) Expand all Loading... |
417 | 417 |
418 | 418 |
419 {##############################################################################} | 419 {##############################################################################} |
420 {% macro method_callback(method, world_suffix) %} | 420 {% macro method_callback(method, world_suffix) %} |
421 {% filter conditional(method.conditional_string) %} | 421 {% filter conditional(method.conditional_string) %} |
422 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall
backInfo<v8::Value>& info) | 422 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall
backInfo<v8::Value>& info) |
423 { | 423 { |
424 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 424 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
425 {% if not method.overloads %}{# Overloaded methods are measured in overload_
resolution_method() #} | 425 {% if not method.overloads %}{# Overloaded methods are measured in overload_
resolution_method() #} |
426 {% if method.measure_as %} | 426 {% if method.measure_as %} |
427 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{
method.measure_as}}); | 427 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{method.measure_as}}); |
428 {% endif %} | 428 {% endif %} |
429 {% if method.deprecate_as %} | 429 {% if method.deprecate_as %} |
430 UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), Use
Counter::{{method.deprecate_as}}); | 430 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); |
431 {% endif %} | 431 {% endif %} |
432 {% endif %}{# not method.overloads #} | 432 {% endif %}{# not method.overloads #} |
433 {% if world_suffix in method.activity_logging_world_list %} | 433 {% if world_suffix in method.activity_logging_world_list %} |
434 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo
ntext()); | 434 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo
ntext()); |
435 V8PerContextData* contextData = scriptState->perContextData(); | 435 V8PerContextData* contextData = scriptState->perContextData(); |
436 {% if method.activity_logging_world_check %} | 436 {% if method.activity_logging_world_check %} |
437 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac
tivityLogger()) | 437 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac
tivityLogger()) |
438 {% else %} | 438 {% else %} |
439 if (contextData && contextData->activityLogger()) { | 439 if (contextData && contextData->activityLogger()) { |
440 {% endif %} | 440 {% endif %} |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 if method.is_per_world_bindings else '0' %} | 616 if method.is_per_world_bindings else '0' %} |
617 {% set property_attribute = | 617 {% set property_attribute = |
618 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) | 618 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) |
619 if method.property_attributes else 'v8::None' %} | 619 if method.property_attributes else 'v8::None' %} |
620 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat
eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo
sedToAllScripts' %} | 620 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat
eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo
sedToAllScripts' %} |
621 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { | 621 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { |
622 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}},
{{method.length}}, {{only_exposed_to_private_script}}, | 622 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}},
{{method.length}}, {{only_exposed_to_private_script}}, |
623 }; | 623 }; |
624 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu
re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); | 624 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu
re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); |
625 {%- endmacro %} | 625 {%- endmacro %} |
OLD | NEW |