perf_hooks: fix loop delay resolution validation

Fixes: https://github.com/nodejs/node/issues/38160

PR-URL: https://github.com/nodejs/node/pull/38166
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Antoine du Hamel authored and Gerhard Stoebich committed 2021-04-11 23:15:47 +02:00
1 parent 993a1da47c
commit 548cbf0625
3 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -237,7 +237,7 @@ void LoopIdleTime(const FunctionCallbackInfo<Value>& args) {
void ELDHistogram::New(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
CHECK(args.IsConstructCall());
int32_t resolution = args[0].As<Int32>()->Value();
int64_t resolution = args[0].As<Integer>()->Value();
CHECK_GT(resolution, 0);
new ELDHistogram(env, args.This(), resolution);
}
@@ -253,7 +253,7 @@ void ELDHistogram::Initialize(Environment* env, Local<Object> target) {
ELDHistogram::ELDHistogram(
Environment* env,
Local<Object> wrap,
int32_t interval)
int64_t interval)
: IntervalHistogram(
env,
wrap,
+1 -1
View File
@@ -166,7 +166,7 @@ class ELDHistogram : public IntervalHistogram {
ELDHistogram(
Environment* env,
v8::Local<v8::Object> wrap,
int32_t interval);
int64_t interval);
void OnInterval() override;
@@ -39,7 +39,7 @@ const { sleep } = require('internal/util');
);
});
[-1, 0, Infinity].forEach((i) => {
[-1, 0, 2 ** 53, Infinity].forEach((i) => {
assert.throws(
() => monitorEventLoopDelay({ resolution: i }),
{