| Index: third_party/WebKit/Source/core/workers/WorkerThread.h
|
| diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.h b/third_party/WebKit/Source/core/workers/WorkerThread.h
|
| index eba1dc13bc5ce66fc4567d55980072b57275afa6..e8c089f66482197f522ceb1764b142a2cdd12c0c 100644
|
| --- a/third_party/WebKit/Source/core/workers/WorkerThread.h
|
| +++ b/third_party/WebKit/Source/core/workers/WorkerThread.h
|
| @@ -33,10 +33,12 @@
|
| #include "core/frame/csp/ContentSecurityPolicy.h"
|
| #include "core/workers/ParentFrameTaskRunners.h"
|
| #include "core/workers/WorkerLoaderProxy.h"
|
| +#include "core/workers/WorkerTaskRunners.h"
|
| #include "core/workers/WorkerThreadLifecycleObserver.h"
|
| #include "platform/LifecycleNotifier.h"
|
| #include "platform/WaitableEvent.h"
|
| #include "platform/WebTaskRunner.h"
|
| +#include "platform/scheduler/child/worker_global_scope_scheduler.h"
|
| #include "platform/wtf/Forward.h"
|
| #include "platform/wtf/Functional.h"
|
| #include "platform/wtf/PassRefPtr.h"
|
| @@ -92,7 +94,6 @@ class CORE_EXPORT WorkerThreadLifecycleContext final
|
| // If the running task is for debugger, it's guaranteed to finish without
|
| // any interruptions.
|
| // - Queued tasks never run.
|
| -// - postTask() and appendDebuggerTask() reject posting new tasks.
|
| class CORE_EXPORT WorkerThread : public WebThread::TaskObserver {
|
| public:
|
| // Represents how this thread is terminated. Used for UMA. Append only.
|
| @@ -137,9 +138,6 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver {
|
| return worker_reporting_proxy_;
|
| }
|
|
|
| - void PostTask(const WebTraceLocation&, std::unique_ptr<WTF::Closure>);
|
| - void PostTask(const WebTraceLocation&,
|
| - std::unique_ptr<WTF::CrossThreadClosure>);
|
| void AppendDebuggerTask(std::unique_ptr<CrossThreadClosure>);
|
|
|
| // Runs only debugger tasks while paused in debugger.
|
| @@ -176,6 +174,14 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver {
|
| return parent_frame_task_runners_.Get();
|
| }
|
|
|
| + RefPtr<WorkerTaskRunners> GetWorkerTaskRunners() const {
|
| + return worker_task_runners_;
|
| + }
|
| +
|
| + scheduler::WorkerGlobalScopeScheduler* GetGlobalScopeScheduler() const {
|
| + return global_scope_scheduler_.get();
|
| + }
|
| +
|
| protected:
|
| WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&);
|
|
|
| @@ -243,13 +249,11 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver {
|
| // |m_threadStateMutex| acquired.
|
| void ForciblyTerminateExecution(const MutexLocker&, ExitCode);
|
|
|
| - // Returns true if termination or shutdown sequence has started. This is
|
| - // thread safe.
|
| - // Note that this returns false when the sequence has already started but it
|
| - // hasn't been notified to the calling thread.
|
| - bool IsInShutdown();
|
| + // Initializes a global scope. |global_scope_creation| event is signaled when
|
| + // a global scope is created.
|
| + void InitializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupData>,
|
| + WaitableEvent* global_scope_creation);
|
|
|
| - void InitializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupData>);
|
| void PrepareForShutdownOnWorkerThread();
|
| void PerformShutdownOnWorkerThread();
|
| template <WTF::FunctionThreadAffinity threadAffinity>
|
| @@ -294,7 +298,14 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver {
|
|
|
| RefPtr<WorkerLoaderProxy> worker_loader_proxy_;
|
| WorkerReportingProxy& worker_reporting_proxy_;
|
| +
|
| CrossThreadPersistent<ParentFrameTaskRunners> parent_frame_task_runners_;
|
| + RefPtr<WorkerTaskRunners> worker_task_runners_;
|
| +
|
| + // Tasks managed by this scheduler are canceled when the global scope is
|
| + // closed.
|
| + std::unique_ptr<scheduler::WorkerGlobalScopeScheduler>
|
| + global_scope_scheduler_;
|
|
|
| // This lock protects |m_globalScope|, |m_requestedToTerminate|,
|
| // |m_threadState|, |m_runningDebuggerTask| and |m_exitCode|.
|
|
|