aboutsummaryrefslogtreecommitdiff
path: root/src/env.cc
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2016-01-05 15:33:21 -0700
committerTrevor Norris <trev.norris@gmail.com>2016-02-12 14:03:24 -0700
commite9192249c8c6b05c7cc04e8b51a7e37235f31415 (patch)
tree8859fa3eb0090035dae60d813b9f315b456413bb /src/env.cc
parent575b84ec41b94d4a565b981c146d88ce0637fff2 (diff)
downloadandroid-node-v8-e9192249c8c6b05c7cc04e8b51a7e37235f31415.tar.gz
android-node-v8-e9192249c8c6b05c7cc04e8b51a7e37235f31415.tar.bz2
android-node-v8-e9192249c8c6b05c7cc04e8b51a7e37235f31415.zip
src: add AsyncCallbackScope
Add a scope that will allow MakeCallback to know whether or not it's currently running. This will prevent nextTickQueue and the MicrotaskQueue from being processed recursively. It is also required to wrap the bootloading stage since it doesn't run within a MakeCallback. Ref: https://github.com/nodejs/node-v0.x-archive/issues/9245 PR-URL: https://github.com/nodejs/node/pull/4507 Reviewed-By: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'src/env.cc')
-rw-r--r--src/env.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/env.cc b/src/env.cc
index fa8cc0d1ad..b852a630d5 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -64,10 +64,10 @@ void Environment::PrintSyncTrace() const {
}
-bool Environment::KickNextTick() {
+bool Environment::KickNextTick(Environment::AsyncCallbackScope* scope) {
TickInfo* info = tick_info();
- if (info->in_tick()) {
+ if (scope->in_makecallback()) {
return true;
}
@@ -80,15 +80,11 @@ bool Environment::KickNextTick() {
return true;
}
- info->set_in_tick(true);
-
// process nextTicks after call
TryCatch try_catch;
try_catch.SetVerbose(true);
tick_callback_function()->Call(process_object(), 0, nullptr);
- info->set_in_tick(false);
-
if (try_catch.HasCaught()) {
info->set_last_threw(true);
return false;