GeezerVison is showing github.com — bootstrap: lazy-load Performance.prototype.timeOrigin · nodejs/node@a0d4b69
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/internal/perf/performance.js +14-15Lines changed: 14 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -206,15 +206,24 @@ ObjectDefineProperties(Performance.prototype, { | 206 | 206 | enumerable: false, | 207 | 207 | value: timerify, | 208 | 208 | }, | 209 | | - // This would be updated during pre-execution in case | 210 | | - // the process is launched from a snapshot. | 211 | | - // TODO(joyeecheung): we may want to warn about access to | 212 | | - // this during snapshot building. | 213 | 209 | timeOrigin: { | 214 | 210 | __proto__: null, | 215 | 211 | configurable: true, | 216 | 212 | enumerable: true, | 217 | | - value: getTimeOriginTimestamp(), | | 213 | + get() { | | 214 | + const value = getTimeOriginTimestamp(); | | 215 | + ObjectDefineProperty(Performance.prototype, 'timeOrigin', { | | 216 | + __proto__: null, | | 217 | + value, | | 218 | + }); | | 219 | + return value; | | 220 | + }, | | 221 | + set(value) { | | 222 | + ObjectDefineProperty(Performance.prototype, 'timeOrigin', { | | 223 | + __proto__: null, | | 224 | + value, | | 225 | + }); | | 226 | + }, | 218 | 227 | }, | 219 | 228 | toJSON: { | 220 | 229 | __proto__: null, | @@ -224,15 +233,6 @@ ObjectDefineProperties(Performance.prototype, { | 224 | 233 | }, | 225 | 234 | }); | 226 | 235 |
| 227 | | -function refreshTimeOrigin() { | 228 | | - ObjectDefineProperty(Performance.prototype, 'timeOrigin', { | 229 | | - __proto__: null, | 230 | | - configurable: true, | 231 | | - enumerable: true, | 232 | | - value: getTimeOriginTimestamp(), | 233 | | - }); | 234 | | -} | 235 | | - | 236 | 236 | const performance = new InternalPerformance(); | 237 | 237 |
| 238 | 238 | function dispatchBufferFull(type) { | @@ -246,5 +246,4 @@ setDispatchBufferFull(dispatchBufferFull); | 246 | 246 | module.exports = { | 247 | 247 | Performance, | 248 | 248 | performance, | 249 | | - refreshTimeOrigin, | 250 | 249 | }; |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/process/pre_execution.js -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -383,7 +383,6 @@ function setupTraceCategoryState() { | 383 | 383 | } | 384 | 384 |
| 385 | 385 | function setupPerfHooks() { | 386 | | - require('internal/perf/performance').refreshTimeOrigin(); | 387 | 386 | require('internal/perf/utils').refreshTimeOrigin(); | 388 | 387 | } | 389 | 388 |
| |
|