Fixing concurent draw page requests for de-allocation
This commit is contained in:
parent
08830731c0
commit
1e96c73207
11
src/api.js
11
src/api.js
@ -203,8 +203,9 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
|||||||
stats.time('Overall');
|
stats.time('Overall');
|
||||||
// If there is no displayReadyPromise yet, then the operatorList was never
|
// If there is no displayReadyPromise yet, then the operatorList was never
|
||||||
// requested before. Make the request and create the promise.
|
// requested before. Make the request and create the promise.
|
||||||
if (!this.displayReadyPromise) {
|
if (!this.displayReadyPromise || this.destroyed) {
|
||||||
this.displayReadyPromise = new Promise();
|
this.displayReadyPromise = new Promise();
|
||||||
|
this.destroyed = false;
|
||||||
|
|
||||||
this.stats.time('Page Request');
|
this.stats.time('Page Request');
|
||||||
this.transport.messageHandler.send('RenderPageRequest', {
|
this.transport.messageHandler.send('RenderPageRequest', {
|
||||||
@ -250,6 +251,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
|||||||
// Always defer call to display() to work around bug in
|
// Always defer call to display() to work around bug in
|
||||||
// Firefox error reporting from XHR callbacks.
|
// Firefox error reporting from XHR callbacks.
|
||||||
setTimeout(function pageSetTimeout() {
|
setTimeout(function pageSetTimeout() {
|
||||||
|
delete self.operatorList;
|
||||||
self.displayReadyPromise.resolve();
|
self.displayReadyPromise.resolve();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -305,7 +307,6 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
|||||||
gfx.executeOperatorList(operatorList, startIdx, next, stepper);
|
gfx.executeOperatorList(operatorList, startIdx, next, stepper);
|
||||||
if (startIdx == length) {
|
if (startIdx == length) {
|
||||||
gfx.endDrawing();
|
gfx.endDrawing();
|
||||||
delete self.operatorList;
|
|
||||||
stats.timeEnd('Rendering');
|
stats.timeEnd('Rendering');
|
||||||
stats.timeEnd('Overall');
|
stats.timeEnd('Overall');
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
@ -333,6 +334,12 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
|||||||
};
|
};
|
||||||
promise.resolve(operationList);
|
promise.resolve(operationList);
|
||||||
return promise;
|
return promise;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Destroys allocated by page resources.
|
||||||
|
*/
|
||||||
|
destroy: function() {
|
||||||
|
this.destroyed = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return PDFPageProxy;
|
return PDFPageProxy;
|
||||||
|
@ -756,6 +756,7 @@ var PageView = function pageView(container, pdfPage, id, scale,
|
|||||||
div.removeAttribute('data-loaded');
|
div.removeAttribute('data-loaded');
|
||||||
|
|
||||||
delete this.canvas;
|
delete this.canvas;
|
||||||
|
this.pdfPage.destroy();
|
||||||
|
|
||||||
this.loadingIconDiv = document.createElement('div');
|
this.loadingIconDiv = document.createElement('div');
|
||||||
this.loadingIconDiv.className = 'loadingIcon';
|
this.loadingIconDiv.className = 'loadingIcon';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user