mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-02 20:37:21 +02:00
Merge pull request #20706 from Snuffleupagus/ensureDebugMetadata-getOrInsertComputed
Use `Map.prototype.getOrInsertComputed()` in the `ensureDebugMetadata` helper
This commit is contained in:
commit
ad0a310394
@ -1,3 +1,18 @@
|
|||||||
|
/* Copyright 2025 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 { Util } from "../shared/util.js";
|
import { Util } from "../shared/util.js";
|
||||||
|
|
||||||
const FORCED_DEPENDENCY_LABEL = "__forcedDependency";
|
const FORCED_DEPENDENCY_LABEL = "__forcedDependency";
|
||||||
@ -50,17 +65,11 @@ class BBoxReader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ensureDebugMetadata = (map, key) => {
|
const ensureDebugMetadata = (map, key) =>
|
||||||
if (!map) {
|
map?.getOrInsertComputed(key, () => ({
|
||||||
return undefined;
|
dependencies: new Set(),
|
||||||
}
|
isRenderingOperation: false,
|
||||||
let value = map.get(key);
|
}));
|
||||||
if (!value) {
|
|
||||||
value = { dependencies: new Set(), isRenderingOperation: false };
|
|
||||||
map.set(key, value);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {"lineWidth" | "lineCap" | "lineJoin" | "miterLimit" | "dash" |
|
* @typedef {"lineWidth" | "lineCap" | "lineJoin" | "miterLimit" | "dash" |
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user