From 9b6d0d994dbe3df5b29b96026958c84f4bc54592 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 10 Dec 2022 12:25:50 +0100 Subject: [PATCH] Remove the API-caching of annotation-data This was essentially done only to compensate for the viewer calling `PDFPageProxy.getAnnotations` unconditionally on every annotationLayer-rendering invocation. With the previous patch that's no longer happening, and this API-caching should thus no longer be necessary. --- src/display/api.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/display/api.js b/src/display/api.js index 061c1ddae..59f9c80f5 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1258,7 +1258,6 @@ class PDFPageProxy { this.cleanupAfterRender = false; this.pendingCleanup = false; this._intentStates = new Map(); - this._annotationPromises = new Map(); this.destroyed = false; } @@ -1328,15 +1327,10 @@ class PDFPageProxy { getAnnotations({ intent = "display" } = {}) { const intentArgs = this._transport.getRenderingIntent(intent); - let promise = this._annotationPromises.get(intentArgs.cacheKey); - if (!promise) { - promise = this._transport.getAnnotations( - this._pageIndex, - intentArgs.renderingIntent - ); - this._annotationPromises.set(intentArgs.cacheKey, promise); - } - return promise; + return this._transport.getAnnotations( + this._pageIndex, + intentArgs.renderingIntent + ); } /** @@ -1655,7 +1649,6 @@ class PDFPageProxy { bitmap.close(); } this._bitmaps.clear(); - this._annotationPromises.clear(); this._jsActionsPromise = null; this.pendingCleanup = false; return Promise.all(waitOn); @@ -1689,7 +1682,6 @@ class PDFPageProxy { this._intentStates.clear(); this.objs.clear(); - this._annotationPromises.clear(); this._jsActionsPromise = null; if (resetStats && this._stats) { this._stats = new StatTimer();