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

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

Issue 877523004: Add extended attribute, [Measure], to simplify use counting (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use the same key for overloads. Created 5 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 | Annotate | Revision Log
OLDNEW
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 {% for length, tests_methods in overloads.length_tests_methods %} 368 {% for length, tests_methods in overloads.length_tests_methods %}
369 {# 10. If i = d, then: #} 369 {# 10. If i = d, then: #}
370 case {{length}}: 370 case {{length}}:
371 {# Then resolve by testing argument #} 371 {# Then resolve by testing argument #}
372 {% for test, method in tests_methods %} 372 {% for test, method in tests_methods %}
373 {% if method.visible %} 373 {% if method.visible %}
374 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and 374 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and
375 method.runtime_enabled_function) %} 375 method.runtime_enabled_function) %}
376 if ({{test}}) { 376 if ({{test}}) {
377 {% if method.measure_as and not overloads.measure_all_as %} 377 {% if method.measure_as and not overloads.measure_all_as %}
378 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecut ionContext(info.GetIsolate()), UseCounter::{{method.measure_as}}); 378 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecut ionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
379 {% endif %} 379 {% endif %}
380 {% if method.deprecate_as and not overloads.deprecate_all_as %} 380 {% if method.deprecate_as and not overloads.deprecate_all_as %}
381 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca llingExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); 381 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca llingExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
382 {% endif %} 382 {% endif %}
383 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info) ; 383 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info) ;
384 return; 384 return;
385 } 385 }
386 {% endfilter %} 386 {% endfilter %}
387 {% endif %} 387 {% endif %}
388 {% endfor %} 388 {% endfor %}
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 427
428 428
429 {##############################################################################} 429 {##############################################################################}
430 {% macro method_callback(method, world_suffix) %} 430 {% macro method_callback(method, world_suffix) %}
431 {% filter conditional(method.conditional_string) %} 431 {% filter conditional(method.conditional_string) %}
432 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall backInfo<v8::Value>& info) 432 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall backInfo<v8::Value>& info)
433 { 433 {
434 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 434 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
435 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #} 435 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #}
436 {% if method.measure_as %} 436 {% if method.measure_as %}
437 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as}}); 437 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
438 {% endif %} 438 {% endif %}
439 {% if method.deprecate_as %} 439 {% if method.deprecate_as %}
440 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe cutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); 440 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe cutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
441 {% endif %} 441 {% endif %}
442 {% endif %}{# not method.overloads #} 442 {% endif %}{# not method.overloads #}
443 {% if world_suffix in method.activity_logging_world_list %} 443 {% if world_suffix in method.activity_logging_world_list %}
444 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext()); 444 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext());
445 V8PerContextData* contextData = scriptState->perContextData(); 445 V8PerContextData* contextData = scriptState->perContextData();
446 {% if method.activity_logging_world_check %} 446 {% if method.activity_logging_world_check %}
447 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) 447 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger())
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 if method.overloads else 651 if method.overloads else
652 method.runtime_enabled_function) %} 652 method.runtime_enabled_function) %}
653 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio nTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}Metho dCallback, v8Undefined(), defaultSignature, {{method.number_of_required_argument s}})->GetFunction()); 653 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio nTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}Metho dCallback, v8Undefined(), defaultSignature, {{method.number_of_required_argument s}})->GetFunction());
654 {% endfilter %}{# runtime_enabled() #} 654 {% endfilter %}{# runtime_enabled() #}
655 {% endfilter %}{# exposed() #} 655 {% endfilter %}{# exposed() #}
656 {% endfilter %}{# per_context_enabled() #} 656 {% endfilter %}{# per_context_enabled() #}
657 {% endfor %} 657 {% endfor %}
658 {% endif %} 658 {% endif %}
659 } 659 }
660 {%- endmacro %} 660 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698