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

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

Issue 299203002: Support per-overload [RuntimeEnabled] extended attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 years, 6 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 {##############################################################################} 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 UseCounter::countDeprecation(callingExecutionContext(isolate), UseCounter::{ {overloads.deprecate_all_as}}); 343 UseCounter::countDeprecation(callingExecutionContext(isolate), UseCounter::{ {overloads.deprecate_all_as}});
344 {% endif %} 344 {% endif %}
345 {# First resolve by length #} 345 {# First resolve by length #}
346 {# 2. Initialize argcount to be min(maxarg, n). #} 346 {# 2. Initialize argcount to be min(maxarg, n). #}
347 switch (std::min({{overloads.maxarg}}, info.Length())) { 347 switch (std::min({{overloads.maxarg}}, info.Length())) {
348 {# 3. Remove from S all entries whose type list is not of length argcount. # } 348 {# 3. Remove from S all entries whose type list is not of length argcount. # }
349 {% for length, tests_methods in overloads.length_tests_methods %} 349 {% for length, tests_methods in overloads.length_tests_methods %}
350 case {{length}}: 350 case {{length}}:
351 {# Then resolve by testing argument #} 351 {# Then resolve by testing argument #}
352 {% for test, method in tests_methods %} 352 {% for test, method in tests_methods %}
353 {# 10. If i = d, then: #} 353 {# 10. If i = d, then: #}
Nils Barth (inactive) 2014/06/12 11:45:06 Could you move this comment up?
Jens Widell 2014/06/12 12:04:38 How far up? :-)
Nils Barth (inactive) 2014/06/12 12:20:27 I love it when I say "Jump" and you reply "How hig
354 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and method.runtime_enabled_function) %}
Nils Barth (inactive) 2014/06/12 11:45:06 wrap?
354 if ({{test}}) { 355 if ({{test}}) {
355 {% if method.measure_as and not overloads.measure_all_as %} 356 {% if method.measure_as and not overloads.measure_all_as %}
356 UseCounter::count(callingExecutionContext(isolate), UseCounter::{{me thod.measure_as}}); 357 UseCounter::count(callingExecutionContext(isolate), UseCounter::{{me thod.measure_as}});
357 {% endif %} 358 {% endif %}
358 {% if method.deprecate_as and not overloads.deprecate_all_as %} 359 {% if method.deprecate_as and not overloads.deprecate_all_as %}
359 UseCounter::countDeprecation(callingExecutionContext(isolate), UseCo unter::{{method.deprecate_as}}); 360 UseCounter::countDeprecation(callingExecutionContext(isolate), UseCo unter::{{method.deprecate_as}});
360 {% endif %} 361 {% endif %}
361 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info) ; 362 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info) ;
362 return; 363 return;
363 } 364 }
365 {% endfilter %}
364 {% endfor %} 366 {% endfor %}
365 break; 367 break;
366 {% endfor %} 368 {% endfor %}
367 default: 369 default:
368 {# Invalid arity, throw error #} 370 {# Invalid arity, throw error #}
369 {# Report full list of valid arities if gaps and above minimum #} 371 {# Report full list of valid arities if gaps and above minimum #}
370 {% if overloads.valid_arities %} 372 {% if overloads.valid_arities %}
371 if (info.Length() >= {{overloads.minarg}}) { 373 if (info.Length() >= {{overloads.minarg}}) {
372 throwArityTypeError(exceptionState, "{{overloads.valid_arities}}", i nfo.Length()); 374 throwArityTypeError(exceptionState, "{{overloads.valid_arities}}", i nfo.Length());
373 return; 375 return;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 {% endif %} 555 {% endif %}
554 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons tructor.argument_list | join(', ')}}); 556 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons tructor.argument_list | join(', ')}});
555 {% if is_constructor_raises_exception %} 557 {% if is_constructor_raises_exception %}
556 if (exceptionState.throwIfNeeded()) 558 if (exceptionState.throwIfNeeded())
557 return; 559 return;
558 {% endif %} 560 {% endif %}
559 561
560 {{generate_constructor_wrapper(constructor) | indent}} 562 {{generate_constructor_wrapper(constructor) | indent}}
561 } 563 }
562 {% endmacro %} 564 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698