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

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: Remove inheritance of [Measure] Created 5 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 | Annotate | Revision Log
OLDNEW
1 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %} 1 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro generate_method(method, world_suffix) %} 5 {% macro generate_method(method, world_suffix) %}
6 {% filter conditional(method.conditional_string) %} 6 {% filter conditional(method.conditional_string) %}
7 {% if method.returns_promise and method.has_exception_state %} 7 {% if method.returns_promise and method.has_exception_state %}
8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e) 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e)
9 {% else %} 9 {% else %}
10 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 10 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 {% for length, tests_methods in overloads.length_tests_methods %} 381 {% for length, tests_methods in overloads.length_tests_methods %}
382 {# 10. If i = d, then: #} 382 {# 10. If i = d, then: #}
383 case {{length}}: 383 case {{length}}:
384 {# Then resolve by testing argument #} 384 {# Then resolve by testing argument #}
385 {% for test, method in tests_methods %} 385 {% for test, method in tests_methods %}
386 {% if method.visible %} 386 {% if method.visible %}
387 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and 387 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and
388 method.runtime_enabled_function) %} 388 method.runtime_enabled_function) %}
389 if ({{test}}) { 389 if ({{test}}) {
390 {% if method.measure_as and not overloads.measure_all_as %} 390 {% if method.measure_as and not overloads.measure_all_as %}
391 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecut ionContext(info.GetIsolate()), UseCounter::{{method.measure_as}}); 391 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecut ionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
392 {% endif %} 392 {% endif %}
393 {% if method.deprecate_as and not overloads.deprecate_all_as %} 393 {% if method.deprecate_as and not overloads.deprecate_all_as %}
394 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca llingExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); 394 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca llingExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
395 {% endif %} 395 {% endif %}
396 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info) ; 396 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info) ;
397 return; 397 return;
398 } 398 }
399 {% endfilter %} 399 {% endfilter %}
400 {% endif %} 400 {% endif %}
401 {% endfor %} 401 {% endfor %}
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 438
439 439
440 {##############################################################################} 440 {##############################################################################}
441 {% macro method_callback(method, world_suffix) %} 441 {% macro method_callback(method, world_suffix) %}
442 {% filter conditional(method.conditional_string) %} 442 {% filter conditional(method.conditional_string) %}
443 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall backInfo<v8::Value>& info) 443 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall backInfo<v8::Value>& info)
444 { 444 {
445 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 445 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
446 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #} 446 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #}
447 {% if method.measure_as %} 447 {% if method.measure_as %}
448 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as}}); 448 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
449 {% endif %} 449 {% endif %}
450 {% if method.deprecate_as %} 450 {% if method.deprecate_as %}
451 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe cutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); 451 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe cutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
452 {% endif %} 452 {% endif %}
453 {% endif %}{# not method.overloads #} 453 {% endif %}{# not method.overloads #}
454 {% if world_suffix in method.activity_logging_world_list %} 454 {% if world_suffix in method.activity_logging_world_list %}
455 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext()); 455 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext());
456 V8PerContextData* contextData = scriptState->perContextData(); 456 V8PerContextData* contextData = scriptState->perContextData();
457 {% if method.activity_logging_world_check %} 457 {% if method.activity_logging_world_check %}
458 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) 458 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger())
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 if method.overloads else 661 if method.overloads else
662 method.runtime_enabled_function) %} 662 method.runtime_enabled_function) %}
663 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()); 663 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());
664 {% endfilter %}{# runtime_enabled() #} 664 {% endfilter %}{# runtime_enabled() #}
665 {% endfilter %}{# exposed() #} 665 {% endfilter %}{# exposed() #}
666 {% endfilter %}{# per_context_enabled() #} 666 {% endfilter %}{# per_context_enabled() #}
667 {% endfor %} 667 {% endfor %}
668 {% endif %} 668 {% endif %}
669 } 669 }
670 {%- endmacro %} 670 {%- endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.cpp ('k') | Source/bindings/tests/idls/core/TestInterface.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698