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

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

Issue 2367783003: Worker: Notify WorkerReportingProxy::didInitializeWorkerContext() immediately after initialization (Closed)
Patch Set: add comments 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 bd161ca57672b1763897b2e090e86518227c6747..f4a418626623b8341cf30cdc85e7bbf9f6e08290 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -497,7 +497,13 @@ void WorkerThread::initializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupD
m_workerReportingProxy.didCreateWorkerGlobalScope(globalScope());
m_workerInspectorController = WorkerInspectorController::create(this);
- globalScope()->scriptController()->initializeContextIfNeeded();
+ // TODO(nhiroki): Handle a case where the script controller fails to
+ // initialize the context.
+ if (globalScope()->scriptController()->initializeContextIfNeeded()) {
+ m_workerReportingProxy.didInitializeWorkerContext();
+ v8::HandleScope handleScope(isolate());
+ Platform::current()->workerContextCreated(globalScope()->scriptController()->context());
+ }
setThreadState(lock, ThreadState::Running);
}
@@ -513,12 +519,6 @@ void WorkerThread::initializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupD
return;
}
- if (globalScope()->scriptController()->isContextInitialized()) {
- m_workerReportingProxy.didInitializeWorkerContext();
- v8::HandleScope handleScope(isolate());
- Platform::current()->workerContextCreated(globalScope()->scriptController()->context());
- }
-
if (globalScope()->isWorkerGlobalScope()) {
WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(globalScope());
CachedMetadataHandler* handler = workerGlobalScope->createWorkerScriptCachedMetadataHandler(scriptURL, cachedMetaData.get());

Powered by Google App Engine
This is Rietveld 408576698