From b244f139bf4bf241178de5d9e0ce9afb7148e861 Mon Sep 17 00:00:00 2001 From: Ido Ben-Yair Date: Wed, 7 Oct 2015 18:59:15 +0300 Subject: [PATCH] vm: remove Watchdog dependency on Environment Remove the Watchdog class' dependency on Environment. No functional changes, only code cleanup. PR-URL: https://github.com/nodejs/node/pull/3274 Reviewed-By: Ben Noordhuis --- src/node_contextify.cc | 2 +- src/node_watchdog.cc | 9 ++++----- src/node_watchdog.h | 8 +++----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 8880439c8a7e3f..df328f265ebf6e 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -693,7 +693,7 @@ class ContextifyScript : public BaseObject { Local result; if (timeout != -1) { - Watchdog wd(env, timeout); + Watchdog wd(env->isolate(), timeout); result = script->Run(); } else { result = script->Run(); diff --git a/src/node_watchdog.cc b/src/node_watchdog.cc index 2811ab06ed3abf..77f93678fb88ff 100644 --- a/src/node_watchdog.cc +++ b/src/node_watchdog.cc @@ -1,15 +1,14 @@ #include "node_watchdog.h" -#include "env.h" -#include "env-inl.h" #include "util.h" +#include "util-inl.h" namespace node { using v8::V8; -Watchdog::Watchdog(Environment* env, uint64_t ms) : env_(env), - destroyed_(false) { +Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms) : isolate_(isolate), + destroyed_(false) { int rc; loop_ = new uv_loop_t; CHECK(loop_); @@ -84,7 +83,7 @@ void Watchdog::Async(uv_async_t* async) { void Watchdog::Timer(uv_timer_t* timer) { Watchdog* w = ContainerOf(&Watchdog::timer_, timer); uv_stop(w->loop_); - V8::TerminateExecution(w->env()->isolate()); + V8::TerminateExecution(w->isolate()); } diff --git a/src/node_watchdog.h b/src/node_watchdog.h index 887404eb11fdda..ead31ce66df862 100644 --- a/src/node_watchdog.h +++ b/src/node_watchdog.h @@ -4,18 +4,16 @@ #include "v8.h" #include "uv.h" -#include "env.h" - namespace node { class Watchdog { public: - explicit Watchdog(Environment* env, uint64_t ms); + explicit Watchdog(v8::Isolate* isolate, uint64_t ms); ~Watchdog(); void Dispose(); - inline Environment* env() const { return env_; } + v8::Isolate* isolate() { return isolate_; } private: void Destroy(); @@ -24,7 +22,7 @@ class Watchdog { static void Async(uv_async_t* async); static void Timer(uv_timer_t* timer); - Environment* env_; + v8::Isolate* isolate_; uv_thread_t thread_; uv_loop_t* loop_; uv_async_t async_;