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

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

Issue 2626183003: Switch RemoteWindowProxy to use v8::Context::NewRemoteContext. (Closed)
Patch Set: rebase Created 3 years, 9 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 {% endif %}{# interface_name == 'EventTarget' #} 71 {% endif %}{# interface_name == 'EventTarget' #}
72 {% endif %}{# method.is_check_security_for_receiver #} 72 {% endif %}{# method.is_check_security_for_receiver #}
73 {% if method.is_check_security_for_return_value %} 73 {% if method.is_check_security_for_return_value %}
74 {{define_exception_state}} 74 {{define_exception_state}}
75 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), {{method.cpp_value}}, exceptionState)) { 75 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), {{method.cpp_value}}, exceptionState)) {
76 v8SetReturnValueNull(info); 76 v8SetReturnValueNull(info);
77 return; 77 return;
78 } 78 }
79 {% endif %} 79 {% endif %}
80 80
81 {% if 'scriptState' in function_call %} 81 {% set log_activity = world_suffix in method.activity_logging_world_list %}
82 {% if 'scriptState' in function_call or log_activity %}
82 {% if method.is_static %} 83 {% if method.is_static %}
83 ScriptState* scriptState = ScriptState::forFunctionObject(info); 84 ScriptState* scriptState = ScriptState::forFunctionObject(info);
84 {% else %} 85 {% else %}
85 ScriptState* scriptState = ScriptState::forReceiverObject(info); 86 ScriptState* scriptState = ScriptState::forReceiverObject(info);
86 {% endif %} 87 {% endif %}
87 {% endif %} 88 {% endif %}
88 89
90 {% if log_activity %}
91 V8PerContextData* contextData = scriptState->perContextData();
92 if (contextData && contextData->activityLogger()) {
93 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo ntext, "{{interface_name}}", "{{method.name}}");
94 Vector<v8::Local<v8::Value>> loggerArgs = toImplArguments<Vector<v8::Local<v 8::Value>>>(info, 0, exceptionState);
95 contextData->activityLogger()->logMethod("{{interface_name}}.{{method.name}} ", info.Length(), loggerArgs.data());
96 }
97 {% endif %}
98
89 {% if method.is_custom_element_callbacks %} 99 {% if method.is_custom_element_callbacks %}
90 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; 100 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
91 {% endif %} 101 {% endif %}
92 102
93 {{function_call | indent(2)}} 103 {{function_call | indent(2)}}
94 } 104 }
95 {% endfilter %} 105 {% endfilter %}
96 {% endmacro %} 106 {% endmacro %}
97 107
98 108
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 {% macro method_callback(method, world_suffix) %} 514 {% macro method_callback(method, world_suffix) %}
505 void {{v8_class_or_partial}}::{{method.name}}MethodCallback{{world_suffix}}(cons t v8::FunctionCallbackInfo<v8::Value>& info) { 515 void {{v8_class_or_partial}}::{{method.name}}MethodCallback{{world_suffix}}(cons t v8::FunctionCallbackInfo<v8::Value>& info) {
506 {% if not method.overloads %}{# Overloaded methods are measured in overload_re solution_method() #} 516 {% if not method.overloads %}{# Overloaded methods are measured in overload_re solution_method() #}
507 {% if method.measure_as %} 517 {% if method.measure_as %}
508 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{me thod.measure_as('Method')}}); 518 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{me thod.measure_as('Method')}});
509 {% endif %} 519 {% endif %}
510 {% if method.deprecate_as %} 520 {% if method.deprecate_as %}
511 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC ounter::{{method.deprecate_as}}); 521 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC ounter::{{method.deprecate_as}});
512 {% endif %} 522 {% endif %}
513 {% endif %}{# not method.overloads #} 523 {% endif %}{# not method.overloads #}
514 {% if world_suffix in method.activity_logging_world_list %}
515 {% if method.is_static %}
516 ScriptState* scriptState = ScriptState::forFunctionObject(info);
517 {% else %}
518 ScriptState* scriptState = ScriptState::forReceiverObject(info);
519 {% endif %}
520 V8PerContextData* contextData = scriptState->perContextData();
521 if (contextData && contextData->activityLogger()) {
522 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo ntext, "{{interface_name}}", "{{method.name}}");
523 Vector<v8::Local<v8::Value>> loggerArgs = toImplArguments<Vector<v8::Local<v 8::Value>>>(info, 0, exceptionState);
524 contextData->activityLogger()->logMethod("{{interface_name}}.{{method.name}} ", info.Length(), loggerArgs.data());
525 }
526 {% endif %}
527 {% if method.is_ce_reactions %} 524 {% if method.is_ce_reactions %}
528 CEReactionsScope ceReactionsScope; 525 CEReactionsScope ceReactionsScope;
529 {% endif %} 526 {% endif %}
530 {% if method.is_custom %} 527 {% if method.is_custom %}
531 {{v8_class}}::{{method.name}}MethodCustom(info); 528 {{v8_class}}::{{method.name}}MethodCustom(info);
532 {% elif method.is_post_message %} 529 {% elif method.is_post_message %}
533 {{cpp_class_or_partial}}V8Internal::postMessageImpl("{{interface_name}}", {{v8 _class}}::toImpl(info.Holder()), info); 530 {{cpp_class_or_partial}}V8Internal::postMessageImpl("{{interface_name}}", {{v8 _class}}::toImpl(info.Holder()), info);
534 {% else %} 531 {% else %}
535 {{cpp_class_or_partial}}V8Internal::{{method.name}}Method{{world_suffix}}(info ); 532 {{cpp_class_or_partial}}V8Internal::{{method.name}}Method{{world_suffix}}(info );
536 {% endif %} 533 {% endif %}
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 if method.overloads else 651 if method.overloads else
655 method.runtime_enabled_feature_name) %} 652 method.runtime_enabled_feature_name) %}
656 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 653 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
657 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); 654 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration);
658 {% endfilter %}{# runtime_enabled() #} 655 {% endfilter %}{# runtime_enabled() #}
659 {% endfilter %}{# exposed() #} 656 {% endfilter %}{# exposed() #}
660 {% endfilter %}{# secure_context() #} 657 {% endfilter %}{# secure_context() #}
661 {% endfor %} 658 {% endfor %}
662 {% endif %} 659 {% endif %}
663 {%- endmacro %} 660 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698