src: move SIGINT watchdog utils to the contextify binding · nodejs/node@19e3e02 (original) (raw)

1

1

`#include "node_errors.h"

`

2

``

`-

#include "node_watchdog.h"

`

3

2

`#include "util.h"

`

4

3

`#include "base_object-inl.h"

`

5

4

``

`@@ -157,24 +156,6 @@ static void SetHiddenValue(const FunctionCallbackInfo& args) {

`

157

156

` args.GetReturnValue().Set(maybe_value.FromJust());

`

158

157

`}

`

159

158

``

160

``

-

161

``

`-

void StartSigintWatchdog(const FunctionCallbackInfo& args) {

`

162

``

`-

int ret = SigintWatchdogHelper::GetInstance()->Start();

`

163

``

`-

args.GetReturnValue().Set(ret == 0);

`

164

``

`-

}

`

165

``

-

166

``

-

167

``

`-

void StopSigintWatchdog(const FunctionCallbackInfo& args) {

`

168

``

`-

bool had_pending_signals = SigintWatchdogHelper::GetInstance()->Stop();

`

169

``

`-

args.GetReturnValue().Set(had_pending_signals);

`

170

``

`-

}

`

171

``

-

172

``

-

173

``

`-

void WatchdogHasPendingSigint(const FunctionCallbackInfo& args) {

`

174

``

`-

bool ret = SigintWatchdogHelper::GetInstance()->HasPendingSignal();

`

175

``

`-

args.GetReturnValue().Set(ret);

`

176

``

`-

}

`

177

``

-

178

159

`void ArrayBufferViewHasBuffer(const FunctionCallbackInfo& args) {

`

179

160

`CHECK(args[0]->IsArrayBufferView());

`

180

161

` args.GetReturnValue().Set(args[0].As()->HasBuffer());

`

`@@ -281,11 +262,6 @@ void Initialize(Local target,

`

281

262

` env->SetMethodNoSideEffect(target, "getOwnNonIndexProperties",

`

282

263

` GetOwnNonIndexProperties);

`

283

264

``

284

``

`-

env->SetMethod(target, "startSigintWatchdog", StartSigintWatchdog);

`

285

``

`-

env->SetMethod(target, "stopSigintWatchdog", StopSigintWatchdog);

`

286

``

`-

env->SetMethodNoSideEffect(target, "watchdogHasPendingSigint",

`

287

``

`-

WatchdogHasPendingSigint);

`

288

``

-

289

265

` env->SetMethod(target, "arrayBufferViewHasBuffer", ArrayBufferViewHasBuffer);

`

290

266

` Local constants = Object::New(env->isolate());

`

291

267

`NODE_DEFINE_CONSTANT(constants, ALL_PROPERTIES);

`