Files
react-native-devtools-frontend/extensions/cxx_debugging/tests/DevToolsPluginTestWorker.ts
T
Kim-Anh Tran 2df74668bf Report loaded symbol resources to DevTools
Calling into DevTools in order to report loaded or missing symbol files.

Bug: 40746829
Change-Id: I0dabc00e1079d9a403ba850edecf31c6835432d2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5308065
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
2024-03-11 08:23:58 +00:00

44 lines
1.9 KiB
TypeScript

// Copyright 2023 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {RPCInterface} from '../src/DevToolsPluginWorker.js';
import {ResourceLoader} from '../src/MEMFSResourceLoader.js';
import {type WasmValue} from '../src/WasmTypes.js';
export interface TestWorkerInterface {
getWasmMemoryForTest(offset: number, length: number, stopId: unknown): Promise<ArrayBuffer>;
getWasmLocalForTest(local: number, stopId: unknown): Promise<WasmValue>;
getWasmGlobalForTest(global: number, stopId: unknown): Promise<WasmValue>;
getWasmOpForTest(op: number, stopId: unknown): Promise<WasmValue>;
reportResourceLoadForTest(
resourceUrl: string,
status: {success: boolean; errorMessage?: string | undefined; size?: number | undefined;}): Promise<void>;
}
class TestWorker extends RPCInterface implements TestWorkerInterface {
async getWasmLocalForTest(local: number, stopId: unknown): Promise<WasmValue> {
return this.getWasmLocal(local, stopId);
}
async getWasmGlobalForTest(global: number, stopId: unknown): Promise<WasmValue> {
return this.getWasmGlobal(global, stopId);
}
async getWasmOpForTest(op: number, stopId: unknown): Promise<WasmValue> {
return this.getWasmOp(op, stopId);
}
async getWasmMemoryForTest(offset: number, length: number, stopId: unknown): Promise<ArrayBuffer> {
return this.getWasmLinearMemory(offset, length, stopId);
}
reportResourceLoadForTest(
resourceUrl: string,
status: {success: boolean; errorMessage?: string | undefined; size?: number | undefined;}): Promise<void> {
return this.reportResourceLoad(resourceUrl, status)
}
}
// @ts-expect-error
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
new TestWorker(self as any, new ResourceLoader());
}