Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/templates/interface_base.cpp |
| diff --git a/third_party/WebKit/Source/bindings/templates/interface_base.cpp b/third_party/WebKit/Source/bindings/templates/interface_base.cpp |
| index 22102d8796868d8ad8c07e5265562e0feb5022a6..5317dd85c5ffc412eb88a1dd986ceed95e47e36d 100644 |
| --- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp |
| +++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp |
| @@ -300,10 +300,20 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function |
| {% if runtime_enabled_function %} |
| if (!{{runtime_enabled_function}}()) |
| defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0); |
| - else |
| + else { |
| {% endif %} |
| {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %} |
| {% filter indent(runtime_enabled_indent, true) %} |
| + {% if api_experiment_name %} |
| + ExecutionContext* ec = currentExecutionContext(isolate); |
| + ALLOW_UNUSED_LOCAL(ec); |
| + if (!Experiments::isApiEnabledWithoutMessage(ec, "{{api_experiment_name}}")) { |
| + defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0); |
| + } |
| + else |
| + {% endif %} |
| + {% set api_experiment_enabled_indent = 4 if api_experiment_name else runtime_enabled_indent %} |
| + {% filter indent(api_experiment_enabled_indent, true) %} |
| defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalFieldCount, |
| {# Test needed as size 0 arrays definitions are not allowed per standard |
| (so objects have distinct addresses), which is enforced by MSVC. |
| @@ -326,7 +336,12 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function |
| {{attributes_name}}, {{attributes_length}}, |
| {{accessors_name}}, {{accessors_length}}, |
| {{methods_name}}, {{methods_length}}); |
| - {% endfilter %} |
| + {% endfilter %}{# api_experiment_enabled_indent #} |
| + {% endfilter %}{# runtime_enabled_indent #} |
| + {% if runtime_enabled_function %} |
| + |
| + } |
| + {% endif %} |
| {% if constructors or has_custom_constructor or has_event_constructor %} |
| functionTemplate->SetCallHandler({{v8_class}}::constructorCallback); |
| @@ -368,6 +383,7 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function |
| if attribute.name not in distinct_attributes %} |
| {% set unused = distinct_attributes.append(attribute.name) %} |
| {% filter conditional(attribute.conditional_string) %} |
| + {% filter experimental_framework_runtime_enabled(attribute.api_experiment_name) %} |
|
Daniel Nishi
2015/12/18 01:23:23
If the ExperimentalFramework runtime flag is enabl
|
| {% if attribute.is_data_type_property %} |
| const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = \ |
| {{attribute_configuration(attribute)}}; |
| @@ -378,6 +394,7 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function |
| V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, accessor{{attribute.name}}Configuration); |
| {% endif %} |
| {% endfilter %} |
| + {% endfilter %} |
| {% endfor %} |
| } |
| {% endfor %} |
| @@ -394,8 +411,10 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function |
| {% if iterator_method %} |
| {% filter exposed(iterator_method.exposed_test) %} |
| {% filter runtime_enabled(iterator_method.runtime_enabled_function) %} |
| + {% filter api_experiment_enabled(iterator_method.api_experiment_name) %} |
| const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::iteratorMethodCallback, 0, v8::DontDelete, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype }; |
| V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignature, symbolKeyedIteratorConfiguration); |
| + {% endfilter %}{# api_experiment_enabled() #} |
| {% endfilter %}{# runtime_enabled() #} |
| {% endfilter %}{# exposed() #} |
| {% endif %} |
| @@ -416,12 +435,16 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function |
| {% filter runtime_enabled(method.overloads.runtime_enabled_function_all |
| if method.overloads else |
| method.runtime_enabled_function) %} |
| + {% filter api_experiment_enabled(method.overloads.api_experiment_name_all |
| + if method.overloads else |
| + method.api_experiment_name) %} |
|
haraken
2015/12/18 02:35:51
It's not really nice that we have to duplicate cod
Daniel Nishi
2015/12/18 05:11:42
In code_generator_v8, I've shared the implementati
|
| {% if method.is_do_not_check_security %} |
| {{install_do_not_check_security_method(method, '', 'instanceTemplate', 'prototypeTemplate') | indent}} |
| {% else %}{# is_do_not_check_security #} |
| {% set signature = 'v8::Local<v8::Signature>()' if method.is_do_not_check_signature else 'defaultSignature' %} |
| {{install_custom_signature(method, 'instanceTemplate', 'prototypeTemplate', 'functionTemplate', signature) | indent}} |
| {% endif %}{# is_do_not_check_security #} |
| + {% endfilter %}{# api_experiment_enabled() #} |
| {% endfilter %}{# runtime_enabled() #} |
| {% endfilter %}{# exposed() #} |
| {% endfilter %}{# conditional() #} |