From 043474da25fc59e01ddae95c5a1c3fc7494f4e9c Mon Sep 17 00:00:00 2001 From: Louis Ye Date: Mon, 14 Jun 2021 16:03:26 -0400 Subject: [PATCH] Update comments to be more accurate --- src/agent/config.ts | 4 ++-- src/agent/v8/inspector-debugapi.ts | 2 +- src/agent/v8/v8inspector.ts | 15 +++++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/agent/config.ts b/src/agent/config.ts index 002877d1..6b325a14 100644 --- a/src/agent/config.ts +++ b/src/agent/config.ts @@ -359,8 +359,8 @@ export interface ResolvedDebugAgentConfig extends GoogleAuthOptions { apiUrl?: string; /** - * Number of times of the V8 pause events (could be breakpoint hits) before - * resetting the breakpoints. This is to release the memory usage held by V8 + * Number of times the V8 pauses (could be breakpoint hits) before the + * debugging session is reset. This is to release the memory usage held by V8 * engine for each breakpoint hit to prevent the memory leak. The default * value is specified in defaultConfig. */ diff --git a/src/agent/v8/inspector-debugapi.ts b/src/agent/v8/inspector-debugapi.ts index 492da058..c47522fb 100644 --- a/src/agent/v8/inspector-debugapi.ts +++ b/src/agent/v8/inspector-debugapi.ts @@ -88,7 +88,7 @@ export class InspectorDebugApi implements debugapi.DebugApi { this.fileStats = jsFiles; this.sourcemapper = sourcemapper; this.inspector = new V8Inspector( - /* useWellFormattedUrl=*/ logger, + /* logger=*/ logger, /*useWellFormattedUrl=*/ utils.satisfies(process.version, '>10.11.0'), /*resetV8DebuggerThreshold=*/ this.config.resetV8DebuggerThreshold, /*onScriptParsed=*/ diff --git a/src/agent/v8/v8inspector.ts b/src/agent/v8/v8inspector.ts index 8cf3a09d..0e6e5afb 100644 --- a/src/agent/v8/v8inspector.ts +++ b/src/agent/v8/v8inspector.ts @@ -158,13 +158,16 @@ export class V8Inspector { session.post('Debugger.setBreakpointsActive', {active: true}); session.on('Debugger.paused', message => { this.onPaused(message.params); - this.resetV8DebuggerIfMeetThreshold(); + this.resetV8DebuggerIfThresholdMet(); }); this.session = session; } - /** Detaches from the V8 debugger. */ + /** + * Detaches from the V8 debugger. This will purge all the existing V8 + * breakpoints from the V8 debugger. + */ detach() { if (!this.session) { return; @@ -177,11 +180,11 @@ export class V8Inspector { } /** - * Resets the debugging session when the threshold. This is primarily for - * cleaning the memory usage hold by V8 debugger when hitting the V8 - * breakpoints too many times. + * Resets the debugging session when the number of paused events meets the + * threshold. This is primarily for cleaning the memory usage hold by V8 + * debugger when hitting the V8 breakpoints too many times. */ - private resetV8DebuggerIfMeetThreshold() { + private resetV8DebuggerIfThresholdMet() { this.numPausedBeforeReset += 1; if (this.numPausedBeforeReset < this.resetV8DebuggerThreshold) { return;