| 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..d8da5e4a5df375042379c522d010894562c4f527 100644
|
| --- a/third_party/WebKit/Source/core/workers/WorkerThread.h
|
| +++ b/third_party/WebKit/Source/core/workers/WorkerThread.h
|
| @@ -37,6 +37,7 @@
|
| #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 +93,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 +137,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 +173,10 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver {
|
| return parent_frame_task_runners_.Get();
|
| }
|
|
|
| + scheduler::WorkerGlobalScopeScheduler* GetGlobalScopeScheduler() const {
|
| + return global_scope_scheduler_.get();
|
| + }
|
| +
|
| protected:
|
| WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&);
|
|
|
| @@ -243,12 +244,7 @@ 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();
|
| -
|
| + void InitializeSchedulerOnWorkerThread(WaitableEvent*);
|
| void InitializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupData>);
|
| void PrepareForShutdownOnWorkerThread();
|
| void PerformShutdownOnWorkerThread();
|
| @@ -294,8 +290,14 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver {
|
|
|
| RefPtr<WorkerLoaderProxy> worker_loader_proxy_;
|
| WorkerReportingProxy& worker_reporting_proxy_;
|
| +
|
| CrossThreadPersistent<ParentFrameTaskRunners> parent_frame_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|.
|
| Mutex thread_state_mutex_;
|
|
|