mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 01:08:39 +09:00
[DOM] Simplify WorkerRunnable sanity checks and make them more readable.
This commit is contained in:
parent
641b556c53
commit
b518af4d45
1 changed files with 8 additions and 6 deletions
|
|
@ -231,8 +231,13 @@ WorkerRunnable::Run()
|
|||
{
|
||||
bool targetIsWorkerThread = mBehavior == WorkerThreadModifyBusyCount ||
|
||||
mBehavior == WorkerThreadUnchangedBusyCount;
|
||||
bool alreadyCanceled = IsCanceled() && !mCallingCancelWithinRun;
|
||||
bool shouldCancelWorker = targetIsWorkerThread &&
|
||||
mWorkerPrivate->AllPendingRunnablesShouldBeCanceled() &&
|
||||
!IsCanceled() && !mCallingCancelWithinRun;
|
||||
bool runnableWillRun = !alreadyCanceled && !shouldCancelWorker;
|
||||
|
||||
if (targetIsWorkerThread) {
|
||||
if (targetIsWorkerThread && runnableWillRun) {
|
||||
// On a worker thread, a WorkerRunnable should only run when there is an
|
||||
// underlying WorkerThreadPrimaryRunnable active, which means we should
|
||||
// find a CycleCollectedJSContext.
|
||||
|
|
@ -256,14 +261,11 @@ WorkerRunnable::Run()
|
|||
}
|
||||
#endif
|
||||
|
||||
if (IsCanceled() && !mCallingCancelWithinRun) {
|
||||
if (alreadyCanceled) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (targetIsWorkerThread &&
|
||||
mWorkerPrivate->AllPendingRunnablesShouldBeCanceled() &&
|
||||
!IsCanceled() && !mCallingCancelWithinRun) {
|
||||
|
||||
if (shouldCancelWorker) {
|
||||
// Prevent recursion.
|
||||
mCallingCancelWithinRun = true;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue