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

Issue 42543007: StyleResolver should update RuleSets lazily. (Closed)

Created:
7 years, 2 months ago by tasak
Modified:
7 years, 1 month ago
Reviewers:
eseidel, esprehn, dglazkov, ojan
CC:
blink-reviews, eae, dglazkov, apavlov+blink_chromium.org, adamk+blink_chromium.org, darktears, ojan, Julien - ping for review
Visibility:
Public.

Description

StyleResolver should update RuleSets lazily. This is a fixing patch for preformance regression caused by r159957. Before applying r159957, removing a style element (or modifying a style element's textcontent) destroys StyleResolver, e.g. style.textContent = ''; After applying r159957, we don't need to destroy StyleResolver. The r159957 makes us to avoid FullStyleRecalc and full RuleSet re-creation (document, and shadow trees). But the patch caused Parser/css-parser-yui.html's performance regression. Because firstly the performance test destroys StyleResolver and skip StyleResolver::appendAuthorStyleSheets. (If we have no StyleResolver, we don't need to update RuleSet, StyleInvalidationAnalysis, and so on) So we should update RuleSets lazily. This solution improves Parser/css-parser-yui.html's performance again. BUG=305885, 308796 TEST=all existing tests should pass. Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=162187

Patch Set 1 #

Total comments: 18

Patch Set 2 : Revised #

Patch Set 3 : Fixed apply issue failure #

Patch Set 4 : Filter @viewport and @font-face in lazyAppend #

Total comments: 10

Patch Set 5 : #

Patch Set 6 : append @font-face lazily #

Patch Set 7 : Rebased #

Total comments: 4

Patch Set 8 : modify Document::styleResolver #

Total comments: 14

Patch Set 9 : Revised #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+217 lines, -37 lines) Patch
M LayoutTests/fast/loader/resource-request-callbacks-expected.txt View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M Source/core/css/RuleSet.h View 1 2 3 4 5 6 7 3 chunks +4 lines, -3 lines 0 comments Download
M Source/core/css/RuleSet.cpp View 1 2 3 4 5 6 7 3 chunks +8 lines, -9 lines 0 comments Download
M Source/core/css/StyleRule.h View 1 2 3 4 3 chunks +18 lines, -0 lines 0 comments Download
M Source/core/css/resolver/ScopedStyleResolver.h View 1 2 3 4 5 6 7 2 chunks +3 lines, -1 line 0 comments Download
M Source/core/css/resolver/ScopedStyleResolver.cpp View 1 2 3 4 5 6 7 1 chunk +16 lines, -3 lines 0 comments Download
M Source/core/css/resolver/StyleResolver.h View 1 2 3 4 5 6 7 8 7 chunks +22 lines, -1 line 0 comments Download
M Source/core/css/resolver/StyleResolver.cpp View 1 2 3 4 5 6 7 8 12 chunks +128 lines, -1 line 1 comment Download
M Source/core/dom/Document.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/DocumentStyleSheetCollection.cpp View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -2 lines 0 comments Download
M Source/core/dom/Element.cpp View 1 2 3 4 5 6 7 8 3 chunks +4 lines, -4 lines 0 comments Download
M Source/core/dom/ShadowTreeStyleSheetCollection.cpp View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -2 lines 0 comments Download
M Source/core/dom/StyleEngine.h View 1 2 3 4 5 6 7 8 2 chunks +5 lines, -1 line 0 comments Download
M Source/core/dom/StyleEngine.cpp View 1 2 3 4 5 6 7 8 3 chunks +1 line, -8 lines 0 comments Download

Messages

