Merge pull request #10872 from Snuffleupagus/api-clear-arrays

Re-use, rather than re-creating, some `Array`s when resetting them in `src/display/api.js`
This commit is contained in:
Tim van der Meij 2019-05-31 12:55:41 +02:00 committed by GitHub
commit 3b58863d4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1377,7 +1377,7 @@ class LoopbackPort {
} }
terminate() { terminate() {
this._listeners = []; this._listeners.length = 0;
} }
} }
@ -1760,8 +1760,8 @@ class WorkerTransport {
waitOn.push(page._destroy()); waitOn.push(page._destroy());
} }
}); });
this.pageCache = []; this.pageCache.length = 0;
this.pagePromises = []; this.pagePromises.length = 0;
// We also need to wait for the worker to finish its long running tasks. // We also need to wait for the worker to finish its long running tasks.
const terminated = this.messageHandler.sendWithPromise('Terminate', null); const terminated = this.messageHandler.sendWithPromise('Terminate', null);
waitOn.push(terminated); waitOn.push(terminated);