From e8988473690440cba1e80495fac560d2675507e6 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Thu, 8 Feb 2018 09:33:34 +0100 Subject: [PATCH] Bug 1435263 - Get rid of WorkerPrivateParent template - part 14 - MaybeWrapAsWorkerRunnable and ProxyReleaseMainThreadObjects, r=bkelly --- dom/workers/WorkerPrivate.cpp | 22 ++++++++-------------- dom/workers/WorkerPrivate.h | 12 ++++++------ 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 12cf5bfa2857..c01b39d58f7e 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -1719,9 +1719,8 @@ WorkerPrivateParent::DispatchDebuggerRunnable( return NS_OK; } -template already_AddRefed -WorkerPrivateParent::MaybeWrapAsWorkerRunnable(already_AddRefed aRunnable) +WorkerPrivate::MaybeWrapAsWorkerRunnable(already_AddRefed aRunnable) { // May be called on any thread! @@ -1739,8 +1738,7 @@ WorkerPrivateParent::MaybeWrapAsWorkerRunnable(already_AddRefed bool -WorkerPrivateParent::ProxyReleaseMainThreadObjects() +WorkerPrivate::ProxyReleaseMainThreadObjects() { AssertIsOnParentThread(); - - WorkerPrivate* self = ParentAsWorkerPrivate(); - MOZ_ASSERT(!self->mMainThreadObjectsForgotten); + MOZ_ASSERT(!mMainThreadObjectsForgotten); nsCOMPtr loadGroupToCancel; // If we're not overriden, then do nothing here. Let the load group get // handled in ForgetMainThreadObjects(). - if (self->mLoadInfo.mInterfaceRequestor) { - self->mLoadInfo.mLoadGroup.swap(loadGroupToCancel); + if (mLoadInfo.mInterfaceRequestor) { + mLoadInfo.mLoadGroup.swap(loadGroupToCancel); } - bool result = self->mLoadInfo.ProxyReleaseMainThreadObjects(self, - loadGroupToCancel); + bool result = mLoadInfo.ProxyReleaseMainThreadObjects(this, loadGroupToCancel); - self->mMainThreadObjectsForgotten = true; + mMainThreadObjectsForgotten = true; return result; } diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index 8741bc04c5c7..16e1397ad4fe 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -155,12 +155,6 @@ public: nsresult DispatchDebuggerRunnable(already_AddRefed aDebuggerRunnable); - already_AddRefed - MaybeWrapAsWorkerRunnable(already_AddRefed aRunnable); - - bool - ProxyReleaseMainThreadObjects(); - void UpdateContextOptions(const JS::ContextOptions& aContextOptions); @@ -1382,6 +1376,12 @@ public: void DisableDebugger(); + already_AddRefed + MaybeWrapAsWorkerRunnable(already_AddRefed aRunnable); + + bool + ProxyReleaseMainThreadObjects(); + private: WorkerPrivate(WorkerPrivate* aParent, const nsAString& aScriptURL, bool aIsChromeWorker,