[Pkg-javascript-commits] [pdf.js] 56/210: Remove LegacyPromise in src/core/chunked_stream.js

David Prévot taffit at moszumanska.debian.org
Thu Jun 5 14:21:01 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch upstream
in repository pdf.js.

commit 89c11ca9a21ccce56410ece90acd9eb9c4cd2725
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Wed Apr 23 16:33:42 2014 +0200

    Remove LegacyPromise in src/core/chunked_stream.js
---
 src/core/chunked_stream.js | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/core/chunked_stream.js b/src/core/chunked_stream.js
index 268a215..69722fa 100644
--- a/src/core/chunked_stream.js
+++ b/src/core/chunked_stream.js
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 /* globals assert, MissingDataException, isInt, NetworkManager, Promise,
-           isEmptyObj, LegacyPromise */
+           isEmptyObj, createPromiseCapability */
 
 'use strict';
 
@@ -278,7 +278,8 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
     this.requestsByChunk = {};
     this.callbacksByRequest = {};
 
-    this.loadedStream = new LegacyPromise();
+    this._loadedStreamCapability = createPromiseCapability();
+
     if (args.initialData) {
       this.setInitialData(args.initialData);
     }
@@ -289,7 +290,7 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
     setInitialData: function ChunkedStreamManager_setInitialData(data) {
       this.stream.onReceiveInitialData(data);
       if (this.stream.allChunksLoaded()) {
-        this.loadedStream.resolve(this.stream);
+        this._loadedStreamCapability.resolve(this.stream);
       } else if (this.msgHandler) {
         this.msgHandler.send('DocProgress', {
           loaded: data.length,
@@ -299,7 +300,7 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
     },
 
     onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
-      return this.loadedStream;
+      return this._loadedStreamCapability.promise;
     },
 
     // Get all the chunks that are not yet loaded and groups them into
@@ -307,7 +308,7 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
     requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
       var missingChunks = this.stream.getMissingChunks();
       this.requestChunks(missingChunks);
-      return this.loadedStream;
+      return this._loadedStreamCapability.promise;
     },
 
     requestChunks: function ChunkedStreamManager_requestChunks(chunks,
@@ -443,7 +444,7 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
 
       this.stream.onReceiveData(begin, chunk);
       if (this.stream.allChunksLoaded()) {
-        this.loadedStream.resolve(this.stream);
+        this._loadedStreamCapability.resolve(this.stream);
       }
 
       var loadedRequests = [];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list