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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h

Issue 2640823004: Allow origin trials to be enabled by script (Closed)
Patch Set: Add tracking of installed features Created 3 years, 11 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/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*);

Powered by Google App Engine
This is Rietveld 408576698