Skip to content

Commit

Permalink
[Squash] Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Jan 24, 2018
1 parent fa7e500 commit 3227a91
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion doc/api/perf_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Creates a new `PerformanceMark` entry in the Performance Timeline. A
`performanceEntry.duration` is always `0`. Performance marks are used
to mark specific significant moments in the Performance Timeline.

### performance.maxBufferSize
### performance.maxEntries
<!-- YAML
added: REPLACEME
-->
Expand Down
8 changes: 4 additions & 4 deletions lib/perf_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,15 @@ class Performance extends PerformanceObserverEntryList {
this[kInsertEntry](nodeTiming);
}

set maxBufferSize(val) {
set maxEntries(val) {
if (typeof val !== 'number' || val >>> 0 !== val) {
const errors = lazyErrors();
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'val', 'number');
}
this[kMaxCount] = Math.max(1, val >>> 0);
}

get maxBufferSize() {
get maxEntries() {
return this[kMaxCount];
}

Expand All @@ -432,8 +432,8 @@ class Performance extends PerformanceObserverEntryList {
`There ${text} in the ` +
'Performance Timeline. Use the clear methods ' +
'to remove entries that are no longer needed or ' +
'set performance.maxBufferSize equal to a higher ' +
'value (currently the maxBufferSize is ' +
'set performance.maxEntries equal to a higher ' +
'value (currently the maxEntries is ' +
`${this[kMaxCount]}).`);
}
}
Expand Down
10 changes: 5 additions & 5 deletions test/parallel/test-performance-warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ const { performance } = require('perf_hooks');
const assert = require('assert');

assert.strictEqual(performance.length, 1);
assert.strictEqual(performance.maxBufferSize, 150);
assert.strictEqual(performance.maxEntries, 150);

performance.maxBufferSize = 1;
performance.maxEntries = 1;

[-1, 0xffffffff + 1, '', null, undefined, Infinity].forEach((i) => {
common.expectsError(
() => performance.maxBufferSize = i,
() => performance.maxEntries = i,
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError
Expand All @@ -23,7 +23,7 @@ performance.maxBufferSize = 1;
common.expectWarning('Warning', [
'Possible perf_hooks memory leak detected. There are 2 entries in the ' +
'Performance Timeline. Use the clear methods to remove entries that are no ' +
'longer needed or set performance.maxBufferSize equal to a higher value ' +
'(currently the maxBufferSize is 1).']);
'longer needed or set performance.maxEntries equal to a higher value ' +
'(currently the maxEntries is 1).']);

performance.mark('test');

0 comments on commit 3227a91

Please sign in to comment.