ipc.ts ×8

Frontier kind: Code frontier

unlabeled · c_d10973f9fde3

6 tests · 8663 LOC · 37 files · introduces 0 tests · 45 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges45 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1336 ranges8663 lines · 37 files · Browse complete extent
All tests (intent)
6 testsBrowse complete intent

Neighbourhood graph

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.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 45 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/base/parts/ipc/common/ipc.ts 45 introduced LOC · 8 ranges

Open complete file

403 return this.onPromise({ type, id: header[1], channelName: header[2], name: header[3], arg: body });
404 case RequestType.EventListen:
405 > this.logger?.logIncoming(message.byteLength, header[1], RequestInitiator.OtherSide, `${requestTypeToStr(type)}: ${header[2]}.${header[3]}`, body); ipc.ts
406 > return this.onEventListen({ type, id: header[1], channelName: header[2], name: header[3], arg: body });
407 case RequestType.PromiseCancel:
408 this.logger?.logIncoming(message.byteLength, header[1], RequestInitiator.OtherSide, `${requestTypeToStr(type)}`);
457
458 private onEventListen(request: IRawEventListenRequest): void {
459 > const channel = this.channels.get(request.channelName); ipc.ts
460 >
461 > if (!channel) {
462 this.collectPendingRequest(request);
463 return;
464 }
465 > ipc.ts
466 > const id = request.id;
467 > const event = channel.listen(this.ctx, request.name, request.arg);
468 > const disposable = event(data => this.sendResponse({ id, data, type: ResponseType.EventFire }));
469 >
470 > this.activeRequests.set(request.id, disposable);
471 > }
472
473 private disposeActiveRequest(request: IRawRequest): void {
570 },
571 listen(event: string, arg: any) {
572 > if (that.isDisposed) { ipc.ts
573 return Event.None;
574 }
575 > return that.requestEvent(channelName, event, arg); ipc.ts
576 > }
577 } as T;
578 }
673
674 private requestEvent(channelName: string, name: string, arg?: any): Event<any> {
675 > const id = this.lastRequestId++; ipc.ts
676 > const type = RequestType.EventListen;
677 > const request: IRawRequest = { id, type, channelName, name, arg };
678 >
679 > let uninitializedPromise: CancelablePromise<void> | null = null;
680 >
681 > const emitter = new Emitter<any>({
682 > onWillAddFirstListener: () => {
683 > const handler: IHandler = (res: IRawResponse) => emitter.fire((res as IRawEventFireResponse).data);
684 > this.handlers.set(id, handler);
685 > const doRequest = () => {
686 > this.activeRequests.add(emitter);
687 > this.sendRequest(request);
688 > };
689 > if (this.state === State.Idle) {
690 > doRequest();
691 > } else {
692 uninitializedPromise = createCancelablePromise(_ => this.whenInitialized());
693 uninitializedPromise.then(() => {
696 });
697 }
698 > }, ipc.ts
699 > onDidRemoveLastListener: () => {
700 > if (uninitializedPromise) {
701 uninitializedPromise.cancel();
702 uninitializedPromise = null;
703 > } else { ipc.ts
704 > this.activeRequests.delete(emitter);
705 > this.sendRequest({ id, type: RequestType.EventDispose });
706 > }
707 > this.handlers.delete(id);
708 > }
709 > });
710 >
711 > return emitter.event;
712 > }
713
714 private sendRequest(request: IRawRequest): void {