Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Side by Side Diff: third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl

Issue 2645813003: [Bindings] Make exported functions visible from other components (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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::ExecutionCont ext, "{{interface_name}}", "{{method.name}}"); 10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont ext, "{{interface_name}}", "{{method.name}}");
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 476
477 // FIXME: Only pass context/exceptionState if instance really requires it. 477 // FIXME: Only pass context/exceptionState if instance really requires it.
478 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); 478 ExecutionContext* context = currentExecutionContext(info.GetIsolate());
479 instance->postMessage(context, message.release(), transferables.messagePorts, exceptionState); 479 instance->postMessage(context, message.release(), transferables.messagePorts, exceptionState);
480 } 480 }
481 {% endmacro %} 481 {% endmacro %}
482 482
483 483
484 {##############################################################################} 484 {##############################################################################}
485 {% macro method_callback(method, world_suffix) %} 485 {% macro method_callback(method, world_suffix) %}
486 void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCallbackInf o<v8::Value>& info) { 486 {{exported}} void {{method.name}}MethodCallback{{world_suffix}}(const v8::Functi onCallbackInfo<v8::Value>& info) {
487 {% if not method.overloads %}{# Overloaded methods are measured in overload_re solution_method() #} 487 {% if not method.overloads %}{# Overloaded methods are measured in overload_re solution_method() #}
488 {% if method.measure_as %} 488 {% if method.measure_as %}
489 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{me thod.measure_as('Method')}}); 489 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{me thod.measure_as('Method')}});
490 {% endif %} 490 {% endif %}
491 {% if method.deprecate_as %} 491 {% if method.deprecate_as %}
492 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC ounter::{{method.deprecate_as}}); 492 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC ounter::{{method.deprecate_as}});
493 {% endif %} 493 {% endif %}
494 {% endif %}{# not method.overloads #} 494 {% endif %}{# not method.overloads #}
495 {% if world_suffix in method.activity_logging_world_list %} 495 {% if world_suffix in method.activity_logging_world_list %}
496 {% if method.is_static %} 496 {% if method.is_static %}
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), impl, BindingSecurity::ErrorReportOption::DoNotReport)) { 539 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), impl, BindingSecurity::ErrorReportOption::DoNotReport)) {
540 return; 540 return;
541 } 541 }
542 542
543 v8::Local<v8::Value> hiddenValue = V8HiddenValue::getHiddenValue(ScriptState:: current(info.GetIsolate()), v8::Local<v8::Object>::Cast(info.Holder()), v8Atomic String(info.GetIsolate(), "{{method.name}}")); 543 v8::Local<v8::Value> hiddenValue = V8HiddenValue::getHiddenValue(ScriptState:: current(info.GetIsolate()), v8::Local<v8::Object>::Cast(info.Holder()), v8Atomic String(info.GetIsolate(), "{{method.name}}"));
544 if (!hiddenValue.IsEmpty()) { 544 if (!hiddenValue.IsEmpty()) {
545 v8SetReturnValue(info, hiddenValue); 545 v8SetReturnValue(info, hiddenValue);
546 } 546 }
547 } 547 }
548 548
549 void {{method.name}}OriginSafeMethodGetterCallback{{world_suffix}}(v8::Local<v8: :Name>, const v8::PropertyCallbackInfo<v8::Value>& info) { 549 {{exported}} void {{method.name}}OriginSafeMethodGetterCallback{{world_suffix}}( v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) {
550 {{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodGetter{{world_suffix}} (info); 550 {{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodGetter{{world_suffix}} (info);
551 } 551 }
552 {% endmacro %} 552 {% endmacro %}
553 553
554 554
555 {##############################################################################} 555 {##############################################################################}
556 {% macro generate_constructor(constructor) %} 556 {% macro generate_constructor(constructor) %}
557 {% set name = '%sConstructorCallback' % v8_class 557 {% set name = '%sConstructorCallback' % v8_class
558 if constructor.is_named_constructor else 558 if constructor.is_named_constructor else
559 'constructor%s' % (constructor.overload_index or '') %} 559 'constructor%s' % (constructor.overload_index or '') %}
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 if method.overloads else 637 if method.overloads else
638 method.runtime_enabled_feature_name) %} 638 method.runtime_enabled_feature_name) %}
639 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 639 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
640 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); 640 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration);
641 {% endfilter %}{# runtime_enabled() #} 641 {% endfilter %}{# runtime_enabled() #}
642 {% endfilter %}{# exposed() #} 642 {% endfilter %}{# exposed() #}
643 {% endfilter %}{# secure_context() #} 643 {% endfilter %}{# secure_context() #}
644 {% endfor %} 644 {% endfor %}
645 {% endif %} 645 {% endif %}
646 {%- endmacro %} 646 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698