From 5a4303000db652085286f5e12ffda8f4b21934f7 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Wed, 14 Mar 2018 15:25:47 +0100 Subject: [PATCH] Bug 1445540 - Use IsCurrentThreadRunningWorker() instead of GetCurrentThreadWorkerPrivate() in dom/base and dom/promise, r=smaug --- dom/base/ImageEncoder.cpp | 2 +- dom/promise/Promise.cpp | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/dom/base/ImageEncoder.cpp b/dom/base/ImageEncoder.cpp index bd7948e12844..befc9889725b 100644 --- a/dom/base/ImageEncoder.cpp +++ b/dom/base/ImageEncoder.cpp @@ -89,7 +89,7 @@ public: , mEncodeCompleteCallback(aEncodeCompleteCallback) , mFailed(false) { - if (!NS_IsMainThread() && GetCurrentThreadWorkerPrivate()) { + if (!NS_IsMainThread() && IsCurrentThreadRunningWorker()) { mCreationEventTarget = GetCurrentThreadEventTarget(); } else { mCreationEventTarget = GetMainThreadEventTarget(); diff --git a/dom/promise/Promise.cpp b/dom/promise/Promise.cpp index d259d6cedfcb..8a96d10c064b 100644 --- a/dom/promise/Promise.cpp +++ b/dom/promise/Promise.cpp @@ -646,11 +646,8 @@ PromiseWorkerProxy::~PromiseWorkerProxy() void PromiseWorkerProxy::CleanProperties() { -#ifdef DEBUG - WorkerPrivate* worker = GetCurrentThreadWorkerPrivate(); - MOZ_ASSERT(worker); - worker->AssertIsOnWorkerThread(); -#endif + MOZ_ASSERT(IsCurrentThreadRunningWorker()); + // Ok to do this unprotected from Create(). // CleanUp() holds the lock before calling this. mCleanedUp = true; @@ -699,11 +696,7 @@ PromiseWorkerProxy::GetWorkerPrivate() const Promise* PromiseWorkerProxy::WorkerPromise() const { -#ifdef DEBUG - WorkerPrivate* worker = GetCurrentThreadWorkerPrivate(); - MOZ_ASSERT(worker); - worker->AssertIsOnWorkerThread(); -#endif + MOZ_ASSERT(IsCurrentThreadRunningWorker()); MOZ_ASSERT(mWorkerPromise); return mWorkerPromise; }