mirror of
https://github.com/denoland/deno.git
synced 2025-08-02 10:02:23 +00:00
Implement deno.trace() (#795)
This commit is contained in:
parent
8e958d3ad6
commit
7a0670a951
6 changed files with 167 additions and 0 deletions
|
@ -4,6 +4,7 @@ import { flatbuffers } from "flatbuffers";
|
|||
import * as fbs from "gen/msg_generated";
|
||||
import * as errors from "./errors";
|
||||
import * as util from "./util";
|
||||
import { maybePushTrace } from "./trace";
|
||||
|
||||
let nextCmdId = 0;
|
||||
const promiseTable = new Map<number, util.Resolvable<fbs.Base>>();
|
||||
|
@ -29,6 +30,7 @@ export function sendAsync(
|
|||
msgType: fbs.Any,
|
||||
msg: flatbuffers.Offset
|
||||
): Promise<fbs.Base> {
|
||||
maybePushTrace(msgType, false); // add to trace if tracing
|
||||
const [cmdId, resBuf] = sendInternal(builder, msgType, msg, false);
|
||||
util.assert(resBuf == null);
|
||||
const promise = util.createResolvable<fbs.Base>();
|
||||
|
@ -42,6 +44,7 @@ export function sendSync(
|
|||
msgType: fbs.Any,
|
||||
msg: flatbuffers.Offset
|
||||
): null | fbs.Base {
|
||||
maybePushTrace(msgType, true); // add to trace if tracing
|
||||
const [cmdId, resBuf] = sendInternal(builder, msgType, msg, true);
|
||||
util.assert(cmdId >= 0);
|
||||
if (resBuf == null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue