public dispose(destroySocket = true): void {
if (this._endTimeoutHandle) {
this._endTimeoutHandle = undefined;
}
this.socket.off('error', this._errorListener);
this.socket.off('close', this._closeListener);
Frontier kind: Joint frontier
unlabeled · c_a410a07ccab7
1 test · 10411 LOC · 54 files · introduces 1 test · 122 LOC · 2 files
The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.
Introduced files, introduced tests, and structurally relevant concept specialization
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.
Every exact file and test below is linked only from the concept that introduces it.
mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/lifecycle.test|title=Lifecycle Action bar has broken accessibility #100273|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/lifecycle.test|title=Lifecycle dispose disposable array|occurrence=1Every collected test enters the hierarchy at exactly one concept.
1 test introduced at this concept.
Every collected source range enters the hierarchy at exactly one concept.
2 files ranked by introduced lines: 122 introduced LOC across 21 ranges. Expand a file to inspect source; the > gutter marks introduced lines.
public dispose(destroySocket = true): void {
if (this._endTimeoutHandle) {
this._endTimeoutHandle = undefined;
}
this.socket.off('error', this._errorListener);
this.socket.off('close', this._closeListener);
this.traceSocketEvent(SocketDiagnosticsEventType.Write, buffer);
this.socket.write(buffer.buffer, (err: NodeJS.ErrnoException | null | undefined) => {
if (err.code === 'EPIPE') {
// An EPIPE exception at the wrong time can lead to a renderer process crash
public drain(): Promise<void> {
return new Promise<void>((resolve, reject) => {
if (this.socket.bufferSize === 0) {
this.traceSocketEvent(SocketDiagnosticsEventType.NodeDrainEnd);
resolve();
return;
}
const finished = () => {
this.socket.off('close', finished);
this.socket.on('timeout', finished);
this.socket.on('drain', finished);
}
}
this._register(this.socket.onData(data => this._acceptChunk(data)));
this._register(this.socket.onClose(async (e) => {
// and all data has been emitted
if (this._flowManager.isProcessingReadQueue()) {
await Event.toPromise(this._flowManager.onDidFinishProcessingReadQueue);
}
this._onClose.fire(e);
}));
}
public onClose(listener: (e: SocketCloseEvent) => void): IDisposable {
}
public onEnd(listener: () => void): IDisposable {
public write(buffer: VSBuffer): void {
// If we write many logical messages (let's say 1000 messages of 100KB) during a single process tick, we do
ipc.net.ts
// this thing where we install a process.nextTick timer and group all of them together and we then issue a
// single WebSocketNodeSocket.write with a 100MB buffer.
//
// The first problem is that the actual writing to the underlying node socket will only happen after all of
// the 100MB have been deflated (due to waiting on zlib flush). The second problem is on the reading side,
// where we will get a single WebSocketNodeSocket.onData event fired when all the 100MB have arrived,
// delaying processing the 1000 received messages until all have arrived, instead of processing them as each
// one arrives.
//
// We therefore split the buffer into chunks, and issue a write for each chunk.
let start = 0;
while (start < buffer.byteLength) {
this._flowManager.writeMessage(buffer.slice(start, Math.min(start + this._maxSocketMessageLength, buffer.byteLength)), { compressed: true, opcode: 0x02 /* Binary frame */ });
start += this._maxSocketMessageLength;
}
}
private _write(buffer: VSBuffer, { compressed, opcode }: FrameOptions): void {
} else if (buffer.byteLength < 2 ** 16) {
headerLen += 2;
headerLen += 8;
}
const header = VSBuffer.alloc(headerLen);
header.writeUInt8((buffer.byteLength >>> 8) & 0b11111111, ++offset);
header.writeUInt8((buffer.byteLength >>> 0) & 0b11111111, ++offset);
header.writeUInt8(127, 1);
let offset = 1;
header.writeUInt8(0, ++offset);
header.writeUInt8(0, ++offset);
header.writeUInt8(0, ++offset);
header.writeUInt8(0, ++offset);
header.writeUInt8((buffer.byteLength >>> 24) & 0b11111111, ++offset);
header.writeUInt8((buffer.byteLength >>> 16) & 0b11111111, ++offset);
header.writeUInt8((buffer.byteLength >>> 8) & 0b11111111, ++offset);
header.writeUInt8((buffer.byteLength >>> 0) & 0b11111111, ++offset);
}
this.socket.write(VSBuffer.concat([header, buffer]));
);
} else if (len === 127) {
header.readUInt8(++offset) * 0
+ header.readUInt8(++offset) * 0
+ header.readUInt8(++offset) * 0
+ header.readUInt8(++offset) * 0
+ header.readUInt8(++offset) * 2 ** 24
+ header.readUInt8(++offset) * 2 ** 16
+ header.readUInt8(++offset) * 2 ** 8
+ header.readUInt8(++offset)
);
}
let mask = 0;
public async drain(): Promise<void> {
if (this._flowManager.isProcessingWriteQueue()) {
await Event.toPromise(this._flowManager.onDidFinishProcessingWriteQueue);
}
await this.socket.drain();
this.traceSocketEvent(SocketDiagnosticsEventType.WebSocketNodeSocketDrainEnd);
}
}
private async _processWriteQueue(): Promise<void> {
if (this._isProcessingWriteQueue) {
}
this._isProcessingWriteQueue = true;
while (this._writeQueue.length > 0) {
const { data, options } = this._writeQueue.shift()!;
if (this._zlibDeflateStream && options.compressed) {
this._writeFn(compressedData, options);
} else {
this._writeFn(data, { ...options, compressed: false });
*/
private _deflateMessage(zlibDeflateStream: ZlibDeflateStream, buffer: VSBuffer): Promise<VSBuffer> {
zlibDeflateStream.write(buffer);
zlibDeflateStream.flush(data => resolve(data));
});
}
public acceptFrame(data: VSBuffer, isCompressed: boolean, isLastFrameOfMessage: boolean): void {
public isProcessingReadQueue(): boolean {
}
/**
});
this._zlibDeflate.on('data', (data: Buffer) => {
this._pendingDeflateData.push(VSBuffer.wrap(data));
});
}
public write(buffer: VSBuffer): void {
this._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibDeflateWrite, buffer.buffer);
ipc.net.ts
this._zlibDeflate.write(<Buffer>buffer.buffer);
}
public flush(callback: (data: VSBuffer) => void): void {
this._zlibDeflate.flush(/*Z_SYNC_FLUSH*/2, () => {
this._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibDeflateFlushFired);
let data = VSBuffer.concat(this._pendingDeflateData);
this._pendingDeflateData.length = 0;
// See https://tools.ietf.org/html/rfc7692#section-7.2.1
data = data.slice(0, data.byteLength - 4);
callback(data);
});
}
public override dispose(): void {
return result;
}
const result = VSBuffer.alloc(byteCount);
let resultOffset = 0;
let chunkIndex = 0;
while (byteCount > 0) {
const chunk = this._chunks[chunkIndex];
if (chunk.byteLength > byteCount) {
// this chunk will survive
const chunkPart = chunk.slice(0, byteCount);
byteCount -= byteCount;
// this chunk will be entirely read
result.set(chunk, resultOffset);
resultOffset += chunk.byteLength;
if (advance) {
this._chunks.shift();
this._totalLength -= chunk.byteLength;
} else {
chunkIndex++;
}
byteCount -= chunk.byteLength;
}
}
return result;
}
}