blink/loader: Don't clear decoded data in FontResource.
FontResource clears the decoded data when all clients are removed. This is not interacting well with a recent change, https://chromium-review.googlesource.com/c/chromium/src/+/2134291. The change above discards the encoded data after it has been decoded, as the encoded data is never used afterwards. However, when all clients of a FontResource instance are destroyed (typically when the @font-face src value object is destroyed), we clear the decoded data, but do not remove the FontResource from the memory cache. This means that the following scenario: 1. CSSFontFaceSrcValue is destroyed (typically after a navigation) 2. *No GC* 3. A new document is parsed, and the font is found in the memory cache The newly-matched FontResource is not usable, since it doesn't hold a decoded or encoded representation, triggering console messages, which appear as a regression in the linked bug. This can be fixed in two ways: - Revert the encoded data clearing patch above - Don't drop the decoded data when clients disappear The second solution is preferable, since once all clients have disappeared, the resource will not outlive the next GC cycle unless claimed in the meantime. However clearing the encoded data reduces memory footprint in steady state. In addition, the current behavior leads to a new decompression of the font resource at each navigation, which is wasteful. As a consequence, this patch removes the clearing of decoded data once clients are gone. This was verified as removing the console warnings on cnn.com, which is one of the sites triggering the alert on perf bots. Bug: 1067226, 1067930 Change-Id: I3ebb96b8e310a2d6cf46fbbedfdce95999b520de Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2141924Reviewed-by:Kinuko Yasuda <kinuko@chromium.org> Commit-Queue: Benoit L <lizeb@chromium.org> Cr-Commit-Position: refs/heads/master@{#758179}
Showing
Please register or sign in to comment