| Index: third_party/WebKit/Source/bindings/core/v8/ConditionalFeaturesForCore.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.cpp b/third_party/WebKit/Source/bindings/core/v8/ConditionalFeaturesForCore.cpp
|
| similarity index 67%
|
| copy from third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.cpp
|
| copy to third_party/WebKit/Source/bindings/core/v8/ConditionalFeaturesForCore.cpp
|
| index 2c2762a973f596f93d1302ac527f1701319bed3e..0f223d29a575075d9bf584695590bd0075fcca7d 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/ConditionalFeaturesForCore.cpp
|
| @@ -1,9 +1,10 @@
|
| -// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "bindings/core/v8/ConditionalFeatures.h"
|
| +#include "bindings/core/v8/ConditionalFeaturesForCore.h"
|
|
|
| +#include "bindings/core/v8/ConditionalFeatures.h"
|
| #include "bindings/core/v8/ScriptState.h"
|
| #include "bindings/core/v8/V8Document.h"
|
| #include "bindings/core/v8/V8HTMLLinkElement.h"
|
| @@ -15,10 +16,20 @@
|
|
|
| namespace blink {
|
|
|
| +namespace {
|
| +InstallConditionalFeaturesFunction s_oldInstallConditionalFeaturesFunction =
|
| + nullptr;
|
| +InstallPendingConditionalFeatureFunction
|
| + s_oldInstallPendingConditionalFeatureFunction = nullptr;
|
| +}
|
| +
|
| void installConditionalFeaturesCore(const WrapperTypeInfo* wrapperTypeInfo,
|
| const ScriptState* scriptState,
|
| v8::Local<v8::Object> prototypeObject,
|
| v8::Local<v8::Function> interfaceObject) {
|
| + (*s_oldInstallConditionalFeaturesFunction)(wrapperTypeInfo, scriptState,
|
| + prototypeObject, interfaceObject);
|
| +
|
| // TODO(iclelland): Generate all of this logic at compile-time, based on the
|
| // configuration of origin trial enabled attributes and interfaces in IDL
|
| // files. (crbug.com/615060)
|
| @@ -43,6 +54,8 @@ void installConditionalFeaturesCore(const WrapperTypeInfo* wrapperTypeInfo,
|
|
|
| void installPendingConditionalFeatureCore(const String& feature,
|
| const ScriptState* scriptState) {
|
| + (*s_oldInstallPendingConditionalFeatureFunction)(feature, scriptState);
|
| +
|
| // TODO(iclelland): Generate all of this logic at compile-time, based on the
|
| // configuration of origin trial enabled attributes and interfaces in IDL
|
| // files. (crbug.com/615060)
|
| @@ -71,61 +84,14 @@ void installPendingConditionalFeatureCore(const String& feature,
|
| }
|
| }
|
|
|
| -namespace {
|
| -
|
| -InstallConditionalFeaturesFunction s_installConditionalFeaturesFunction =
|
| - &installConditionalFeaturesCore;
|
| -
|
| -InstallPendingConditionalFeatureFunction
|
| - s_installPendingConditionalFeatureFunction =
|
| - &installPendingConditionalFeatureCore;
|
| -}
|
| -
|
| -InstallConditionalFeaturesFunction setInstallConditionalFeaturesFunction(
|
| - InstallConditionalFeaturesFunction newInstallConditionalFeaturesFunction) {
|
| - InstallConditionalFeaturesFunction originalFunction =
|
| - s_installConditionalFeaturesFunction;
|
| - s_installConditionalFeaturesFunction = newInstallConditionalFeaturesFunction;
|
| - return originalFunction;
|
| -}
|
| -
|
| -InstallPendingConditionalFeatureFunction
|
| -setInstallPendingConditionalFeatureFunction(
|
| - InstallPendingConditionalFeatureFunction
|
| - newInstallPendingConditionalFeatureFunction) {
|
| - InstallPendingConditionalFeatureFunction originalFunction =
|
| - s_installPendingConditionalFeatureFunction;
|
| - s_installPendingConditionalFeatureFunction =
|
| - newInstallPendingConditionalFeatureFunction;
|
| - return originalFunction;
|
| -}
|
| -
|
| -void installConditionalFeatures(const WrapperTypeInfo* type,
|
| - const ScriptState* scriptState,
|
| - v8::Local<v8::Object> prototypeObject,
|
| - v8::Local<v8::Function> interfaceObject) {
|
| - (*s_installConditionalFeaturesFunction)(type, scriptState, prototypeObject,
|
| - interfaceObject);
|
| -}
|
| -
|
| void installConditionalFeaturesOnWindow(const ScriptState* scriptState) {
|
| DCHECK(scriptState);
|
| DCHECK(scriptState->context() == scriptState->isolate()->GetCurrentContext());
|
| DCHECK(scriptState->perContextData());
|
| DCHECK(scriptState->world().isMainWorld());
|
| - (*s_installConditionalFeaturesFunction)(&V8Window::wrapperTypeInfo,
|
| - scriptState, v8::Local<v8::Object>(),
|
| - v8::Local<v8::Function>());
|
| -}
|
| -
|
| -void installPendingConditionalFeature(const String& feature,
|
| - const ScriptState* scriptState) {
|
| - DCHECK(scriptState);
|
| - DCHECK(scriptState->context() == scriptState->isolate()->GetCurrentContext());
|
| - DCHECK(scriptState->perContextData());
|
| - DCHECK(scriptState->world().isMainWorld());
|
| -
|
| - (*s_installPendingConditionalFeatureFunction)(feature, scriptState);
|
| + installConditionalFeatures(&V8Window::wrapperTypeInfo, scriptState,
|
| + v8::Local<v8::Object>(),
|
| + v8::Local<v8::Function>());
|
| }
|
|
|
| bool isFeatureEnabledInFrame(const FeaturePolicy::Feature& feature,
|
| @@ -146,4 +112,12 @@ bool isFeatureEnabledInFrame(const FeaturePolicy::Feature& feature,
|
| return featurePolicy->isFeatureEnabled(feature);
|
| }
|
|
|
| +void registerInstallConditionalFeaturesForCore() {
|
| + s_oldInstallConditionalFeaturesFunction =
|
| + setInstallConditionalFeaturesFunction(&installConditionalFeaturesCore);
|
| + s_oldInstallPendingConditionalFeatureFunction =
|
| + setInstallPendingConditionalFeatureFunction(
|
| + &installPendingConditionalFeatureCore);
|
| +}
|
| +
|
| } // namespace blink
|
|
|