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

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

Issue 2201623002: [DevTools] Move WorkerInspectorController to WorkerThread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@can-execute-scripts
Patch Set: rebased Created 4 years, 4 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 a1f892df5de8aec53099a0f52ce49ad0e0508b66..a65ac1332f872d3b5ea5ada1b73952c5962c55fd 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -33,6 +33,7 @@
#include "bindings/core/v8/WorkerOrWorkletScriptController.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorTaskRunner.h"
+#include "core/inspector/WorkerInspectorController.h"
#include "core/inspector/WorkerThreadDebugger.h"
#include "core/origin_trials/OriginTrialContext.h"
#include "core/workers/WorkerBackingThread.h"
@@ -270,6 +271,8 @@ void WorkerThread::appendDebuggerTask(std::unique_ptr<CrossThreadClosure> task)
void WorkerThread::startRunningDebuggerTasksOnPauseOnWorkerThread()
{
DCHECK(isCurrentThread());
+ if (m_workerInspectorController)
+ m_workerInspectorController->flushProtocolNotifications();
m_pausedInDebugger = true;
ThreadDebugger::idleStarted(isolate());
std::unique_ptr<CrossThreadClosure> task;
@@ -297,6 +300,12 @@ WorkerOrWorkletGlobalScope* WorkerThread::globalScope()
return m_globalScope.get();
}
+WorkerInspectorController* WorkerThread::workerInspectorController()
+{
+ DCHECK(isCurrentThread());
+ return m_workerInspectorController.get();
+}
+
bool WorkerThread::terminated()
{
MutexLocker lock(m_threadStateMutex);
@@ -484,6 +493,7 @@ void WorkerThread::initializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupD
// Optimize for memory usage instead of latency for the worker isolate.
isolate()->IsolateInBackgroundNotification();
m_globalScope = createWorkerGlobalScope(std::move(startupData));
+ m_workerInspectorController = WorkerInspectorController::create(this);
if (m_globalScope->isWorkerGlobalScope())
toWorkerGlobalScope(m_globalScope)->scriptLoaded(sourceCode.length(), cachedMetaData.get() ? cachedMetaData->size() : 0);
@@ -549,6 +559,10 @@ void WorkerThread::prepareForShutdownOnWorkerThread()
workerReportingProxy().willDestroyWorkerGlobalScope();
InspectorInstrumentation::allAsyncTasksCanceled(globalScope());
globalScope()->dispose();
+ if (m_workerInspectorController) {
+ m_workerInspectorController->dispose();
+ m_workerInspectorController.clear();
+ }
workerBackingThread().backingThread().removeTaskObserver(m_microtaskRunner.get());
}
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkerThread.h ('k') | third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698