Bug 1419305 - Part 1: Use MicroTask on CustomElements correctly; r=smaug

MozReview-Commit-ID: EPMfr6hr5fS

--HG--
extra : rebase_source : 51784f7d8b74978847901f57f23730fb0f547ce5
This commit is contained in:
Edgar Chen 2017-11-03 17:38:46 +08:00
Родитель 01bea734e5
Коммит 7cfc82e138
2 изменённых файлов: 6 добавлений и 9 удалений

Просмотреть файл

@ -1018,9 +1018,8 @@ CustomElementReactionsStack::Enqueue(Element* aElement,
}
CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
RefPtr<ProcessBackupQueueRunnable> processBackupQueueRunnable =
new ProcessBackupQueueRunnable(this);
context->DispatchToMicroTask(processBackupQueueRunnable.forget());
RefPtr<BackupQueueMicroTask> bqmt = new BackupQueueMicroTask(this);
context->DispatchMicroTaskRunnable(bqmt.forget());
}
void

Просмотреть файл

@ -313,12 +313,11 @@ private:
void Enqueue(Element* aElement, CustomElementReaction* aReaction);
private:
class ProcessBackupQueueRunnable : public mozilla::Runnable {
class BackupQueueMicroTask final : public mozilla::MicroTaskRunnable {
public:
explicit ProcessBackupQueueRunnable(
explicit BackupQueueMicroTask(
CustomElementReactionsStack* aReactionStack)
: Runnable(
"dom::CustomElementReactionsStack::ProcessBackupQueueRunnable")
: MicroTaskRunnable()
, mReactionStack(aReactionStack)
{
MOZ_ASSERT(!mReactionStack->mIsBackupQueueProcessing,
@ -326,11 +325,10 @@ private:
mReactionStack->mIsBackupQueueProcessing = true;
}
NS_IMETHOD Run() override
virtual void Run(AutoSlowOperation& aAso) override
{
mReactionStack->InvokeBackupQueue();
mReactionStack->mIsBackupQueueProcessing = false;
return NS_OK;
}
private: