Skip to content

Commit

Permalink
Adds support to accept transfers in sink.enqueue method.
Browse files Browse the repository at this point in the history
  • Loading branch information
mukulmishra18 committed Jul 6, 2017
1 parent 4ad80e1 commit b8be2db
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1433,13 +1433,19 @@ MessageHandler.prototype = {
let targetName = data.sourceName;
let capability = createPromiseCapability();

let sendStreamRequest = ({ stream, chunk, success, reason, }) => {
let sendStreamRequest = ({ stream, chunk, transfers,
success, reason, }) => {
if (transfers) {
this.postMessage({ sourceName, targetName, stream, streamId,
chunk, success, reason, }, transfers);
return;
}
this.comObj.postMessage({ sourceName, targetName, stream, streamId,
chunk, success, reason, });
};

let streamSink = {
enqueue(chunk, size = 1) {
enqueue(chunk, size = 1, transfers) {
let lastDesiredSize = this.desiredSize;
this.desiredSize -= size;
// Enqueue decreases the desiredSize property of sink,
Expand All @@ -1449,7 +1455,7 @@ MessageHandler.prototype = {
this.sinkCapability = createPromiseCapability();
this.ready = this.sinkCapability.promise;
}
sendStreamRequest({ stream: 'enqueue', chunk, });
sendStreamRequest({ stream: 'enqueue', chunk, transfers, });
},

close() {
Expand Down

0 comments on commit b8be2db

Please sign in to comment.