The JSC shell should listen for memory pressure events and respond to them
[WebKit-https.git] / Source / JavaScriptCore / runtime / VM.cpp
index a774fa5..d83269b 100644 (file)
@@ -1128,8 +1128,11 @@ void VM::queueMicrotask(JSGlobalObject& globalObject, Ref<Microtask>&& task)
 
 void VM::drainMicrotasks()
 {
-    while (!m_microtaskQueue.isEmpty())
+    while (!m_microtaskQueue.isEmpty()) {
         m_microtaskQueue.takeFirst()->run();
+        if (m_onEachMicrotaskTick)
+            m_onEachMicrotaskTick(*this);
+    }
 }
 
 void QueuedTask::run()