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 Review URL: https://codereview.chromium.org/338673002 git-svn-id: svn://svn.chromium.org/blink/trunk@176163 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Showing
Please register or sign in to comment