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

Unified Diff: third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp

Issue 2473413002: Eagerly install Origin Trial features on window. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp
diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp
index 0cd5c760d4981e9ca767440915446240f9eac384..d201fe3dc0a861fe143ac6984921954952326f89 100644
--- a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp
+++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp
@@ -158,6 +158,7 @@ void OriginTrialContext::addToken(const String& token) {
m_tokens.append(token);
validateToken(token);
}
+ initializePendingFeatures();
}
void OriginTrialContext::addTokens(const Vector<String>& tokens) {
@@ -167,6 +168,22 @@ void OriginTrialContext::addTokens(const Vector<String>& tokens) {
validateToken(token);
}
}
+ initializePendingFeatures();
+}
+
+void OriginTrialContext::initializePendingFeatures() {
+ if (!m_host->isDocument())
+ return;
+ LocalFrame* frame = toDocument(m_host.get())->frame();
+ if (!frame)
+ return;
+ ScriptState* scriptState = ScriptState::forMainWorld(frame);
+ if (!scriptState)
+ return;
+ if (!scriptState->contextIsValid())
+ return;
+ ScriptState::Scope scope(scriptState);
+ installPendingConditionalFeaturesOnWindow(scriptState);
}
void OriginTrialContext::setFeatureBindingsInstalled(
« no previous file with comments | « third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698