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

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

Issue 2199643003: binding: Uses the current context if attribute/method is static. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value %} 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% macro generate_method(method, world_suffix) %} 4 {% macro generate_method(method, world_suffix) %}
5 {% if method.returns_promise and method.has_exception_state %} 5 {% if method.returns_promise and method.has_exception_state %}
6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e) 6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e)
7 {% else %} 7 {% else %}
8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
9 {% endif %} 9 {% endif %}
10 { 10 {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 {######################################} 227 {######################################}
228 {% macro cpp_method_call(method, v8_set_return_value, cpp_value) %} 228 {% macro cpp_method_call(method, v8_set_return_value, cpp_value) %}
229 {% if method.is_custom_call_prologue %} 229 {% if method.is_custom_call_prologue %}
230 {{v8_class}}::{{method.name}}MethodPrologueCustom(info, impl); 230 {{v8_class}}::{{method.name}}MethodPrologueCustom(info, impl);
231 {% endif %} 231 {% endif %}
232 {# Local variables #} 232 {# Local variables #}
233 {% if method.is_call_with_script_state or method.is_call_with_this_value %} 233 {% if method.is_call_with_script_state or method.is_call_with_this_value %}
234 {# [ConstructorCallWith=ScriptState] #} 234 {# [ConstructorCallWith=ScriptState] #}
235 {# [CallWith=ScriptState] #} 235 {# [CallWith=ScriptState] #}
236 ScriptState* scriptState = ScriptState::forHolderObject(info); 236 {% if method.is_static %}
237 ScriptState* scriptState = ScriptState::forFunctionObject(info);
238 {% else %}
239 ScriptState* scriptState = ScriptState::forReceiverObject(info);
240 {% endif %}
237 {% endif %} 241 {% endif %}
238 {% if method.is_call_with_execution_context %} 242 {% if method.is_call_with_execution_context %}
239 {# [ConstructorCallWith=ExecutionContext] #} 243 {# [ConstructorCallWith=ExecutionContext] #}
240 {# [CallWith=ExecutionContext] #} 244 {# [CallWith=ExecutionContext] #}
241 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); 245 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
242 {% endif %} 246 {% endif %}
243 {% if method.is_call_with_script_arguments %} 247 {% if method.is_call_with_script_arguments %}
244 {# [CallWith=ScriptArguments] #} 248 {# [CallWith=ScriptArguments] #}
245 ScriptArguments* scriptArguments(ScriptArguments::create(scriptState, info, {{me thod.number_of_arguments}})); 249 ScriptArguments* scriptArguments(ScriptArguments::create(scriptState, info, {{me thod.number_of_arguments}}));
246 {% endif %} 250 {% endif %}
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 { 499 {
496 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #} 500 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #}
497 {% if method.measure_as %} 501 {% if method.measure_as %}
498 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); 502 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
499 {% endif %} 503 {% endif %}
500 {% if method.deprecate_as %} 504 {% if method.deprecate_as %}
501 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); 505 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
502 {% endif %} 506 {% endif %}
503 {% endif %}{# not method.overloads #} 507 {% endif %}{# not method.overloads #}
504 {% if world_suffix in method.activity_logging_world_list %} 508 {% if world_suffix in method.activity_logging_world_list %}
505 ScriptState* scriptState = ScriptState::forHolderObject(info); 509 {% if method.is_static %}
510 ScriptState* scriptState = ScriptState::forFunctionObject(info);
511 {% else %}
512 ScriptState* scriptState = ScriptState::forReceiverObject(info);
513 {% endif %}
506 V8PerContextData* contextData = scriptState->perContextData(); 514 V8PerContextData* contextData = scriptState->perContextData();
507 {% if method.activity_logging_world_check %} 515 {% if method.activity_logging_world_check %}
508 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) 516 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger())
509 {% else %} 517 {% else %}
510 if (contextData && contextData->activityLogger()) { 518 if (contextData && contextData->activityLogger()) {
511 {% endif %} 519 {% endif %}
512 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{metho d.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 520 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{metho d.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
513 Vector<v8::Local<v8::Value>> loggerArgs = toImplArguments<Vector<v8::Loc al<v8::Value>>>(info, 0, exceptionState); 521 Vector<v8::Local<v8::Value>> loggerArgs = toImplArguments<Vector<v8::Loc al<v8::Value>>>(info, 0, exceptionState);
514 contextData->activityLogger()->logMethod("{{interface_name}}.{{method.na me}}", info.Length(), loggerArgs.data()); 522 contextData->activityLogger()->logMethod("{{interface_name}}.{{method.na me}}", info.Length(), loggerArgs.data());
515 } 523 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all 693 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all
686 if method.overloads else 694 if method.overloads else
687 method.runtime_enabled_function) %} 695 method.runtime_enabled_function) %}
688 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 696 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
689 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); 697 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration);
690 {% endfilter %}{# runtime_enabled() #} 698 {% endfilter %}{# runtime_enabled() #}
691 {% endfilter %}{# exposed() #} 699 {% endfilter %}{# exposed() #}
692 {% endfor %} 700 {% endfor %}
693 {% endif %} 701 {% endif %}
694 {%- endmacro %} 702 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698