| Index: Source/core/workers/WorkerThread.h
|
| diff --git a/Source/core/workers/WorkerThread.h b/Source/core/workers/WorkerThread.h
|
| index d9bd49b952000d06cc50138b92223b7815c46e40..7f1058ff12af7eba1ede46341e2b8e315af14aa1 100644
|
| --- a/Source/core/workers/WorkerThread.h
|
| +++ b/Source/core/workers/WorkerThread.h
|
| @@ -47,7 +47,6 @@ class WebWaitableEvent;
|
| class WorkerGlobalScope;
|
| class WorkerInspectorController;
|
| class WorkerReportingProxy;
|
| -class WorkerSharedTimer;
|
| class WorkerThreadShutdownFinishTask;
|
| class WorkerThreadStartupData;
|
| class WorkerThreadTask;
|
| @@ -98,8 +97,13 @@ public:
|
| void willEnterNestedLoop();
|
| void didLeaveNestedLoop();
|
|
|
| + // Prevent execution of all non-shutdown tasks.
|
| + void preShutdown();
|
| +
|
| WorkerGlobalScope* workerGlobalScope() const { return m_workerGlobalScope.get(); }
|
| - bool terminated();
|
| +
|
| + // Virtual for testing.
|
| + virtual bool terminated();
|
|
|
| // Number of active worker threads.
|
| static unsigned workerThreadCount();
|
| @@ -122,8 +126,21 @@ protected:
|
| virtual void destroyIsolate();
|
| virtual void terminateV8Execution();
|
|
|
| + // This is protected virtual for testing.
|
| + virtual bool doIdleGc(double deadlineSeconds);
|
| +
|
| + WebScheduler* schedulerForTesting() const
|
| + {
|
| + return m_webScheduler;
|
| + }
|
| +
|
| + WebThreadSupportingGC* threadForTesting() const
|
| + {
|
| + return m_thread.get();
|
| + }
|
| +
|
| private:
|
| - friend class WorkerSharedTimer;
|
| + friend class WorkerThreadIdleTask;
|
| friend class WorkerThreadShutdownFinishTask;
|
|
|
| void stopInShutdownSequence();
|
| @@ -131,7 +148,7 @@ private:
|
|
|
| void initialize();
|
| void cleanup();
|
| - void idleHandler();
|
| + void idleTask(double deadlineSeconds);
|
| void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs);
|
| void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>, long long delayMs);
|
|
|
| @@ -159,6 +176,11 @@ private:
|
| // Used to signal thread termination.
|
| OwnPtr<WebWaitableEvent> m_terminationEvent;
|
|
|
| + RawPtr<WebScheduler> m_webScheduler; // NOT OWNED.
|
| +
|
| + Mutex m_preShutdownMutex;
|
| + bool m_preShutdown;
|
| +
|
| // FIXME: This has to be last because of crbug.com/401397 - the
|
| // WorkerThread might get deleted before it had a chance to properly
|
| // shut down. By deleting the WebThread first, we can guarantee that
|
|
|