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

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

Issue 2337003002: Worker: Notify WorkerThread lifecycle events via WorkerReportingProxy (Closed)
Patch Set: fix tests Created 4 years, 3 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 9c58a3545d799b01847495ef26bb4eb3e22080cb..b7fd490c6fa03403314436cdca4d951309f45ef3 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -519,23 +519,21 @@ void WorkerThread::initializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupD
m_consoleMessageStorage = new ConsoleMessageStorage();
m_globalScope = createWorkerGlobalScope(std::move(startupData));
m_workerInspectorController = WorkerInspectorController::create(this);
- if (globalScope()->isWorkerGlobalScope())
- toWorkerGlobalScope(globalScope())->scriptLoaded(sourceCode.length(), cachedMetaData.get() ? cachedMetaData->size() : 0);
// Notify proxy that a new WorkerOrWorkletGlobalScope has been created
// and started.
m_workerReportingProxy.workerGlobalScopeStarted(globalScope());
- WorkerOrWorkletScriptController* scriptController = globalScope()->scriptController();
- if (!scriptController->isExecutionForbidden()) {
- scriptController->initializeContextIfNeeded();
+ if (globalScope()->isWorkerGlobalScope())
+ m_workerReportingProxy.didLoadWorkerScript(sourceCode.length(), cachedMetaData.get() ? cachedMetaData->size() : 0);
+
+ globalScope()->scriptController()->initializeContextIfNeeded();
- // If Origin Trials have been registered before the V8 context was ready,
- // then inject them into the context now
- OriginTrialContext* originTrialContext = OriginTrialContext::from(globalScope());
- if (originTrialContext)
- originTrialContext->initializePendingFeatures();
- }
+ // If Origin Trials have been registered before the V8 context was ready,
+ // then inject them into the context now
+ OriginTrialContext* originTrialContext = OriginTrialContext::from(globalScope());
+ if (originTrialContext)
+ originTrialContext->initializePendingFeatures();
setThreadState(lock, ThreadState::Running);
}
@@ -560,7 +558,6 @@ void WorkerThread::initializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupD
WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(globalScope());
CachedMetadataHandler* handler = workerGlobalScope->createWorkerScriptCachedMetadataHandler(scriptURL, cachedMetaData.get());
bool success = workerGlobalScope->scriptController()->evaluate(ScriptSourceCode(sourceCode, scriptURL), nullptr, handler, v8CacheOptions);
- workerGlobalScope->didEvaluateWorkerScript();
m_workerReportingProxy.didEvaluateWorkerScript(success);
}
}

Powered by Google App Engine
This is Rietveld 408576698