Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 01bb876

Browse filesBrowse files
apapirovskitargos
authored andcommitted
perf_hooks: remove unnecessary bind
Pass through parameters using setImmediate rather than using Function.prototype.bind to bind the provided context. PR-URL: #28131 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent baece55 commit 01bb876
Copy full SHA for 01bb876

File tree

Expand file treeCollapse file tree

1 file changed

+10
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-7
lines changed
Open diff view settings
Collapse file

‎lib/perf_hooks.js‎

Copy file name to clipboardExpand all lines: lib/perf_hooks.js
+10-7Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,14 @@ function getObserversList(type) {
455455
return list;
456456
}
457457

458-
function doNotify() {
459-
this[kQueued] = false;
460-
this.runInAsyncScope(this[kCallback], this, this[kBuffer], this);
461-
this[kBuffer][kEntries] = [];
462-
L.init(this[kBuffer][kEntries]);
458+
function doNotify(observer) {
459+
observer[kQueued] = false;
460+
observer.runInAsyncScope(observer[kCallback],
461+
observer,
462+
observer[kBuffer],
463+
observer);
464+
observer[kBuffer][kEntries] = [];
465+
L.init(observer[kBuffer][kEntries]);
463466
}
464467

465468
// Set up the callback used to receive PerformanceObserver notifications
@@ -485,11 +488,11 @@ function observersCallback(entry) {
485488
observer[kQueued] = true;
486489
// Use setImmediate instead of nextTick to give more time
487490
// for multiple entries to collect.
488-
setImmediate(doNotify.bind(observer));
491+
setImmediate(doNotify, observer);
489492
}
490493
} else {
491494
// If not buffering, notify immediately
492-
doNotify.call(observer);
495+
doNotify(observer);
493496
}
494497
current = current._idlePrev;
495498
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.