| Index: Source/core/dom/Microtask.cpp
|
| diff --git a/Source/core/dom/Microtask.cpp b/Source/core/dom/Microtask.cpp
|
| index d2ffaed202eda2bbf59fc1a323e1a94e218ea008..9340c1df4780ce2ef665054201638b4cb02b27e4 100644
|
| --- a/Source/core/dom/Microtask.cpp
|
| +++ b/Source/core/dom/Microtask.cpp
|
| @@ -32,6 +32,7 @@
|
| #include "core/dom/Microtask.h"
|
|
|
| #include "bindings/core/v8/V8PerIsolateData.h"
|
| +#include "bindings/core/v8/V8RecursionScope.h"
|
| #include "platform/Task.h"
|
| #include "public/platform/WebThread.h"
|
| #include <v8.h>
|
| @@ -43,13 +44,22 @@ void Microtask::performCheckpoint()
|
| v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| V8PerIsolateData* isolateData = V8PerIsolateData::from(isolate);
|
| ASSERT(isolateData);
|
| - if (isolateData->recursionLevel() || isolateData->performingMicrotaskCheckpoint())
|
| + if (isolateData->recursionLevel() || isolateData->performingMicrotaskCheckpoint() || isolateData->destructionPending())
|
| return;
|
| isolateData->setPerformingMicrotaskCheckpoint(true);
|
| - isolate->RunMicrotasks();
|
| + {
|
| + // Ensure that end-of-task-or-microtask actions are performed.
|
| + V8RecursionScope recursionScope(isolate);
|
| + isolate->RunMicrotasks();
|
| + }
|
| isolateData->setPerformingMicrotaskCheckpoint(false);
|
| }
|
|
|
| +bool Microtask::performingCheckpoint(v8::Isolate* isolate)
|
| +{
|
| + return V8PerIsolateData::from(isolate)->performingMicrotaskCheckpoint();
|
| +}
|
| +
|
| static void microtaskFunctionCallback(void* data)
|
| {
|
| OwnPtr<WebThread::Task> task = adoptPtr(static_cast<WebThread::Task*>(data));
|
|
|