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

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

Issue 1531443003: [bindings] Implement an ExperimentEnabled IDL extended attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove 'return undefined and print a message' on constructors. Created 5 years 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 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l ocal_cpp_value %} 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l ocal_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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 createMinimumArityTypeErrorForMethod(info.GetIsolate(), "{{method.name}}", "{{in terface_name}}", {{number_of_required_arguments}}, info.Length()) 359 createMinimumArityTypeErrorForMethod(info.GetIsolate(), "{{method.name}}", "{{in terface_name}}", {{number_of_required_arguments}}, info.Length())
360 {%- endif %} 360 {%- endif %}
361 {%- endmacro %} 361 {%- endmacro %}
362 362
363 363
364 {##############################################################################} 364 {##############################################################################}
365 {% macro runtime_determined_length_method(overloads) %} 365 {% macro runtime_determined_length_method(overloads) %}
366 static int {{overloads.name}}MethodLength() 366 static int {{overloads.name}}MethodLength()
367 { 367 {
368 {% for length, runtime_enabled_functions in overloads.runtime_determined_len gths %} 368 {% for length, runtime_enabled_functions in overloads.runtime_determined_len gths %}
369 {% for runtime_enabled_function in runtime_enabled_functions %} 369 {% for runtime_enabled_function in runtime_enabled_functions %}
370 {% filter runtime_enabled(runtime_enabled_function) %} 370 {% filter runtime_enabled(runtime_enabled_function) %}
371 return {{length}}; 371 return {{length}};
372 {% endfilter %} 372 {% endfilter %}
373 {% endfor %} 373 {% endfor %}
374 {% endfor %} 374 {% endfor %}
375 } 375 }
376 {% endmacro %} 376 {% endmacro %}
377 377
378 378
379 {##############################################################################} 379 {##############################################################################}
(...skipping 30 matching lines...) Expand all
410 switch (std::min({{overloads.maxarg}}, info.Length())) { 410 switch (std::min({{overloads.maxarg}}, info.Length())) {
411 {# 3. Remove from S all entries whose type list is not of length argcount. # } 411 {# 3. Remove from S all entries whose type list is not of length argcount. # }
412 {% for length, tests_methods in overloads.length_tests_methods %} 412 {% for length, tests_methods in overloads.length_tests_methods %}
413 {# 10. If i = d, then: #} 413 {# 10. If i = d, then: #}
414 case {{length}}: 414 case {{length}}:
415 {# Then resolve by testing argument #} 415 {# Then resolve by testing argument #}
416 {% for test, method in tests_methods %} 416 {% for test, method in tests_methods %}
417 {% if method.visible %} 417 {% if method.visible %}
418 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and 418 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and
419 method.runtime_enabled_function) %} 419 method.runtime_enabled_function) %}
420 {% filter api_experiment_enabled(not overloads.api_experiment_name_all a nd
421 method.api_experiment_name) %}
haraken 2015/12/18 02:35:51 Ditto. Want to avoid the code duplication.
Daniel Nishi 2015/12/18 05:11:42 Hm. The (not x_all and x) logic on this particular
haraken 2015/12/18 05:20:03 BTW, do we really need to differentiate [APIExperi
420 if ({{test}}) { 422 if ({{test}}) {
421 {% if method.measure_as and not overloads.measure_all_as %} 423 {% if method.measure_as and not overloads.measure_all_as %}
422 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecut ionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); 424 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecut ionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
423 {% endif %} 425 {% endif %}
424 {% if method.deprecate_as and not overloads.deprecate_all_as %} 426 {% if method.deprecate_as and not overloads.deprecate_all_as %}
425 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca llingExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); 427 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca llingExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
426 {% endif %} 428 {% endif %}
427 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info) ; 429 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info) ;
428 return; 430 return;
429 } 431 }
430 {% endfilter %} 432 {% endfilter %}
433 {% endfilter %}
431 {% endif %} 434 {% endif %}
432 {% endfor %} 435 {% endfor %}
433 break; 436 break;
434 {% endfor %} 437 {% endfor %}
435 {% if is_partial or not overloads.has_partial_overloads %} 438 {% if is_partial or not overloads.has_partial_overloads %}
436 default: 439 default:
437 {# If methods are overloaded between interface and partial interface #} 440 {# If methods are overloaded between interface and partial interface #}
438 {# definitions, need to invoke methods defined in the partial #} 441 {# definitions, need to invoke methods defined in the partial #}
439 {# interface. #} 442 {# interface. #}
440 {# FIXME: we do not need to always generate this code. #} 443 {# FIXME: we do not need to always generate this code. #}
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTempl ate(isolate)); 703 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTempl ate(isolate));
701 ExecutionContext* executionContext = toExecutionContext(prototypeObject->Creatio nContext()); 704 ExecutionContext* executionContext = toExecutionContext(prototypeObject->Creatio nContext());
702 ASSERT(executionContext); 705 ASSERT(executionContext);
703 {% for method in conditionally_enabled_methods %} 706 {% for method in conditionally_enabled_methods %}
704 {% filter exposed(method.overloads.exposed_test_all 707 {% filter exposed(method.overloads.exposed_test_all
705 if method.overloads else 708 if method.overloads else
706 method.exposed_test) %} 709 method.exposed_test) %}
707 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all 710 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all
708 if method.overloads else 711 if method.overloads else
709 method.runtime_enabled_function) %} 712 method.runtime_enabled_function) %}
713 {% filter api_experiment_enabled(method.overloads.api_experiment_name_all
714 if method.overloads else
715 method.api_experiment_name) %}
haraken 2015/12/18 02:35:51 Ditto. Want to avoid the code duplication.
Daniel Nishi 2015/12/18 05:11:42 Done in the same manner w/ sharing the method.over
710 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 716 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
711 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj ect, interfaceObject, defaultSignature, {{method.name}}MethodConfiguration); 717 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj ect, interfaceObject, defaultSignature, {{method.name}}MethodConfiguration);
718 {% endfilter %}{# api_experiment_enabled() #}
712 {% endfilter %}{# runtime_enabled() #} 719 {% endfilter %}{# runtime_enabled() #}
713 {% endfilter %}{# exposed() #} 720 {% endfilter %}{# exposed() #}
714 {% endfor %} 721 {% endfor %}
715 {% endif %} 722 {% endif %}
716 {%- endmacro %} 723 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698