From 24b0e91d8096f84a114f662e3eb42c83d0d3878d Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Mon, 9 Jul 2018 03:35:34 +0200 Subject: Move buffers between V8 and native * send()/recv() now operate on TypedArrays rather than ArrayBuffers. * Remove a copy (through ArrayBuffer.slice()) from the send path. * Remove a copy (through v8::ArrayBuffer::New()) from the return path. * After moving a buffer from JS to native, the ArrayBuffer object and it's views are made inaccessible ('neutered'). * `struct deno_buf` now holds two [ptr, length] tuples, one for the actual memory allocation, and one for the logical data contained therein. This is necessary because flatbuffers fills it's buffer bottom-up, so the serialized blob doesn't start at beginning of the buffer, but somewhere in the middle. --- js/deno.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/deno.d.ts') diff --git a/js/deno.d.ts b/js/deno.d.ts index f554135bc..a54dab851 100644 --- a/js/deno.d.ts +++ b/js/deno.d.ts @@ -1,10 +1,10 @@ // Copyright 2018 Ryan Dahl // All rights reserved. MIT License. -type MessageCallback = (msg: ArrayBuffer) => void; +type MessageCallback = (msg: Uint8Array) => void; interface Deno { recv(cb: MessageCallback): void; - send(msg: ArrayBuffer): null | ArrayBuffer; + send(msg: ArrayBufferView): null | Uint8Array; print(x: string): void; } -- cgit v1.2.3