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

Issue 338673002: Reduce the number of CachedUAStyles (Closed)

Created:
6 years, 6 months ago by pdr.
Modified:
6 years, 6 months ago
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-rendering, dglazkov+blink, eae+blinkwatch, ed+blinkwatch_opera.com, jchaffraix+rendering, leviw+renderwatch, rwlbuis, rune+blink, zoltan1
Project:
blink
Visibility:
Public.

Description

Reduce the number of CachedUAStyles CachedUAStyles are large (160b) and not cheap to create because they include several Length objects which have non-trivial destructors, making CachedUAStyles expensive to destruct. This patch reduces the number of CachedUAStyles by only creating them when needed. There are two changes in this patch: 1) CachedUAStyle& is no longer a member on StyleAdjuster but is instead passed in through StyleAdjuster::adjustRenderStyle. 2) The cached UA style is now constructed as-needed in StyleResolverState::cacheUserAgentBorderAndBackground. StyleResolverState always owned the CachedUAStyle but this patch makes it explicit by changing the type to OwnPtr<CachedUAStyle>. A null check was needed in RenderTheme::adjustStyle but otherwise CachedUAStyle was not accessed without being set. Before patch: facebook.com - 19,850 CachedUAStyles constructed wikipedia cat - 22,686 CachedUAStyles constructed With patch: facebook.com - 538 CachedUAStyles constructed wikipedia cat - 16 CachedUAStyles constructed Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=176163

Patch Set 1 #

Patch Set 2 : Ownptrization and a null check #

Total comments: 2

Patch Set 3 : Return a create that somehow escaped #

Unified diffs Side-by-side diffs Delta from patch set Stats (+39 lines, -32 lines) Patch
M Source/core/css/resolver/StyleAdjuster.h View 1 chunk +3 lines, -5 lines 0 comments Download
M Source/core/css/resolver/StyleAdjuster.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/css/resolver/StyleResolver.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/css/resolver/StyleResolverState.h View 1 2 chunks +8 lines, -3 lines 0 comments Download
M Source/core/rendering/RenderTheme.h View 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/rendering/RenderTheme.cpp View 1 4 chunks +7 lines, -5 lines 0 comments Download
M Source/core/rendering/RenderThemeChromiumMac.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderThemeChromiumMac.mm View 1 1 chunk +3 lines, -2 lines 0 comments Download
M Source/core/rendering/style/CachedUAStyle.h View 1 2 2 chunks +11 lines, -10 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
pdr.
6 years, 6 months ago (2014-06-15 01:55:54 UTC) #1
abarth-chromium
Seems sensible to me, but I don't hardly know this code.
6 years, 6 months ago (2014-06-15 03:44:46 UTC) #2
pdr.
On 2014/06/15 03:44:46, abarth wrote: > Seems sensible to me, but I don't hardly know ...
6 years, 6 months ago (2014-06-15 03:58:35 UTC) #3
esprehn
lgtm, strange, I thought eseidel had made the CachedUAStyle heap allocated a long time ago. ...
6 years, 6 months ago (2014-06-15 05:10:00 UTC) #4
pdr.
Thanks for the review. I haven't run the numbers but I will update this review ...
6 years, 6 months ago (2014-06-15 05:33:46 UTC) #5
pdr.
The CQ bit was checked by pdr@chromium.org
6 years, 6 months ago (2014-06-15 05:35:08 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pdr@chromium.org/338673002/40001
6 years, 6 months ago (2014-06-15 05:36:12 UTC) #7
commit-bot: I haz the power
6 years, 6 months ago (2014-06-15 07:13:18 UTC) #8
Message was sent while issue was closed.
Change committed as 176163

Powered by Google App Engine
This is Rietveld 408576698