зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1300118 P3 Fix TaskQueue sCurrentThread TLS handling for nsIEventTarget targets. r=jwwang
This commit is contained in:
Родитель
64919e3546
Коммит
6ef08d4672
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче