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

Unified Diff: third_party/WebKit/Source/core/inspector/WorkerInspectorController.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/core/inspector/WorkerInspectorController.cpp
diff --git a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp
index 58de4e9b75f3d0178c283bacc31eb8c97c9f4b5d..ce8923e24e658f47dd2d778ddaa5b1b344c87785 100644
--- a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp
+++ b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp
@@ -50,23 +50,18 @@
namespace blink {
-WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGlobalScope)
+PassRefPtrWillBeRawPtr<WorkerInspectorController> WorkerInspectorController::create(WorkerGlobalScope* workerGlobalScope)
+{
+ WorkerThreadDebugger* debugger = WorkerThreadDebugger::from(workerGlobalScope->thread()->isolate());
+ return debugger ? adoptRefWillBeNoop(new WorkerInspectorController(workerGlobalScope, debugger->debugger(), debugger->contextGroupId())) : nullptr;
+}
+
+WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGlobalScope, V8Debugger* debugger, int contextGroupId)
: m_workerGlobalScope(workerGlobalScope)
, m_instrumentingAgents(InstrumentingAgents::create())
, m_agents(m_instrumentingAgents.get())
{
- v8::Isolate* isolate = workerGlobalScope->thread()->isolate();
- V8PerIsolateData* data = V8PerIsolateData::from(isolate);
-
- if (data->threadDebugger()) {
- ASSERT(data->threadDebugger()->isWorker());
- } else {
- data->setThreadDebugger(adoptPtr(new WorkerThreadDebugger(workerGlobalScope->thread(), isolate)));
- }
-
- V8Debugger* debugger = data->threadDebugger()->debugger();
-
- OwnPtrWillBeRawPtr<WorkerRuntimeAgent> workerRuntimeAgent = WorkerRuntimeAgent::create(debugger, workerGlobalScope, this, WorkerThreadDebugger::contextGroupId());
+ OwnPtrWillBeRawPtr<WorkerRuntimeAgent> workerRuntimeAgent = WorkerRuntimeAgent::create(debugger, workerGlobalScope, this, contextGroupId);
m_workerRuntimeAgent = workerRuntimeAgent.get();
m_agents.append(workerRuntimeAgent.release());
@@ -75,7 +70,7 @@ WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGl
m_agents.append(workerDebuggerAgent.release());
m_agents.append(InspectorProfilerAgent::create(debugger, 0));
- m_agents.append(InspectorHeapProfilerAgent::create(isolate, m_workerRuntimeAgent->v8Agent()));
+ m_agents.append(InspectorHeapProfilerAgent::create(workerGlobalScope->thread()->isolate(), m_workerRuntimeAgent->v8Agent()));
OwnPtrWillBeRawPtr<WorkerConsoleAgent> workerConsoleAgent = WorkerConsoleAgent::create(m_workerRuntimeAgent->v8Agent(), workerGlobalScope);
WorkerConsoleAgent* workerConsoleAgentPtr = workerConsoleAgent.get();

Powered by Google App Engine
This is Rietveld 408576698