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

Unified Diff: src/isolate.cc

Issue 620673005: Introduce HasPendingMicrotasks API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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
« no previous file with comments | « src/isolate.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 7cf525d3e157a052dd78f21e25df1432518ee9c1..73d85ef0b5820796bc5329ebea1ee14dfcfb488e 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2313,9 +2313,11 @@ void Isolate::RunMicrotasks() {
Handle<FixedArray> queue(heap()->microtask_queue(), this);
DCHECK(num_tasks <= queue->length());
set_pending_microtask_count(0);
+ set_running_microtask_count(num_tasks);
heap()->set_microtask_queue(heap()->empty_fixed_array());
for (int i = 0; i < num_tasks; i++) {
+ set_running_microtask_count(num_tasks - i - 1);
HandleScope scope(this);
Handle<Object> microtask(queue->get(i), this);
if (microtask->IsJSFunction()) {
@@ -2333,6 +2335,7 @@ void Isolate::RunMicrotasks() {
// Clear out any remaining callbacks in the queue.
heap()->set_microtask_queue(heap()->empty_fixed_array());
set_pending_microtask_count(0);
+ set_running_microtask_count(0);
return;
}
} else {
@@ -2348,6 +2351,11 @@ void Isolate::RunMicrotasks() {
}
+bool Isolate::HasMoreMicrotasksToRun() const {
+ return pending_microtask_count() || running_microtask_count();
+}
+
+
void Isolate::SetUseCounterCallback(v8::Isolate::UseCounterCallback callback) {
DCHECK(!use_counter_callback_);
use_counter_callback_ = callback;
« no previous file with comments | « src/isolate.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698