Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h b/third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h |
| index 0c9a6040f5926955d921af4e7dd5f5d96e57caba..024755c4706159a6ce39d5b3a14329883a4c7c17 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h |
| +++ b/third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h |
| @@ -8,6 +8,7 @@ |
| #include "bindings/core/v8/DOMWrapperWorld.h" |
| #include "core/CoreExport.h" |
| #include "platform/feature_policy/FeaturePolicy.h" |
| +#include "wtf/HashSet.h" |
| #include <v8.h> |
| namespace blink { |
| @@ -20,6 +21,12 @@ using InstallConditionalFeaturesFunction = void (*)(const WrapperTypeInfo*, |
| v8::Local<v8::Object>, |
| v8::Local<v8::Function>); |
| +using InstallConditionalFeaturesIfNeededFunction = |
| + bool (*)(const WrapperTypeInfo*, const ScriptState*); |
| + |
| +using GetAffectedTypesForConditionalFeatureFunction = |
| + void (*)(const String&, HashSet<const WrapperTypeInfo*>*); |
| + |
| // Installs all of the conditionally enabled V8 bindings for the given type, in |
| // a specific context. This is called in V8PerContextData, after the constructor |
| // and prototype for the type have been created. It indirectly calls the |
| @@ -35,6 +42,12 @@ CORE_EXPORT void installConditionalFeatures(const WrapperTypeInfo*, |
| // function is returned, so that functions can be chained. |
| CORE_EXPORT InstallConditionalFeaturesFunction |
| setInstallConditionalFeaturesFunction(InstallConditionalFeaturesFunction); |
| +CORE_EXPORT InstallConditionalFeaturesIfNeededFunction |
|
iclelland
2017/01/20 14:31:19
One way to get rid of the three parallel function
chasej
2017/01/25 19:58:20
I've simplified the approach, so that there's only
|
| + setInstallConditionalFeaturesIfNeededFunction( |
| + InstallConditionalFeaturesIfNeededFunction); |
| +CORE_EXPORT GetAffectedTypesForConditionalFeatureFunction |
| + setGetAffectedTypesForConditionalFeatureFunction( |
| + GetAffectedTypesForConditionalFeatureFunction); |
| // Installs all of the conditionally enabled V8 bindings on the Window object. |
| // This is called separately from other objects so that attributes and |
| @@ -42,6 +55,16 @@ CORE_EXPORT InstallConditionalFeaturesFunction |
| // when the V8 context is reused (i.e., after navigation) |
| CORE_EXPORT void installPendingConditionalFeaturesOnWindow(const ScriptState*); |
| +// Installs all of the conditionally enabled V8 bindings for a feature, if |
| +// needed. This is called to install a newly-enabled feature on any existing |
| +// objects. If the target object hasn't been created, nothing is installed. The |
| +// enabled feature will be instead be installed when the object is created |
| +// (avoids forcing the creation of objects prematurely). |
| +// Returns true to indicate the feature is installed (either on existing objects |
| +// or deferred until object creation). |
|
iclelland
2017/01/20 14:31:19
I'm confused about what returning false from this
chasej
2017/01/25 19:58:20
You're right. Ultimately, this function should nev
|
| +CORE_EXPORT bool installPendingConditionalFeature(const ScriptState*, |
| + const String&); |
| + |
| CORE_EXPORT bool isFeatureEnabledInFrame(const FeaturePolicy::Feature&, |
| const LocalFrame*); |