From 067604a67d71013bb51b2ec8c8c900001f6a2370 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Wed, 11 May 2016 08:05:38 +0200 Subject: [PATCH] Bug 1268253 - MainThreadStopSyncLoopRunnable doesn't need to be exposed, r=khuey --- dom/workers/WorkerRunnable.cpp | 42 ++++++++++++++++++++++++++++++++++ dom/workers/WorkerRunnable.h | 42 ---------------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/dom/workers/WorkerRunnable.cpp b/dom/workers/WorkerRunnable.cpp index e02796bcbc75..f758b63c9bde 100644 --- a/dom/workers/WorkerRunnable.cpp +++ b/dom/workers/WorkerRunnable.cpp @@ -31,6 +31,48 @@ const nsIID kWorkerRunnableIID = { 0x320cc0b5, 0xef12, 0x4084, { 0x88, 0x6e, 0xca, 0x6a, 0x81, 0xe4, 0x1d, 0x68 } }; +// This runnable is used to stop a sync loop and it's meant to be used on the +// main-thread only. As sync loops keep the busy count incremented as long as +// they run this runnable does not modify the busy count +// in any way. +class MainThreadStopSyncLoopRunnable : public WorkerSyncRunnable +{ + bool mResult; + +public: + // Passing null for aSyncLoopTarget is not allowed. + MainThreadStopSyncLoopRunnable( + WorkerPrivate* aWorkerPrivate, + already_AddRefed&& aSyncLoopTarget, + bool aResult); + + // By default StopSyncLoopRunnables cannot be canceled since they could leave + // a sync loop spinning forever. + nsresult + Cancel() override; + +protected: + virtual ~MainThreadStopSyncLoopRunnable() + { } + +private: + virtual bool + PreDispatch(WorkerPrivate* aWorkerPrivate) override final + { + AssertIsOnMainThread(); + return true; + } + + virtual void + PostDispatch(WorkerPrivate* aWorkerPrivate, bool aDispatchResult) override; + + virtual bool + WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override; + + virtual bool + DispatchInternal() override final; +}; + } // namespace #ifdef DEBUG diff --git a/dom/workers/WorkerRunnable.h b/dom/workers/WorkerRunnable.h index fb81362cf940..318780fd870f 100644 --- a/dom/workers/WorkerRunnable.h +++ b/dom/workers/WorkerRunnable.h @@ -264,48 +264,6 @@ private: PostDispatch(WorkerPrivate* aWorkerPrivate, bool aDispatchResult) override; }; -// This runnable is used to stop a sync loop and it's meant to be used on the -// main-thread only. As sync loops keep the busy count incremented as long as -// they run this runnable does not modify the busy count -// in any way. -class MainThreadStopSyncLoopRunnable : public WorkerSyncRunnable -{ - bool mResult; - -public: - // Passing null for aSyncLoopTarget is not allowed. - MainThreadStopSyncLoopRunnable( - WorkerPrivate* aWorkerPrivate, - already_AddRefed&& aSyncLoopTarget, - bool aResult); - - // By default StopSyncLoopRunnables cannot be canceled since they could leave - // a sync loop spinning forever. - nsresult - Cancel() override; - -protected: - virtual ~MainThreadStopSyncLoopRunnable() - { } - -private: - virtual bool - PreDispatch(WorkerPrivate* aWorkerPrivate) override final - { - AssertIsOnMainThread(); - return true; - } - - virtual void - PostDispatch(WorkerPrivate* aWorkerPrivate, bool aDispatchResult) override; - - virtual bool - WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override; - - virtual bool - DispatchInternal() override final; -}; - // This runnable is processed as soon as it is received by the worker, // potentially running before previously queued runnables and perhaps even with // other JS code executing on the stack. These runnables must not alter the