summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/bindings/templates/origin_trial_features_for_core.cc.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/bindings/templates/origin_trial_features_for_core.cc.tmpl')
-rw-r--r--chromium/third_party/blink/renderer/bindings/templates/origin_trial_features_for_core.cc.tmpl118
1 files changed, 0 insertions, 118 deletions
diff --git a/chromium/third_party/blink/renderer/bindings/templates/origin_trial_features_for_core.cc.tmpl b/chromium/third_party/blink/renderer/bindings/templates/origin_trial_features_for_core.cc.tmpl
deleted file mode 100644
index 57f28d7ffb7..00000000000
--- a/chromium/third_party/blink/renderer/bindings/templates/origin_trial_features_for_core.cc.tmpl
+++ /dev/null
@@ -1,118 +0,0 @@
-{% filter format_blink_cpp_source_code %}
-
-{% include 'copyright_block.txt' %}
-
-#include "third_party/blink/renderer/bindings/core/v8/origin_trial_features_for_core.h"
-
-{% for include in includes %}
-#include "{{include}}"
-{% endfor %}
-
-namespace blink {
-
-namespace {
-InstallOriginTrialFeaturesFunction g_old_install_origin_trial_features_function =
- nullptr;
-InstallPendingOriginTrialFeatureFunction
- g_old_install_pending_origin_trial_feature_function = nullptr;
-
-void InstallOriginTrialFeaturesForCore(
- const WrapperTypeInfo* wrapper_type_info,
- const ScriptState* script_state,
- v8::Local<v8::Object> prototype_object,
- v8::Local<v8::Function> interface_object) {
- (*g_old_install_origin_trial_features_function)(
- wrapper_type_info, script_state, prototype_object, interface_object);
-
- ExecutionContext* execution_context = ExecutionContext::From(script_state);
- if (!execution_context)
- return;
- v8::Isolate* isolate = script_state->GetIsolate();
- const DOMWrapperWorld& world = script_state->World();
- // TODO(iclelland): Unify ContextFeatureSettings with the rest of the
- // conditional features.
- if (wrapper_type_info == V8Window::GetWrapperTypeInfo()) {
- auto* settings = ContextFeatureSettings::From(
- execution_context,
- ContextFeatureSettings::CreationMode::kDontCreateIfNotExists);
- if (settings && settings->isMojoJSEnabled()) {
- v8::Local<v8::Object> instance_object =
- script_state->GetContext()->Global();
- V8Window::InstallMojoJS(isolate, world, instance_object, prototype_object,
- interface_object);
- }
- }
- // TODO(iclelland): Extract this common code out of OriginTrialFeaturesForCore
- // and OriginTrialFeaturesForModules into a block.
- {% for interface in installers_by_interface %}
- if (wrapper_type_info == {{interface.v8_class}}::GetWrapperTypeInfo()) {
- {% if interface.is_global %}
- v8::Local<v8::Object> instance_object =
- script_state->GetContext()->Global();
- {% endif %}
- {% for installer in interface.installers %}
- if ({{installer.condition}}(execution_context)) {
- {{installer.v8_class_or_partial}}::{{installer.install_method}}(
- isolate, world, {% if interface.is_global %}instance_object{% else %}v8::Local<v8::Object>(){% endif %}, prototype_object, interface_object);
- }
- {% endfor %}
- }
- {% endfor %}
-}
-
-void InstallPendingOriginTrialFeatureForCore(OriginTrialFeature feature,
- const ScriptState* script_state) {
- (*g_old_install_pending_origin_trial_feature_function)(feature, script_state);
-
- // TODO(iclelland): Extract this common code out of OriginTrialFeaturesForCore
- // and OriginTrialFeaturesForModules into a block.
- {% if installers_by_feature %}
- v8::Local<v8::Object> prototype_object;
- v8::Local<v8::Function> interface_object;
- v8::Isolate* isolate = script_state->GetIsolate();
- const DOMWrapperWorld& world = script_state->World();
- V8PerContextData* context_data = script_state->PerContextData();
- v8::Local<v8::Context> current_context = script_state->GetContext();
- v8::Local<v8::Object> global_object = current_context->Global();
- ALLOW_UNUSED_LOCAL(global_object);
- ExecutionContext* execution_context = ToExecutionContext(current_context);
- ALLOW_UNUSED_LOCAL(execution_context);
- switch (feature) {
- {% for feature in installers_by_feature %}
- case {{feature.name_constant}}: {
- {% for installer in feature.installers %}
- {% if installer.interface_is_global %}
- if (execution_context && execution_context->{{installer.global_type_check_method}}()) {
- {{installer.v8_class_or_partial}}::{{installer.install_method}}(
- isolate, world, global_object, v8::Local<v8::Object>(), v8::Local<v8::Function>());
- }
- {% else %}
- if (context_data->GetExistingConstructorAndPrototypeForType(
- {{installer.v8_class}}::GetWrapperTypeInfo(), &prototype_object, &interface_object)) {
- {{installer.v8_class_or_partial}}::{{installer.install_method}}(
- isolate, world, v8::Local<v8::Object>(), prototype_object, interface_object);
- }
- {% endif %}
- {% endfor %}
- break;
- }
- {% endfor %}
- default:
- break;
- }
- {% endif %}
-}
-
-} // namespace
-
-void RegisterInstallOriginTrialFeaturesForCore() {
- g_old_install_origin_trial_features_function =
- SetInstallOriginTrialFeaturesFunction(&InstallOriginTrialFeaturesForCore);
- g_old_install_pending_origin_trial_feature_function =
- SetInstallPendingOriginTrialFeatureFunction(
- &InstallPendingOriginTrialFeatureForCore);
-}
-
-} // namespace blink
-
-{% endfilter %}{# format_blink_cpp_source_code #}