Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vm: Removed Watchdog dependency on Environment. #3274

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ class ContextifyScript : public BaseObject {

Local<Value> result;
if (timeout != -1) {
Watchdog wd(env, timeout);
Watchdog wd(env->isolate(), timeout);
result = script->Run();
} else {
result = script->Run();
Expand Down
9 changes: 4 additions & 5 deletions src/node_watchdog.cc
Original file line number Diff line number Diff line change
@@ -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_);
Expand Down Expand Up @@ -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());
}


Expand Down
8 changes: 3 additions & 5 deletions src/node_watchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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_;
Expand Down