Bug 1445540 - Use IsCurrentThreadRunningWorker() instead of GetCurrentThreadWorkerPrivate() in dom/base and dom/promise, r=smaug

This commit is contained in:
Andrea Marchesini 2018-03-14 15:25:47 +01:00
parent 8f9c41b092
commit 5a4303000d
2 changed files with 4 additions and 11 deletions

View File

@ -89,7 +89,7 @@ public:
, mEncodeCompleteCallback(aEncodeCompleteCallback)
, mFailed(false)
{
if (!NS_IsMainThread() && GetCurrentThreadWorkerPrivate()) {
if (!NS_IsMainThread() && IsCurrentThreadRunningWorker()) {
mCreationEventTarget = GetCurrentThreadEventTarget();
} else {
mCreationEventTarget = GetMainThreadEventTarget();

View File

@ -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;
}