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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp

Issue 1838523004: Initialize debugger together with isolate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed unnecessary assert hitting in unit tests Created 4 years, 9 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/bindings/core/v8/WorkerOrWorkletScriptController.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp
index 5e4d01f1e997ac1f49ef808f9c2573227a449b93..4e3054e56675fe4d2376b6ee89e67456c31fc3f4 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp
@@ -131,8 +131,22 @@ void WorkerOrWorkletScriptController::dispose()
m_world->dispose();
- if (isContextInitialized())
- m_scriptState->disposePerContextData();
+ disposeContextIfNeeded();
+}
+
+void WorkerOrWorkletScriptController::disposeContextIfNeeded()
+{
+ if (!isContextInitialized())
+ return;
+
+ if (m_globalScope->isWorkerGlobalScope()) {
+ WorkerThreadDebugger* debugger = WorkerThreadDebugger::from(m_isolate);
+ if (debugger) {
+ ScriptState::Scope scope(m_scriptState.get());
+ debugger->contextWillBeDestroyed(m_scriptState->context());
+ }
+ }
+ m_scriptState->disposePerContextData();
}
bool WorkerOrWorkletScriptController::initializeContextIfNeeded()
@@ -153,7 +167,9 @@ bool WorkerOrWorkletScriptController::initializeContextIfNeeded()
// Name new context for debugging. For main thread worklet global scopes
// this is done once the context is initialized.
if (m_globalScope->isWorkerGlobalScope()) {
- WorkerThreadDebugger::setContextDebugData(context);
+ WorkerThreadDebugger* debugger = WorkerThreadDebugger::from(m_isolate);
+ if (debugger)
+ debugger->contextCreated(context);
}
// Create a new JS object and use it as the prototype for the shadow global object.
@@ -165,7 +181,7 @@ bool WorkerOrWorkletScriptController::initializeContextIfNeeded()
v8::Local<v8::Object> jsGlobalScope;
if (!V8ObjectConstructor::newInstance(m_isolate, globalScopeConstructor).ToLocal(&jsGlobalScope)) {
- m_scriptState->disposePerContextData();
+ disposeContextIfNeeded();
return false;
}

Powered by Google App Engine
This is Rietveld 408576698