diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/workers/worker_thread.h')
-rw-r--r-- | chromium/third_party/blink/renderer/core/workers/worker_thread.h | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/chromium/third_party/blink/renderer/core/workers/worker_thread.h b/chromium/third_party/blink/renderer/core/workers/worker_thread.h index b87706015e4..aa25d12ae00 100644 --- a/chromium/third_party/blink/renderer/core/workers/worker_thread.h +++ b/chromium/third_party/blink/renderer/core/workers/worker_thread.h @@ -32,6 +32,7 @@ #include "base/memory/scoped_refptr.h" #include "base/optional.h" #include "base/single_thread_task_runner.h" +#include "base/synchronization/waitable_event.h" #include "base/thread_annotations.h" #include "base/unguessable_token.h" #include "services/network/public/mojom/fetch_api.mojom-shared.h" @@ -39,14 +40,10 @@ #include "third_party/blink/public/platform/web_thread_type.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" -#include "third_party/blink/renderer/core/loader/threadable_loading_context.h" #include "third_party/blink/renderer/core/workers/parent_execution_context_task_runners.h" #include "third_party/blink/renderer/core/workers/worker_backing_thread_startup_data.h" #include "third_party/blink/renderer/core/workers/worker_inspector_proxy.h" -#include "third_party/blink/renderer/core/workers/worker_thread_lifecycle_context.h" -#include "third_party/blink/renderer/core/workers/worker_thread_lifecycle_observer.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h" -#include "third_party/blink/renderer/platform/waitable_event.h" #include "third_party/blink/renderer/platform/web_task_runner.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/functional.h" @@ -151,9 +148,6 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver { bool IsCurrentThread(); - // Called on the worker thread. - ThreadableLoadingContext* GetLoadingContext(); - WorkerReportingProxy& GetWorkerReportingProxy() const { return worker_reporting_proxy_; } @@ -175,12 +169,6 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver { WorkerOrWorkletGlobalScope* GlobalScope(); WorkerInspectorController* GetWorkerInspectorController(); - // Called for creating WorkerThreadLifecycleObserver on both the main thread - // and the worker thread. - WorkerThreadLifecycleContext* GetWorkerThreadLifecycleContext() const { - return worker_thread_lifecycle_context_; - } - // Number of active worker threads. static unsigned WorkerThreadCount(); @@ -194,7 +182,7 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver { bool IsForciblyTerminated() LOCKS_EXCLUDED(mutex_); - void WaitForShutdownForTesting() { shutdown_event_->Wait(); } + void WaitForShutdownForTesting(); ExitCode GetExitCodeForTesting() LOCKS_EXCLUDED(mutex_); ParentExecutionContextTaskRunners* GetParentExecutionContextTaskRunners() @@ -222,7 +210,7 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver { void ChildThreadTerminatedOnWorkerThread(WorkerThread*); protected: - WorkerThread(ThreadableLoadingContext*, WorkerReportingProxy&); + explicit WorkerThread(WorkerReportingProxy&); virtual WebThreadType GetThreadType() const = 0; @@ -274,7 +262,7 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver { void EnsureScriptExecutionTerminates(ExitCode) LOCKS_EXCLUDED(mutex_); // These are called in this order during worker thread startup. - void InitializeSchedulerOnWorkerThread(WaitableEvent*); + void InitializeSchedulerOnWorkerThread(base::WaitableEvent*); void InitializeOnWorkerThread( std::unique_ptr<GlobalScopeCreationParams>, const base::Optional<WorkerBackingThreadStartupData>&, @@ -317,10 +305,6 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver { scoped_refptr<InspectorTaskRunner> inspector_task_runner_; const base::UnguessableToken devtools_worker_token_; - // Created on the main thread, passed to the worker thread but should kept - // being accessed only on the main thread. - CrossThreadPersistent<ThreadableLoadingContext> loading_context_; - WorkerReportingProxy& worker_reporting_proxy_; CrossThreadPersistent<ParentExecutionContextTaskRunners> @@ -339,18 +323,16 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver { CrossThreadPersistent<WorkerOrWorkletGlobalScope> global_scope_; CrossThreadPersistent<WorkerInspectorController> worker_inspector_controller_; - // Signaled when the thread completes termination on the worker thread. - std::unique_ptr<WaitableEvent> shutdown_event_; + // Signaled when the thread completes termination on the worker thread. Only + // the parent context thread should wait on this event after calling + // Terminate(). + class RefCountedWaitableEvent; + scoped_refptr<RefCountedWaitableEvent> shutdown_event_; // Used to cancel a scheduled forcible termination task. See // mayForciblyTerminateExecution() for details. TaskHandle forcible_termination_task_handle_; - // Created on the main thread heap, but will be accessed cross-thread - // when worker thread posts tasks. - CrossThreadPersistent<WorkerThreadLifecycleContext> - worker_thread_lifecycle_context_; - HashSet<WorkerThread*> child_threads_; THREAD_CHECKER(parent_thread_checker_); |