| 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);
|
| }
|
|
|