Revert json ops (#2814)

* Revert "port more ops to JSON (#2809)"

This reverts commit 137f33733d.

* Revert "port ops to JSON: compiler, errors, fetch, files (#2804)"

This reverts commit 79f82cf10e.

* Revert "Port rest of os ops to JSON (#2802)"

This reverts commit 5b2baa5c99.
This commit is contained in:
Ryan Dahl 2019-08-24 13:20:48 -07:00 committed by GitHub
parent bdc0a13261
commit 2235dd795d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 1968 additions and 1045 deletions

View file

@ -1,8 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { assert } from "./util";
import { sendAsync, sendSync, msg, flatbuffers } from "./dispatch_flatbuffers";
import { window } from "./window";
import * as dispatch from "./dispatch";
import { sendSync, sendAsync } from "./dispatch_json";
interface Timer {
id: number;
@ -38,8 +37,11 @@ function getTime(): number {
}
function clearGlobalTimeout(): void {
const builder = flatbuffers.createBuilder();
const inner = msg.GlobalTimerStop.createGlobalTimerStop(builder);
globalTimeoutDue = null;
sendSync(dispatch.OP_GLOBAL_TIMER_STOP);
let res = sendSync(builder, msg.Any.GlobalTimerStop, inner);
assert(res == null);
}
async function setGlobalTimeout(due: number, now: number): Promise<void> {
@ -50,8 +52,12 @@ async function setGlobalTimeout(due: number, now: number): Promise<void> {
assert(timeout >= 0);
// Send message to the backend.
const builder = flatbuffers.createBuilder();
msg.GlobalTimer.startGlobalTimer(builder);
msg.GlobalTimer.addTimeout(builder, timeout);
const inner = msg.GlobalTimer.endGlobalTimer(builder);
globalTimeoutDue = due;
await sendAsync(dispatch.OP_GLOBAL_TIMER, { timeout });
await sendAsync(builder, msg.Any.GlobalTimer, inner);
// eslint-disable-next-line @typescript-eslint/no-use-before-define
fireTimers();
}