Total messages: 19 (0 generated)
tasak
Applying this patch, Parer/css-parser-yui.html: Ignoring warm-up run (324.41025579304556 runs/s) 326.9072703849519 runs/s 326.2616128918332 runs/s 326.5104314772393 runs/s ...
7 years, 2 months ago (2013-10-25 02:22:39 UTC) #1
esprehn
You have the checks duplicated both inside styleResolver() and outside at call sites. https://codereview.chromium.org/42543007/diff/1/Source/core/css/resolver/StyleResolver.cpp File ...
7 years, 2 months ago (2013-10-25 02:37:57 UTC) #2
tasak
Thank you for reviewing. > You have the checks duplicated both inside styleResolver() and outside ...
7 years, 2 months ago (2013-10-25 10:10:09 UTC) #3
tasak
I added filter function to process @font-face and @viewport when appending author stylesheets lazily. Looking ...
7 years, 1 month ago (2013-11-05 10:35:55 UTC) #4
eseidel
7 years, 1 month ago (2013-11-05 10:39:59 UTC) #5
eseidel
Sorry, too tired tonight, but I'll definitely review this tomorrow.
7 years, 1 month ago (2013-11-05 10:40:38 UTC) #6
eseidel
I'm still not fully understanding the patch, I'll need to read it again in a ...
7 years, 1 month ago (2013-11-06 01:39:10 UTC) #7
tasak
Thank you for reviewing. https://codereview.chromium.org/42543007/diff/250001/Source/core/css/RuleSet.cpp File Source/core/css/RuleSet.cpp (right): https://codereview.chromium.org/42543007/diff/250001/Source/core/css/RuleSet.cpp#newcode402 Source/core/css/RuleSet.cpp:402: } else if (rule->isViewportRule() && ...
7 years, 1 month ago (2013-11-06 05:42:25 UTC) #8
tasak
Would you review this CL?
7 years, 1 month ago (2013-11-13 11:19:29 UTC) #9
dglazkov
I think the reason you're having problems getting people to review this is because the ...
7 years, 1 month ago (2013-11-13 16:29:22 UTC) #10
tasak
Thank you for comments. On 2013/11/13 16:29:22, Dimitri Glazkov wrote: > I think the reason ...
7 years, 1 month ago (2013-11-14 09:24:20 UTC) #11
esprehn
I think I was wrong and we should put it into styleResolver() and styleResolverIfExists() having ...
7 years, 1 month ago (2013-11-14 09:44:01 UTC) #12
tasak
I revised the first patch, i.e. modifying Document::styleResolver(). https://codereview.chromium.org/42543007/diff/520001/Source/core/css/RuleSet.h File Source/core/css/RuleSet.h (right): https://codereview.chromium.org/42543007/diff/520001/Source/core/css/RuleSet.h#newcode113 Source/core/css/RuleSet.h:113: void ...
7 years, 1 month ago (2013-11-14 11:25:45 UTC) #13
esprehn
Bunch of nits, but this is looking really good. https://codereview.chromium.org/42543007/diff/590001/Source/core/css/RuleSet.h File Source/core/css/RuleSet.h (right): https://codereview.chromium.org/42543007/diff/590001/Source/core/css/RuleSet.h#newcode126 Source/core/css/RuleSet.h:126: ...
7 years, 1 month ago (2013-11-15 10:36:32 UTC) #14
tasak
Thank you for reviewing. https://codereview.chromium.org/42543007/diff/590001/Source/core/css/RuleSet.h File Source/core/css/RuleSet.h (right): https://codereview.chromium.org/42543007/diff/590001/Source/core/css/RuleSet.h#newcode126 Source/core/css/RuleSet.h:126: void addRulesFromSheet(StyleSheetContents*, const MediaQueryEvaluator&, AddRuleFlags ...
7 years, 1 month ago (2013-11-18 08:30:52 UTC) #15
esprehn
lgtm
7 years, 1 month ago (2013-11-18 08:49:11 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tasak@google.com/42543007/720001
7 years, 1 month ago (2013-11-18 08:58:22 UTC) #17
commit-bot: I haz the power
Change committed as 162187
7 years, 1 month ago (2013-11-18 10:43:50 UTC) #18
ojan
7 years, 1 month ago (2013-11-19 17:35:05 UTC) #19
Message was sent while issue was closed.
lgtm

https://codereview.chromium.org/42543007/diff/720001/Source/core/css/resolver...
File Source/core/css/resolver/StyleResolver.cpp (right):

https://codereview.chromium.org/42543007/diff/720001/Source/core/css/resolver...
Source/core/css/resolver/StyleResolver.cpp:271: for (ListHashSet<CSSStyleSheet*,
16>::iterator it = m_pendingStyleSheets.begin(); it !=
m_pendingStyleSheets.end(); ++it) {
Is it safe for StyleResolver to hold raw pointers to CSSStyleSheets like this?
What happens if you append a stylesheet to the document and then remove it
before we've processed the pending sheets? Won't that use-after-free?

Powered by Google App Engine
This is Rietveld 408576698