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

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

Issue 2458183002: Eagerly install Origin Trial features on window (Closed)
Patch Set: Rebase before commit 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 fb45fcff2d457c0d57c2564ec07cdb1d42272382..4d27565472a3e86f951dfcc061ecfe6167567978 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);
}
bool OriginTrialContext::isTrialEnabled(const String& trialName) {
« 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