Skip to content

Commit 6936468

Browse files
Ido Ben-Yairrvagg
Ido Ben-Yair
authored andcommitted
vm: remove Watchdog dependency on Environment
Remove the Watchdog class' dependency on Environment. No functional changes, only code cleanup. PR-URL: #3274 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent d5ce534 commit 6936468

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/node_contextify.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ class ContextifyScript : public BaseObject {
693693

694694
Local<Value> result;
695695
if (timeout != -1) {
696-
Watchdog wd(env, timeout);
696+
Watchdog wd(env->isolate(), timeout);
697697
result = script->Run();
698698
} else {
699699
result = script->Run();

src/node_watchdog.cc

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#include "node_watchdog.h"
2-
#include "env.h"
3-
#include "env-inl.h"
42
#include "util.h"
3+
#include "util-inl.h"
54

65
namespace node {
76

87
using v8::V8;
98

109

11-
Watchdog::Watchdog(Environment* env, uint64_t ms) : env_(env),
12-
destroyed_(false) {
10+
Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms) : isolate_(isolate),
11+
destroyed_(false) {
1312
int rc;
1413
loop_ = new uv_loop_t;
1514
CHECK(loop_);
@@ -84,7 +83,7 @@ void Watchdog::Async(uv_async_t* async) {
8483
void Watchdog::Timer(uv_timer_t* timer) {
8584
Watchdog* w = ContainerOf(&Watchdog::timer_, timer);
8685
uv_stop(w->loop_);
87-
V8::TerminateExecution(w->env()->isolate());
86+
V8::TerminateExecution(w->isolate());
8887
}
8988

9089

src/node_watchdog.h

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@
44
#include "v8.h"
55
#include "uv.h"
66

7-
#include "env.h"
8-
97
namespace node {
108

119
class Watchdog {
1210
public:
13-
explicit Watchdog(Environment* env, uint64_t ms);
11+
explicit Watchdog(v8::Isolate* isolate, uint64_t ms);
1412
~Watchdog();
1513

1614
void Dispose();
1715

18-
inline Environment* env() const { return env_; }
16+
v8::Isolate* isolate() { return isolate_; }
1917

2018
private:
2119
void Destroy();
@@ -24,7 +22,7 @@ class Watchdog {
2422
static void Async(uv_async_t* async);
2523
static void Timer(uv_timer_t* timer);
2624

27-
Environment* env_;
25+
v8::Isolate* isolate_;
2826
uv_thread_t thread_;
2927
uv_loop_t* loop_;
3028
uv_async_t async_;

0 commit comments

Comments
 (0)