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

Unified Diff: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl

Issue 2260113002: Lazily install origin trial features on V8 objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase after parent CL landed Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
index a12395f8db880b259bb4490915321789bb407aff..9bf2a24112c46b7c710ddba25cc199fa8500eb8a 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
@@ -396,43 +396,48 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo
{% from 'constants.cpp.tmpl' import constant_configuration with context %}
{% from 'methods.cpp.tmpl' import method_configuration with context %}
{% for origin_trial_feature in origin_trial_features %}{{newline}}
-void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* scriptState, v8::Local<v8::Object> instance)
+void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::Object> instance, v8::Local<v8::Object> prototype, v8::Local<v8::Function> interface)
{
{% if attributes | for_origin_trial_feature(origin_trial_feature.name) or
methods | method_for_origin_trial_feature(origin_trial_feature.name, is_partial) %}
- v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeInfo.domTemplate(scriptState->isolate(), scriptState->world());
- v8::Local<v8::Signature> signature = v8::Signature::New(scriptState->isolate(), interfaceTemplate);
+ v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeInfo.domTemplate(isolate, world);
+ v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
ALLOW_UNUSED_LOCAL(signature);
{% endif %}
- V8PerContextData* perContextData = V8PerContextData::from(scriptState->context());
- v8::Local<v8::Object> prototype = perContextData->prototypeForType(&{{v8_class}}::wrapperTypeInfo);
- v8::Local<v8::Function> interface = perContextData->constructorForType(&{{v8_class}}::wrapperTypeInfo);
- ALLOW_UNUSED_LOCAL(interface);
{# Origin-Trial-enabled attributes #}
{% 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)}};
- V8DOMConfiguration::installAttribute(scriptState->isolate(), scriptState->world(), instance, prototype, attribute{{attribute.name}}Configuration);
+ V8DOMConfiguration::installAttribute(isolate, world, instance, prototype, attribute{{attribute.name}}Configuration);
{% else %}
const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration = \
{{attribute_configuration(attribute)}};
- V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->world(), instance, prototype, interface, signature, accessor{{attribute.name}}Configuration);
+ V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, interface, signature, accessor{{attribute.name}}Configuration);
{% endif %}
{% endfor %}
{# Origin-Trial-enabled constants #}
{% 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);
+ V8DOMConfiguration::installConstant(isolate, interface, prototype, constant{{constant_name}}Configuration);
{% endfor %}
{# Origin-Trial-enabled methods (no overloads) #}
{% for method in methods | method_for_origin_trial_feature(origin_trial_feature.name, is_partial) | unique_by('name') | sort %}
{% set method_name = method.name.title().replace('_', '') %}
const V8DOMConfiguration::MethodConfiguration method{{method_name}}Configuration = {{method_configuration(method)}};
- V8DOMConfiguration::installMethod(scriptState->isolate(), scriptState->world(), instance, prototype, interface, signature, method{{method_name}}Configuration);
+ V8DOMConfiguration::installMethod(isolate, world, instance, prototype, interface, signature, method{{method_name}}Configuration);
{% endfor %}
}
+
+void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* scriptState, v8::Local<v8::Object> instance)
+{
+ V8PerContextData* perContextData = V8PerContextData::from(scriptState->context());
+ v8::Local<v8::Object> prototype = perContextData->prototypeForType(&{{v8_class}}::wrapperTypeInfo);
+ v8::Local<v8::Function> interface = perContextData->constructorForType(&{{v8_class}}::wrapperTypeInfo);
+ ALLOW_UNUSED_LOCAL(interface);
+ install{{origin_trial_feature.name}}(scriptState->isolate(), scriptState->world(), instance, prototype, interface);
+}
{% if not origin_trial_feature.needs_instance %}
void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* scriptState)

Powered by Google App Engine
This is Rietveld 408576698