mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-06 18:21:10 +02:00
*Note:* This is similar to PR 19525, which did the same thing for the OpenJPEG decoder. The advantages of doing this are: - The same JBig2 decoder is used regardless of WASM being supported or not, which means consistent rendering. - The old `Jbig2Image` implementation has various bugs and missing features. - Less code that needs to be maintained in the PDF.js project, since both the CCITT and the JBig2 decoder is replaced. The disadvantage of doing this is: - Slightly larger bundle size, however the effect is limited since a fair amount of PDF.js code can be removed. For the `gulp mozcentral` target the size increase is approximately 54 kilo-bytes (which is small compared to the 452 kilo-bytes for the JS version of the OpenJPEG decoder).
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
/* Copyright 2022 Mozilla Foundation
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
import { clearPatternCaches } from "./pattern.js";
|
|
import { clearPrimitiveCaches } from "./primitives.js";
|
|
import { clearUnicodeCaches } from "./unicode.js";
|
|
import { JBig2CCITTFaxImage } from "./jbig2_ccittFax.js";
|
|
import { JpxImage } from "./jpx.js";
|
|
|
|
function clearGlobalCaches() {
|
|
clearPatternCaches();
|
|
clearPrimitiveCaches();
|
|
clearUnicodeCaches();
|
|
|
|
// Remove the global `JBig2CCITTFaxImage`/`JpxImage` instances,
|
|
// since they may hold references to the WebAssembly modules.
|
|
JBig2CCITTFaxImage.cleanup();
|
|
JpxImage.cleanup();
|
|
}
|
|
|
|
export { clearGlobalCaches };
|