Skip to content

Commit 7ff3d57

Browse files
committed
No need for unsetLabels
1 parent a14885d commit 7ff3d57

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

bindings/profilers/wall.cc

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@ NAN_MODULE_INIT(WallProfiler::Init) {
542542
Nan::SetPrototypeMethod(tpl, "start", Start);
543543
Nan::SetPrototypeMethod(tpl, "dispose", Dispose);
544544
Nan::SetPrototypeMethod(tpl, "stop", Stop);
545-
Nan::SetPrototypeMethod(tpl, "unsetLabels", UnsetLabels);
546545

547546
PerIsolateData::For(Isolate::GetCurrent())
548547
->WallProfilerConstructor()
@@ -571,11 +570,11 @@ v8::Local<v8::Value> WallProfiler::GetLabels(Isolate* isolate) {
571570
}
572571

573572
void WallProfiler::SetLabels(Isolate* isolate, Local<Value> value) {
574-
labels_ = std::make_shared<Global<Value>>(isolate, value);
575-
}
576-
577-
void WallProfiler::UnsetLabels() {
578-
labels_.reset();
573+
if (value->BooleanValue(isolate)) {
574+
labels_ = std::make_shared<Global<Value>>(isolate, value);
575+
} else {
576+
labels_.reset();
577+
}
579578
}
580579

581580
NAN_GETTER(WallProfiler::GetLabels) {
@@ -588,11 +587,6 @@ NAN_SETTER(WallProfiler::SetLabels) {
588587
profiler->SetLabels(info.GetIsolate(), value);
589588
}
590589

591-
NAN_METHOD(WallProfiler::UnsetLabels) {
592-
auto profiler = Nan::ObjectWrap::Unwrap<WallProfiler>(info.Holder());
593-
profiler->UnsetLabels();
594-
}
595-
596590
NAN_GETTER(WallProfiler::GetLabelsCaptured) {
597591
auto profiler = Nan::ObjectWrap::Unwrap<WallProfiler>(info.Holder());
598592
info.GetReturnValue().Set(profiler->GetLabelsCaptured());

bindings/profilers/wall.hh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class WallProfiler : public Nan::ObjectWrap {
6868

6969
v8::Local<v8::Value> GetLabels(v8::Isolate*);
7070
void SetLabels(v8::Isolate*, v8::Local<v8::Value>);
71-
void UnsetLabels();
7271
bool GetLabelsCaptured() {
7372
bool captured = labelsCaptured;
7473
labelsCaptured = false;
@@ -83,7 +82,6 @@ class WallProfiler : public Nan::ObjectWrap {
8382
static NAN_METHOD(Dispose);
8483
static NAN_METHOD(Start);
8584
static NAN_METHOD(Stop);
86-
static NAN_METHOD(UnsetLabels);
8785
static NAN_MODULE_INIT(Init);
8886
static NAN_GETTER(GetLabels);
8987
static NAN_SETTER(SetLabels);

ts/src/time-profiler.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export function start(
7575
return {
7676
stop: majorVersion < 16 ? stopOld : stop,
7777
setLabels,
78-
unsetLabels,
7978
labelsCaptured,
8079
};
8180

@@ -117,10 +116,6 @@ export function start(
117116
profiler.labels = labels;
118117
}
119118

120-
function unsetLabels() {
121-
profiler.unsetLabels();
122-
}
123-
124119
function labelsCaptured() {
125120
return profiler.labelsCaptured;
126121
}

0 commit comments

Comments
 (0)