Bug 1300118 P3 Fix TaskQueue sCurrentThread TLS handling for nsIEventTarget targets. r=jwwang

This commit is contained in:
Ben Kelly 2016-09-13 20:12:15 -07:00
parent e03450312b
commit 11d56a06f0
3 changed files with 4 additions and 4 deletions

View File

@ -70,7 +70,6 @@ public:
PRThread* thread = nullptr;
mTarget->GetPRThread(&thread);
bool in = PR_GetCurrentThread() == thread;
MOZ_ASSERT(in == (GetCurrent() == this));
return in;
}

View File

@ -191,7 +191,6 @@ bool
TaskQueue::IsCurrentThreadIn()
{
bool in = NS_GetCurrentThread() == mRunningThread;
MOZ_ASSERT(in == (GetCurrent() == this));
return in;
}

View File

@ -148,13 +148,14 @@ protected:
public:
explicit AutoTaskGuard(TaskQueue* aQueue)
: AutoTaskDispatcher(/* aIsTailDispatcher = */ true), mQueue(aQueue)
, mLastCurrentThread(nullptr)
{
// NB: We don't hold the lock to aQueue here. Don't do anything that
// might require it.
MOZ_ASSERT(!mQueue->mTailDispatcher);
mQueue->mTailDispatcher = this;
MOZ_ASSERT(sCurrentThreadTLS.get() == nullptr);
mLastCurrentThread = sCurrentThreadTLS.get();
sCurrentThreadTLS.set(aQueue);
MOZ_ASSERT(mQueue->mRunningThread == nullptr);
@ -168,12 +169,13 @@ protected:
MOZ_ASSERT(mQueue->mRunningThread == NS_GetCurrentThread());
mQueue->mRunningThread = nullptr;
sCurrentThreadTLS.set(nullptr);
sCurrentThreadTLS.set(mLastCurrentThread);
mQueue->mTailDispatcher = nullptr;
}
private:
TaskQueue* mQueue;
AbstractThread* mLastCurrentThread;
};
TaskDispatcher* mTailDispatcher;