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

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

Issue 2456733002: DevTools: Make WorkerThreadDebugger available for Worklets (Closed)
Patch Set: address review comments Created 4 years, 1 month 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 3a7332a8a4e21786ab42e66192e3a5c695a291c1..4d516a1ed5c4c174476d5fe0641865425f7ffc5d 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -35,6 +35,7 @@
#include "core/inspector/WorkerInspectorController.h"
#include "core/inspector/WorkerThreadDebugger.h"
#include "core/origin_trials/OriginTrialContext.h"
+#include "core/workers/ThreadedWorkletGlobalScope.h"
#include "core/workers/WorkerBackingThread.h"
#include "core/workers/WorkerClients.h"
#include "core/workers/WorkerGlobalScope.h"
@@ -121,6 +122,13 @@ static HashSet<WorkerThread*>& workerThreads() {
return threads;
}
+static int getNextWorkerThreadId() {
+ DCHECK(isMainThread());
+ static int nextWorkerThreadId = 1;
+ CHECK_LT(nextWorkerThreadId, std::numeric_limits<int>::max());
+ return nextWorkerThreadId++;
+}
+
WorkerThreadLifecycleContext::WorkerThreadLifecycleContext() {
DCHECK(isMainThread());
}
@@ -334,7 +342,8 @@ bool WorkerThread::isForciblyTerminated() {
WorkerThread::WorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy,
WorkerReportingProxy& workerReportingProxy)
- : m_forceTerminationDelayInMs(kForceTerminationDelayInMs),
+ : m_workerThreadId(getNextWorkerThreadId()),
+ m_forceTerminationDelayInMs(kForceTerminationDelayInMs),
m_inspectorTaskRunner(wrapUnique(new InspectorTaskRunner())),
m_workerLoaderProxy(workerLoaderProxy),
m_workerReportingProxy(workerReportingProxy),
@@ -474,10 +483,6 @@ void WorkerThread::initializeOnWorkerThread(
if (isOwningBackingThread())
workerBackingThread().initialize();
-
- if (shouldAttachThreadDebugger())
- V8PerIsolateData::from(isolate())->setThreadDebugger(
- wrapUnique(new WorkerThreadDebugger(this, isolate())));
workerBackingThread().backingThread().addTaskObserver(this);
// Optimize for memory usage instead of latency for the worker isolate.
@@ -541,11 +546,11 @@ void WorkerThread::prepareForShutdownOnWorkerThread() {
InspectorInstrumentation::allAsyncTasksCanceled(globalScope());
globalScope()->notifyContextDestroyed();
- globalScope()->dispose();
if (m_workerInspectorController) {
m_workerInspectorController->dispose();
m_workerInspectorController.clear();
}
+ globalScope()->dispose();
m_consoleMessageStorage.clear();
workerBackingThread().backingThread().removeTaskObserver(this);
}

Powered by Google App Engine
This is Rietveld 408576698