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

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

Issue 2427223002: [Bindings] Expose callback functions for methods (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 { 9 {
10 {% set define_exception_state -%} 10 {% set define_exception_state -%}
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 return; 457 return;
458 // FIXME: Only pass context/exceptionState if instance really requires it. 458 // FIXME: Only pass context/exceptionState if instance really requires it.
459 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); 459 ExecutionContext* context = currentExecutionContext(info.GetIsolate());
460 instance->postMessage(context, message.release(), transferables.messagePorts , exceptionState); 460 instance->postMessage(context, message.release(), transferables.messagePorts , exceptionState);
461 } 461 }
462 {% endmacro %} 462 {% endmacro %}
463 463
464 464
465 {##############################################################################} 465 {##############################################################################}
466 {% macro method_callback(method, world_suffix) %} 466 {% macro method_callback(method, world_suffix) %}
467 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall backInfo<v8::Value>& info) 467 void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCallbackInf o<v8::Value>& info)
468 { 468 {
469 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #} 469 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #}
470 {% if method.measure_as %} 470 {% if method.measure_as %}
471 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); 471 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
472 {% endif %} 472 {% endif %}
473 {% if method.deprecate_as %} 473 {% if method.deprecate_as %}
474 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); 474 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
475 {% endif %} 475 {% endif %}
476 {% endif %}{# not method.overloads #} 476 {% endif %}{# not method.overloads #}
477 {% if world_suffix in method.activity_logging_world_list %} 477 {% if world_suffix in method.activity_logging_world_list %}
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate() ), impl, BindingSecurity::ErrorReportOption::DoNotReport)) { 523 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate() ), impl, BindingSecurity::ErrorReportOption::DoNotReport)) {
524 return; 524 return;
525 } 525 }
526 526
527 v8::Local<v8::Value> hiddenValue = V8HiddenValue::getHiddenValue(ScriptState ::current(info.GetIsolate()), v8::Local<v8::Object>::Cast(info.Holder()), v8Atom icString(info.GetIsolate(), "{{method.name}}")); 527 v8::Local<v8::Value> hiddenValue = V8HiddenValue::getHiddenValue(ScriptState ::current(info.GetIsolate()), v8::Local<v8::Object>::Cast(info.Holder()), v8Atom icString(info.GetIsolate(), "{{method.name}}"));
528 if (!hiddenValue.IsEmpty()) { 528 if (!hiddenValue.IsEmpty()) {
529 v8SetReturnValue(info, hiddenValue); 529 v8SetReturnValue(info, hiddenValue);
530 } 530 }
531 } 531 }
532 532
533 static void {{method.name}}OriginSafeMethodGetterCallback{{world_suffix}}(v8::Lo cal<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) 533 void {{method.name}}OriginSafeMethodGetterCallback{{world_suffix}}(v8::Local<v8: :Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
534 { 534 {
535 {{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodGetter{{world_suffix }}(info); 535 {{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodGetter{{world_suffix }}(info);
536 } 536 }
537 {% endmacro %} 537 {% endmacro %}
538 538
539 539
540 {##############################################################################} 540 {##############################################################################}
541 {% macro method_implemented_in_private_script(method) %} 541 {% macro method_implemented_in_private_script(method) %}
542 bool {{v8_class}}::PrivateScript::{{method.name}}Method({{method.argument_declar ations_for_private_script | join(', ')}}) 542 bool {{v8_class}}::PrivateScript::{{method.name}}Method({{method.argument_declar ations_for_private_script | join(', ')}})
543 { 543 {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 if method.overloads else 662 if method.overloads else
663 method.runtime_enabled_function) %} 663 method.runtime_enabled_function) %}
664 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 664 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
665 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); 665 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration);
666 {% endfilter %}{# runtime_enabled() #} 666 {% endfilter %}{# runtime_enabled() #}
667 {% endfilter %}{# exposed() #} 667 {% endfilter %}{# exposed() #}
668 {% endfilter %}{# secure_context() #} 668 {% endfilter %}{# secure_context() #}
669 {% endfor %} 669 {% endfor %}
670 {% endif %} 670 {% endif %}
671 {%- endmacro %} 671 {%- endmacro %}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698