summaryrefslogtreecommitdiff
path: root/js/dispatch.ts
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2018-09-22 00:59:26 -0700
committerRyan Dahl <ry@tinyclouds.org>2018-09-22 03:59:26 -0400
commit7a0670a9512981cee18d1960db46a3b57844595d (patch)
treecfec94c96d7b46365a18b627eeffbe07068a727b /js/dispatch.ts
parent8e958d3ad68e610061e82fb9f456eab79330633e (diff)
Implement deno.trace() (#795)
Diffstat (limited to 'js/dispatch.ts')
-rw-r--r--js/dispatch.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/js/dispatch.ts b/js/dispatch.ts
index 8c2514c32..037b77a85 100644
--- a/js/dispatch.ts
+++ b/js/dispatch.ts
@@ -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) {