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

Unified Diff: third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl

Issue 1743623002: [Experimental Framework] Make the OriginTrialContext a member of ExecutionContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use WeakPersistent for Oilpan Created 4 years, 10 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/build/scripts/templates/OriginTrials.cpp.tmpl
diff --git a/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl
index 37c260202720e13c49461aae64b4ca2d6012fc3d..e105435344c95060d572ed06a7fcf29e7fd560bc 100644
--- a/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl
+++ b/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl
@@ -3,21 +3,28 @@
#include "core/origin_trials/OriginTrials.h"
+#include "core/dom/ExecutionContext.h"
#include "core/origin_trials/OriginTrialContext.h"
#include "platform/RuntimeEnabledFeatures.h"
namespace blink {
+
+OriginTrials::OriginTrials(OriginTrialContext* originTrialContext) : m_originTrialContext(originTrialContext) {}
+
{% for feature in features %}
{% if feature.origin_trial_feature_name %}
// static
bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* executionContext, String& errorMessage) {
- return {{feature.first_lowered_name}}EnabledImpl(executionContext, &errorMessage);
+ return executionContext->originTrials()->{{feature.first_lowered_name}}Enabled(errorMessage);
}
-// static
-bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* executionContext) {
- return {{feature.first_lowered_name}}EnabledImpl(executionContext, nullptr);
+bool OriginTrials::{{feature.first_lowered_name}}Enabled(String& errorMessage) {
+ return {{feature.first_lowered_name}}EnabledImpl(&errorMessage);
+}
+
+bool OriginTrials::{{feature.first_lowered_name}}Enabled() {
+ return {{feature.first_lowered_name}}EnabledImpl(nullptr);
}
{% endif %}
{% endfor %}
@@ -25,11 +32,11 @@ bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu
{% for feature in features %}
{% if feature.origin_trial_feature_name %}
-// static
-bool OriginTrials::{{feature.first_lowered_name}}EnabledImpl(ExecutionContext* executionContext, String* errorMessage) {
+bool OriginTrials::{{feature.first_lowered_name}}EnabledImpl(String* errorMessage) {
if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled())
return true;
- return OriginTrialContext::isFeatureEnabled(executionContext, "{{feature.origin_trial_feature_name}}", errorMessage);
+ if (!m_originTrialContext) return false;
+ return m_originTrialContext->isFeatureEnabled("{{feature.origin_trial_feature_name}}", errorMessage);
}
{% endif %}
{% endfor %}

Powered by Google App Engine
This is Rietveld 408576698