mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 05:45:37 +00:00
Bug 1300118 P3 Fix TaskQueue sCurrentThread TLS handling for nsIEventTarget targets. r=jwwang
This commit is contained in:
parent
e03450312b
commit
11d56a06f0
@ -70,7 +70,6 @@ public:
|
||||
PRThread* thread = nullptr;
|
||||
mTarget->GetPRThread(&thread);
|
||||
bool in = PR_GetCurrentThread() == thread;
|
||||
MOZ_ASSERT(in == (GetCurrent() == this));
|
||||
return in;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,6 @@ bool
|
||||
TaskQueue::IsCurrentThreadIn()
|
||||
{
|
||||
bool in = NS_GetCurrentThread() == mRunningThread;
|
||||
MOZ_ASSERT(in == (GetCurrent() == this));
|
||||
return in;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user