Commit 4aca52d2 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Fix the performance degradation after removing CString

After removing CString in blink, the performance degradation(1.6%) has been reported
on Android Nexus6 WebView Perf bot with system_health.memory_mobile benchmark.

To fix the performance regresssion, this CL makes FontFaceCreationParams::Filename()
return const std::string& to avoid a copy of std::string, And also, this CL moves
|fallback_data.filename| to |fallback_font->filename| by using std::move in
FontCache::GetFontForCharacter().

Bug: 974762, 950077
Change-Id: I7e08f56e58b96d326982e7d4d26866d4cafab881
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1701628
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678541}
parent 0e3c84e1
...@@ -86,7 +86,7 @@ class FontFaceCreationParams { ...@@ -86,7 +86,7 @@ class FontFaceCreationParams {
DCHECK_EQ(creation_type_, kCreateFontByFamily); DCHECK_EQ(creation_type_, kCreateFontByFamily);
return family_; return family_;
} }
std::string Filename() const { const std::string& Filename() const {
DCHECK_EQ(creation_type_, kCreateFontByFciIdAndTtcIndex); DCHECK_EQ(creation_type_, kCreateFontByFciIdAndTtcIndex);
return filename_; return filename_;
} }
......
...@@ -72,7 +72,7 @@ void FontCache::GetFontForCharacter( ...@@ -72,7 +72,7 @@ void FontCache::GetFontForCharacter(
gfx::GetFallbackFontForChar(c, locale); gfx::GetFallbackFontForChar(c, locale);
fallback_font->name = String::FromUTF8(fallback_data.name.data(), fallback_font->name = String::FromUTF8(fallback_data.name.data(),
fallback_data.name.length()); fallback_data.name.length());
fallback_font->filename = fallback_data.filename; fallback_font->filename = std::move(fallback_data.filename);
fallback_font->fontconfig_interface_id = 0; fallback_font->fontconfig_interface_id = 0;
fallback_font->ttc_index = fallback_data.ttc_index; fallback_font->ttc_index = fallback_data.ttc_index;
fallback_font->is_bold = fallback_data.is_bold; fallback_font->is_bold = fallback_data.is_bold;
......
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