]> git.proxmox.com Git - mirror_novnc.git/commit - core/websock.js
Use Typed Arrays for the Websock receive queue
authorSolly Ross <sross@redhat.com>
Wed, 20 May 2015 21:10:59 +0000 (17:10 -0400)
committerSolly Ross <sross@redhat.com>
Thu, 6 Aug 2015 18:47:03 +0000 (14:47 -0400)
commit38781d931ec18304f51ed3469faff8387e3cbc55
treec3873054ba41f7c7a25287db155177aaada9e28b
parent6c883653a23aec7220b7b8cd042c90554fcb28cc
Use Typed Arrays for the Websock receive queue

**This commit removes Base64 (and Flash) support**

This commit converts websock.js to used Typed Arrays for the
receive queue (and tweaks rfb.js to ensure that it continues
to function, since only Firefox implements
`%TypedArray%.prototype.slice`).  Base64 support was removed
to simplify code paths, and pave the way for using Typed Arrays
for the send queue as well.

This provides two advantages: first, we allocate a buffer ahead
of time, meaning the browser doesn't have to do any work dynamically
increasing the receive queue size.  Secondly, we are now able to pass
around Typed Array Views (e.g. `Uint8Array`), which are lightweight, and
don't involve copying.

The downside is that we initially allocate more memory -- we currently
start out with 4 MiB, and then automatically double when it looks like
the amount unused is getting to small.

The commit also explicitly adds a check to the compacting logic that
avoids calling the copy functions if `_rQlen === _rQi`.
15 files changed:
.gitmodules
LICENSE.txt
README.md
docs/notes
include/playback.js
include/rfb.js
include/web-socket-js-project [deleted submodule]
include/web-socket-js/README.txt [deleted file]
include/web-socket-js/WebSocketMain.swf [deleted file]
include/web-socket-js/swfobject.js [deleted file]
include/web-socket-js/web_socket.js [deleted file]
include/websock.js
tests/assertions.js
tests/test.rfb.js
tests/test.websock.js