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 7e559ae43d0eb6d0757b276e027fb41cf0a6ff5f..8311fbb5fca7fc5d590e6eea309f16f38e256c40 100644 |
| --- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp |
| +++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp |
| @@ -365,13 +365,17 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo |
| {##############################################################################} |
| {% block origin_trials %} |
| {% from 'attributes.cpp' import attribute_configuration with context %} |
| -{% for group in attributes|origin_trial_enabled_attributes|groupby('origin_trial_feature_name') %}{{newline}} |
| -void {{v8_class_or_partial}}::install{{group.grouper}}(ScriptState* scriptState, v8::Local<v8::Object> instance) |
| +{% from 'constants.cpp' import constant_configuration with context %} |
| +{% for origin_trial_feature_name in origin_trial_feature_names %}{{newline}} |
| +void {{v8_class_or_partial}}::install{{origin_trial_feature_name}}(ScriptState* scriptState, v8::Local<v8::Object> instance) |
| { |
| v8::Local<v8::Object> prototype = instance->GetPrototype()->ToObject(scriptState->isolate()); |
| - v8::Local<v8::Signature> signature; |
| - ALLOW_UNUSED_LOCAL(signature); |
| - {% for attribute in group.list | unique_by('name') | sort %} |
| + {# Origin-Trial-enabled attributes #} |
| + {% if attributes | for_origin_trial_feature(origin_trial_feature_name) %} |
| + V8PerIsolateData* perIsolateData = V8PerIsolateData::from(scriptState->isolate()); |
| + v8::Local<v8::FunctionTemplate> interfaceTemplate = perIsolateData->findInterfaceTemplate(scriptState->world(), &{{v8_class}}::wrapperTypeInfo); |
| + ALLOW_UNUSED_LOCAL(interfaceTemplate); |
| + {% for attribute in attributes | for_origin_trial_feature(origin_trial_feature_name) | unique_by('name') | sort %} |
| {% if attribute.is_data_type_property %} |
| const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = \ |
| {{attribute_configuration(attribute)}}; |
| @@ -379,9 +383,22 @@ void {{v8_class_or_partial}}::install{{group.grouper}}(ScriptState* scriptState, |
| {% else %} |
| const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration = \ |
| {{attribute_configuration(attribute)}}; |
| + v8::Local<v8::Signature> signature = v8::Signature::New(scriptState->isolate(), interfaceTemplate); |
|
Yuki
2016/06/17 05:37:47
You don't need to create |signature| every time in
iclelland
2016/06/17 06:08:49
Done.
|
| V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->world(), instance, prototype, v8::Local<v8::Function>(), signature, accessor{{attribute.name}}Configuration); |
| {% endif %} |
| {% endfor %} |
| + {% endif %} |
| + |
| + {# Origin-Trial-enabled constants #} |
| + {% if constants | for_origin_trial_feature(origin_trial_feature_name) %} |
| + V8PerContextData* perContextData = V8PerContextData::from(scriptState->context()); |
| + v8::Local<v8::Function> interface = perContextData->constructorForType(&{{v8_class}}::wrapperTypeInfo); |
| + {% for constant in constants | for_origin_trial_feature(origin_trial_feature_name) | unique_by('name') | sort %} |
| + {% set constant_name = constant.name.title().replace('_', '') %} |
| + const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Configuration = {{constant_configuration(constant)}}; |
| + V8DOMConfiguration::installConstant(scriptState->isolate(), interface, prototype, constant{{constant_name}}Configuration); |
| + {% endfor %} |
| + {% endif %} |
| } |
| {% endfor %} |
| {% endblock %} |