Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Issue 2066253002: Fix Refcount in FontDataCache for objects from FontFallbackIterator (Closed)

Created:
4 years, 6 months ago by drott
Modified:
4 years, 6 months ago
Reviewers:
haraken, Yuta Kitamura, eae, tzik
CC:
ajuma+watch_chromium.org, darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-platform-graphics_chromium.org, Rik, chromium-reviews, danakj+watch_chromium.org, dglazkov+blink, dshwang, drott+blinkwatch_chromium.org, krit, f(malita), jbroman, Justin Novosad, pdr+graphicswatchlist_chromium.org, rwlbuis, Stephen Chennney
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix Refcount in FontDataCache for objects from FontFallbackIterator FontFallbackIterator did previously not maintain the refcount in FontDataCache correctly. All calls to FontDataCache::get() should be balanced with a call to FontCache::releaseFontData(). FontFallbackIterator does not ensure this, so we'll end up never moving fonts to m_inactiveFontData in FontDataCache, and thus practically never releasing them on PurgeIfNeeded. The approach for fixing this is to add a destructor to FontDataForRangeSet so that those types of SimpleFontDatas that need to be released in the FontDataCache actually are released. FontDataForRangeSet is the data structure that is returned from FontFallbackIterator to HarfBuzzShaper. So when the shaper is done using the font, the refcount can be reduced. In order to ensure the correct lifecyle for when the chache-releasing destructor is called, and avoid additional copies, FontDataForRangeSet is also turned into a RefPtr in this CL. This helps to simplify the code on the HarfBuzzShaper side. Unfortunately I did not see a way to create an automated test for this. Local testing on Linux and Mac shows with logging added to FontDataCache and the FontDataCache target size values reduced, then visiting a URL which cycles a set of URLs in the same renderer, this change reintroduces effective purges in FontDataCache, while there are no effective purges in FontDataCache without this change. Simple path maintains the refcounting correctly and does the releaseFontData calls in FontFallbackLists destructor. So this change is likely to affect memory consumption of the complex font code path positively for long running renderer processes. BUG=620283 R=eae,tzik Committed: https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35 Cr-Commit-Position: refs/heads/master@{#401269}

Patch Set 1 #

Total comments: 1

Patch Set 2 : Fallback and fontDataAt() calls do not need release calls #

Patch Set 3 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+114 lines, -68 lines) Patch
M third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/blink_platform.gypi View 1 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/FontDataForRangeSet.h View 3 chunks +16 lines, -4 lines 0 comments Download
A third_party/WebKit/Source/platform/fonts/FontDataForRangeSet.cpp View 1 chunk +24 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/FontFallbackIterator.h View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/FontFallbackIterator.cpp View 1 2 7 chunks +20 lines, -15 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp View 2 chunks +5 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp View 1 3 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/GlyphPageTreeNodeTest.cpp View 4 chunks +9 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/SegmentedFontData.h View 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/SegmentedFontData.cpp View 4 chunks +17 lines, -17 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp View 1 5 chunks +8 lines, -10 lines 0 comments Download

Messages

Total messages: 28 (10 generated)
drott
PTAL. haraken@chromium.org, yutak@chromium.org, please review CSSSegmentedFontFace, thanks.
4 years, 6 months ago (2016-06-15 11:50:11 UTC) #2
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2066253002/1
4 years, 6 months ago (2016-06-15 11:50:29 UTC) #4
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/87946)
4 years, 6 months ago (2016-06-15 12:29:26 UTC) #6
eae
Exciting!
4 years, 6 months ago (2016-06-21 09:17:37 UTC) #7
eae
LGTM https://codereview.chromium.org/2066253002/diff/1/third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp File third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp (right): https://codereview.chromium.org/2066253002/diff/1/third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp#newcode137 third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp:137: const SimpleFontData* rangeFontData = segmented->faceAt(i)->fontData(); Do we need ...
4 years, 6 months ago (2016-06-21 09:19:13 UTC) #8
haraken
Sorry, I missed this one. LGTM!
4 years, 6 months ago (2016-06-21 09:21:47 UTC) #9
drott
Thanks for the reviews, there still seems to be some unbalanced calls. It's really hard ...
4 years, 6 months ago (2016-06-21 11:37:48 UTC) #10
haraken
On 2016/06/21 11:37:48, drott wrote: > Thanks for the reviews, there still seems to be ...
4 years, 6 months ago (2016-06-21 13:32:06 UTC) #11
drott
Fallback and fontDataAt() calls do not need release calls
4 years, 6 months ago (2016-06-22 11:55:06 UTC) #12
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2066253002/20001
4 years, 6 months ago (2016-06-22 11:55:34 UTC) #14
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios-device on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds/24735) ios-device-gn on ...
4 years, 6 months ago (2016-06-22 11:57:10 UTC) #16
drott
Rebased
4 years, 6 months ago (2016-06-22 12:11:20 UTC) #18
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2066253002/40001
4 years, 6 months ago (2016-06-22 12:11:27 UTC) #19
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-06-22 13:25:35 UTC) #21
eae
LGTM Changes look good, let's give this a try! Thank you.
4 years, 6 months ago (2016-06-22 13:28:28 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2066253002/40001
4 years, 6 months ago (2016-06-22 13:31:03 UTC) #25
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 6 months ago (2016-06-22 13:35:35 UTC) #26
commit-bot: I haz the power
4 years, 6 months ago (2016-06-22 13:37:06 UTC) #28
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35
Cr-Commit-Position: refs/heads/master@{#401269}

Powered by Google App Engine
This is Rietveld 408576698