node: avoid automatic microtask runs
authorVladimir Kurchatkin <vladimir.kurchatkin@gmail.com>
Mon, 22 Sep 2014 16:19:50 +0000 (20:19 +0400)
committerTrevor Norris <trev.norris@gmail.com>
Wed, 1 Oct 2014 21:42:05 +0000 (14:42 -0700)
commit8dc6be1747d3a48af56f89e973ecb5665f89a2e1
tree2f97df1b5b14c3dee8bb20bb74eb7dde00865ae4
parentb705b73e46193c7691be40b732330a49affacedb
node: avoid automatic microtask runs

Since we are taking control of the microtask queue it makes sense to
disable autorun and only run microtasks when necessary. Just setting
isolate->SetAutorunMicrotasks(false) would cause _tickCallback() not to
be called.

Automatically running the microtask queue will cause it to run:

* After callback invocation
* Inside _tickCallback()
* After _tickCallback() invocation

The third one is unnecessary as the microtask queue is guaranteed to be
empty at this point. The first only needs to be run manually when
_tickCallback() isn't going to be called by MakeCallback().

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
src/async-wrap-inl.h
src/node.cc
test/simple/test-microtask-queue-run-domain.js [new file with mode: 0644]
test/simple/test-microtask-queue-run-immediate-domain.js [new file with mode: 0644]
test/simple/test-microtask-queue-run-immediate.js [new file with mode: 0644]
test/simple/test-microtask-queue-run.js [new file with mode: 0644]