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

Unified Diff: third_party/WebKit/Source/core/workers/WorkerThread.cpp

Issue 2005433002: [Origin Trials] Install origin trial bindings on V8 context conditionally (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-ef-install
Patch Set: Clean up Created 4 years, 7 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/core/workers/WorkerThread.cpp
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
index 09d432d27e07d2e84d786d659f64ba7650f45ca3..3df140c7362ec736053bd73ae7e565ecc1c62bbb 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -33,6 +33,7 @@
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorTaskRunner.h"
#include "core/inspector/WorkerThreadDebugger.h"
+#include "core/origin_trials/OriginTrialContext.h"
#include "core/workers/WorkerBackingThread.h"
#include "core/workers/WorkerClients.h"
#include "core/workers/WorkerReportingProxy.h"
@@ -345,8 +346,18 @@ void WorkerThread::initializeOnWorkerThread(PassOwnPtr<WorkerThreadStartupData>
m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get());
WorkerOrWorkletScriptController* scriptController = m_workerGlobalScope->scriptController();
- if (!scriptController->isExecutionForbidden())
+ if (!scriptController->isExecutionForbidden()) {
scriptController->initializeContextIfNeeded();
+
+ // If Origin Trials have been registered before the V8 context was ready,
haraken 2016/05/27 00:01:42 I'm just curious but how can we enable origin-tria
iclelland 2016/05/27 03:19:43 Yes, all resources can now be sent with an HTTP he
+ // then inject them into the context now
+ ExecutionContext* executionContext = m_workerGlobalScope->getExecutionContext();
+ if (executionContext) {
+ OriginTrialContext* originTrialContext = OriginTrialContext::from(executionContext);
+ if (originTrialContext)
+ originTrialContext->initializePendingTrials();
+ }
+ }
}
if (startMode == PauseWorkerGlobalScopeOnStart)

Powered by Google App Engine
This is Rietveld 408576698