Commit e04f3939 authored by Benoit Lize's avatar Benoit Lize Committed by Commit Bot

blink/loader: Discard the encoded fonts after decoding.

FontResource holds onto the encoded and decoded versions of the
font. However the encoded version is never accessed after it has been
decoded, and the decoded version is never discarded. This means that we
are holding on the SharedBuffer without a need for it.

Fonts are almost always compressed, with a ~3x compression ratio
typical. From local benchmarking, encoded fonts are commonly ~500kiB on
popular news websites.

This CL discards the fonts after they've been decoded.

Change-Id: Ic72009431084cdd1e30fcd69ba1ec59788c0cede
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134291Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756195}
parent 61fb3a24
...@@ -119,6 +119,8 @@ scoped_refptr<FontCustomPlatformData> FontResource::GetCustomFontData() { ...@@ -119,6 +119,8 @@ scoped_refptr<FontCustomPlatformData> FontResource::GetCustomFontData() {
if (!font_data_) if (!font_data_)
SetStatus(ResourceStatus::kDecodeError); SetStatus(ResourceStatus::kDecodeError);
else
ClearData();
} }
return font_data_; return font_data_;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment