Clear some Arrays, rather than re-initialize them, in src/display/
-code
It's generally better to re-use the same Array, by clearing out all of its elements, rather than creating a new Array.
This commit is contained in:
parent
da22146b95
commit
4078dd856c
@ -350,7 +350,7 @@ class PDFNetworkStreamFullRequestReader {
|
|||||||
for (const requestCapability of this._requests) {
|
for (const requestCapability of this._requests) {
|
||||||
requestCapability.resolve({ value: undefined, done: true });
|
requestCapability.resolve({ value: undefined, done: true });
|
||||||
}
|
}
|
||||||
this._requests = [];
|
this._requests.length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onError(status) {
|
_onError(status) {
|
||||||
@ -361,8 +361,8 @@ class PDFNetworkStreamFullRequestReader {
|
|||||||
for (const requestCapability of this._requests) {
|
for (const requestCapability of this._requests) {
|
||||||
requestCapability.reject(exception);
|
requestCapability.reject(exception);
|
||||||
}
|
}
|
||||||
this._requests = [];
|
this._requests.length = 0;
|
||||||
this._cachedChunks = [];
|
this._cachedChunks.length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onProgress(data) {
|
_onProgress(data) {
|
||||||
@ -416,7 +416,7 @@ class PDFNetworkStreamFullRequestReader {
|
|||||||
for (const requestCapability of this._requests) {
|
for (const requestCapability of this._requests) {
|
||||||
requestCapability.resolve({ value: undefined, done: true });
|
requestCapability.resolve({ value: undefined, done: true });
|
||||||
}
|
}
|
||||||
this._requests = [];
|
this._requests.length = 0;
|
||||||
if (this._manager.isPendingRequest(this._fullRequestId)) {
|
if (this._manager.isPendingRequest(this._fullRequestId)) {
|
||||||
this._manager.abortRequest(this._fullRequestId);
|
this._manager.abortRequest(this._fullRequestId);
|
||||||
}
|
}
|
||||||
@ -459,7 +459,7 @@ class PDFNetworkStreamRangeRequestReader {
|
|||||||
for (const requestCapability of this._requests) {
|
for (const requestCapability of this._requests) {
|
||||||
requestCapability.resolve({ value: undefined, done: true });
|
requestCapability.resolve({ value: undefined, done: true });
|
||||||
}
|
}
|
||||||
this._requests = [];
|
this._requests.length = 0;
|
||||||
this._close();
|
this._close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,7 +494,7 @@ class PDFNetworkStreamRangeRequestReader {
|
|||||||
for (const requestCapability of this._requests) {
|
for (const requestCapability of this._requests) {
|
||||||
requestCapability.resolve({ value: undefined, done: true });
|
requestCapability.resolve({ value: undefined, done: true });
|
||||||
}
|
}
|
||||||
this._requests = [];
|
this._requests.length = 0;
|
||||||
if (this._manager.isPendingRequest(this._requestId)) {
|
if (this._manager.isPendingRequest(this._requestId)) {
|
||||||
this._manager.abortRequest(this._requestId);
|
this._manager.abortRequest(this._requestId);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ class PDFDataTransportStreamReader {
|
|||||||
for (const requestCapability of this._requests) {
|
for (const requestCapability of this._requests) {
|
||||||
requestCapability.resolve({ value: undefined, done: true });
|
requestCapability.resolve({ value: undefined, done: true });
|
||||||
}
|
}
|
||||||
this._requests = [];
|
this._requests.length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
progressiveDone() {
|
progressiveDone() {
|
||||||
@ -266,7 +266,7 @@ class PDFDataTransportStreamRangeReader {
|
|||||||
for (const requestCapability of this._requests) {
|
for (const requestCapability of this._requests) {
|
||||||
requestCapability.resolve({ value: undefined, done: true });
|
requestCapability.resolve({ value: undefined, done: true });
|
||||||
}
|
}
|
||||||
this._requests = [];
|
this._requests.length = 0;
|
||||||
}
|
}
|
||||||
this._done = true;
|
this._done = true;
|
||||||
this._stream._removeRangeReader(this);
|
this._stream._removeRangeReader(this);
|
||||||
@ -295,7 +295,7 @@ class PDFDataTransportStreamRangeReader {
|
|||||||
for (const requestCapability of this._requests) {
|
for (const requestCapability of this._requests) {
|
||||||
requestCapability.resolve({ value: undefined, done: true });
|
requestCapability.resolve({ value: undefined, done: true });
|
||||||
}
|
}
|
||||||
this._requests = [];
|
this._requests.length = 0;
|
||||||
this._stream._removeRangeReader(this);
|
this._stream._removeRangeReader(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user