New issue
Advanced search Search tips

Issue 620283 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 617568



Sign in to add a comment

Complex Path does not maintain refcount in FontDataCache

Project Member Reported by drott@chromium.org, Jun 15 2016

Issue description

FontFallbackIterator does not correctly maintain the refcount in FontDataCache. 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.


 
Project Member

Comment 1 by bugdroid1@chromium.org, Jun 22 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35

commit 4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35
Author: drott <drott@chromium.org>
Date: Wed Jun 22 13:35:16 2016

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

Review-Url: https://codereview.chromium.org/2066253002
Cr-Commit-Position: refs/heads/master@{#401269}

[modify] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp
[modify] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/platform/blink_platform.gypi
[add] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/platform/fonts/FontDataForRangeSet.cpp
[modify] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/platform/fonts/FontDataForRangeSet.h
[modify] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/platform/fonts/FontFallbackIterator.cpp
[modify] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/platform/fonts/FontFallbackIterator.h
[modify] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp
[modify] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp
[modify] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNodeTest.cpp
[modify] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/platform/fonts/SegmentedFontData.cpp
[modify] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/platform/fonts/SegmentedFontData.h
[modify] https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp

Comment 2 by drott@chromium.org, Jun 22 2016

Status: Fixed (was: Started)

Sign in to add a comment