Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Unified Diff: Source/bindings/v8/V8RecursionScope.cpp

Issue 209853010: [ABANDONED] Enable V8 Promises (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: done? Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/V8RecursionScope.cpp
diff --git a/Source/bindings/v8/V8RecursionScope.cpp b/Source/bindings/v8/V8RecursionScope.cpp
index c08fba7c855efb188047777c0fb263a92d5f16c7..143f754d5c98b80363865fb1069be3390ec06382 100644
--- a/Source/bindings/v8/V8RecursionScope.cpp
+++ b/Source/bindings/v8/V8RecursionScope.cpp
@@ -31,7 +31,10 @@
#include "config.h"
#include "bindings/v8/V8RecursionScope.h"
+#include "core/dom/ExecutionContext.h"
#include "core/dom/Microtask.h"
+#include "core/workers/WorkerGlobalScope.h"
+#include "core/workers/WorkerThread.h"
#include "modules/indexeddb/IDBPendingTransactionMonitor.h"
namespace WebCore {
@@ -44,8 +47,22 @@ void V8RecursionScope::didLeaveScriptContext()
// set to true, but the flag becomes false when control returns to the event loop.
IDBPendingTransactionMonitor::deactivateNewTransactions();
- if (m_isDocumentContext)
+ if (!isStopped())
Microtask::performCheckpoint();
}
+bool V8RecursionScope::isStopped()
+{
+ if (!m_context || m_context->activeDOMObjectsAreStopped())
adamk 2014/03/28 17:55:05 How do you know a null context indicates "stopped"
+ return true;
+ if (m_context->isDocument())
+ return false;
+ if (m_context->isWorkerGlobalScope()) {
+ WorkerGlobalScope* workerContext = toWorkerGlobalScope(m_context);
+ WorkerThread* thread = workerContext->thread();
+ return workerContext->isClosing() || !thread || thread->runLoop().terminated();
+ }
+ return true;
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698