mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-02 08:10:59 +02:00
Remove the CompilerOutput.prototype.finalData getter (PR 21053 follow-up)
Return the data as-is from the `CFFCompiler.prototype.compile` method, rather than making a copy of it first. The reason that it was implemented this way in PR 21053 was to avoid keeping a potentially large `ArrayBuffer` alive, see https://github.com/mozilla/pdf.js/pull/21053#discussion_r3045402988 Having traced all the call-sites in the font-code that directly or indirectly invoke that code, I've now managed to conclude that the compiled CFF-data is never stored on the `Font` instance and using the data as-is thus shouldn't increase permanent memory usage.
This commit is contained in:
parent
6d5e8696c4
commit
521f4dc554
@ -1400,12 +1400,6 @@ class CompilerOutput {
|
||||
return this.#buf.subarray(0, this.#pos);
|
||||
}
|
||||
|
||||
get finalData() {
|
||||
const data = this.#buf.slice(0, this.#pos);
|
||||
this.#buf = null;
|
||||
return data;
|
||||
}
|
||||
|
||||
get length() {
|
||||
return this.#pos;
|
||||
}
|
||||
@ -1534,7 +1528,7 @@ class CFFCompiler {
|
||||
// the sanitizer will bail out. Add a dummy byte to avoid that.
|
||||
output.add([0]);
|
||||
|
||||
return output.finalData;
|
||||
return output.data;
|
||||
}
|
||||
|
||||
encodeNumber(value) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user