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

Issue 28553005: Avoid parsing css text if there are identical inline style blocks. (Closed)

Created:
7 years, 2 months ago by tasak
Modified:
6 years, 11 months ago
Reviewers:
esprehn, adamk, ojan
CC:
blink-reviews, eae+blinkwatch, dglazkov+blink, apavlov+blink_chromium.org, adamk+blink_chromium.org, darktears
Visibility:
Public.

Description

Avoid parsing css text if there are identical inline style blocks. (1) StyleEngine has two hashmaps, one is a mapping from css text to StyleSheetContents and the other is a mapping from StyleSheetContents to css text. When destroying StyleSheetContents, using the above mapping to remove css text. The hashmaps are only for non-quirks document. Because non-quirks document cannot share styles with quirks document. (2) made StyleSheetContents::checkLoaded to invoke new clients' sheetLoaded. To do so, (2-1) moved m_loadCompleted flag from StyleSheetContents to CSSStyleSheet, (2-2) added more "protect" to StyleSheetContents::checkLoaded to avoid CSSStyleSheet (i.e. client) and ownerNode being deleted by scripts, and (2-3) modified StyleSheetContents::loadCompleted() to see whether all clients completed loading. (3) LinkStyle::setCSSStyleSheet should use StyleSheetContents' checkLoaded. Because now checkLoaded invokes only new clients' sheetLoaded. We don't need to directly invoke LinkStyle::sheetLoaded (this breaks m_loadCompleted flag and causes assertion failure). BUG=308781 TEST=all existing tests covers, so the tests should pass. Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=165139

Patch Set 1 #

Total comments: 6

Patch Set 2 : Added StyleSheetContentsCache class #

Total comments: 8

Patch Set 3 : #

Total comments: 9

Patch Set 4 : Share StyleSheetContents directly #

Patch Set 5 : Rebased #

Total comments: 13

Patch Set 6 : #

Total comments: 6

Patch Set 7 : Remove clearSheetCache #

Patch Set 8 : #

Total comments: 2

Patch Set 9 : Patch for landing #

Unified diffs Side-by-side diffs Delta from patch set Stats (+186 lines, -26 lines) Patch
A PerformanceTests/ShadowDOM/StyleSheetInsert.html View 1 2 1 chunk +36 lines, -0 lines 0 comments Download
M Source/core/css/CSSStyleSheet.h View 1 2 3 4 5 6 7 3 chunks +6 lines, -0 lines 0 comments Download
M Source/core/css/CSSStyleSheet.cpp View 1 2 3 4 5 6 7 8 5 chunks +22 lines, -0 lines 0 comments Download
M Source/core/css/StyleSheetContents.h View 1 2 3 4 5 6 7 3 chunks +3 lines, -3 lines 0 comments Download
M Source/core/css/StyleSheetContents.cpp View 1 2 3 4 5 6 7 8 chunks +50 lines, -15 lines 0 comments Download
M Source/core/dom/StyleElement.cpp View 1 2 3 4 5 6 7 1 chunk +1 line, -6 lines 0 comments Download
M Source/core/dom/StyleEngine.h View 1 2 3 4 5 6 7 2 chunks +5 lines, -0 lines 0 comments Download
M Source/core/dom/StyleEngine.cpp View 1 2 3 4 5 6 7 2 chunks +62 lines, -0 lines 0 comments Download
M Source/core/html/HTMLLinkElement.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -2 lines 0 comments Download

Messages

Total messages: 27 (0 generated)
tasak
7 years, 2 months ago (2013-10-18 10:15:45 UTC) #1
tasak
Looking at http://www.chromestatus.com/features, size of inline style blocks are: Size = 6739 Size = 90 ...
7 years, 2 months ago (2013-10-18 10:27:59 UTC) #2
dglazkov
Neat! https://codereview.chromium.org/28553005/diff/1/Source/core/dom/StyleElement.cpp File Source/core/dom/StyleElement.cpp (right): https://codereview.chromium.org/28553005/diff/1/Source/core/dom/StyleElement.cpp#newcode38 Source/core/dom/StyleElement.cpp:38: static const unsigned cacheableTextContentSizeLimit = 256; How did ...
7 years, 2 months ago (2013-10-18 16:56:18 UTC) #3
esprehn_google.com
Lets hold off on this. I don't think the 256 limit is the way to ...
7 years, 2 months ago (2013-10-19 03:18:49 UTC) #4
tasak
Thank you for reviewing. >Instead I think we should consider something that caches the full ...
7 years, 2 months ago (2013-10-21 12:27:37 UTC) #5
dglazkov
https://codereview.chromium.org/28553005/diff/100001/Source/core/css/StyleSheetContentsCache.cpp File Source/core/css/StyleSheetContentsCache.cpp (right): https://codereview.chromium.org/28553005/diff/100001/Source/core/css/StyleSheetContentsCache.cpp#newcode91 Source/core/css/StyleSheetContentsCache.cpp:91: if (cacheItem->hasOneRef()) I see. Can you not just make ...
7 years, 2 months ago (2013-10-21 18:24:09 UTC) #6
tasak
Thank you for reviewing. I would like to add the result of ShadowDOM/StyleSheetInsert: (Before) Ignoring ...
7 years, 2 months ago (2013-10-25 05:23:13 UTC) #7
esprehn
I think by using two maps (for bidirectional lookup) and letting the CSSStyleSheet own the ...
7 years, 1 month ago (2013-10-30 21:33:49 UTC) #8
tasak
Thank you for reviewing. I would like to confirm one thing. We should share the ...
7 years, 1 month ago (2013-11-06 10:18:22 UTC) #9
ojan
On 2013/11/06 10:18:22, tasak wrote: > Thank you for reviewing. > > I would like ...
7 years, 1 month ago (2013-11-06 23:35:57 UTC) #10
tasak
On 2013/11/06 23:35:57, ojan wrote: > We only call checkLoaded when we've just created a ...
7 years, 1 month ago (2013-11-07 11:01:05 UTC) #11
tasak
Would you review this CL?
7 years, 1 month ago (2013-11-13 11:21:19 UTC) #12
esprehn
This is looking much better. You should not need a clearSheetCache() call, and doing so ...
7 years, 1 month ago (2013-11-15 10:27:37 UTC) #13
adamk
What's the status of this patch? I very much look forward to it landing.
7 years ago (2013-12-03 18:56:39 UTC) #14
adamk
On 2013/12/03 18:56:39, adamk wrote: > What's the status of this patch? I very much ...
7 years ago (2013-12-10 18:42:37 UTC) #15
adamk
On 2013/12/10 18:42:37, adamk wrote: > On 2013/12/03 18:56:39, adamk wrote: > > What's the ...
6 years, 11 months ago (2014-01-09 01:11:23 UTC) #16
tasak
On 2014/01/09 01:11:23, adamk wrote: > On 2013/12/10 18:42:37, adamk wrote: > > On 2013/12/03 ...
6 years, 11 months ago (2014-01-09 02:03:25 UTC) #17
tasak
Thank you for reviewing. And I'm sorry, adamk. I will focus on this CL. https://codereview.chromium.org/28553005/diff/390001/Source/core/css/StyleSheetContents.cpp ...
6 years, 11 months ago (2014-01-09 09:24:49 UTC) #18
esprehn
Looking much better. https://codereview.chromium.org/28553005/diff/570001/Source/core/css/StyleSheetContents.cpp File Source/core/css/StyleSheetContents.cpp (right): https://codereview.chromium.org/28553005/diff/570001/Source/core/css/StyleSheetContents.cpp#newcode401 Source/core/css/StyleSheetContents.cpp:401: // Because sheetLoaded() might destroy CSSStyleSheet. ...
6 years, 11 months ago (2014-01-09 10:05:32 UTC) #19
tasak
Thank you for reviewing. I found the following ASSERTION failure: 01:44:41.258 19602 worker/3 fast/dom/StyleSheet/gc-declaration-parent-rule.html crashed, ...
6 years, 11 months ago (2014-01-09 11:59:04 UTC) #20
tasak
On 2014/01/09 11:59:04, tasak wrote: > I found the following ASSERTION failure: > 01:44:41.258 19602 ...
6 years, 11 months ago (2014-01-10 18:38:54 UTC) #21
tasak
I found what causes the assertion failure. void LinkStyle::setCSSStyleSheet() invokes LinkStyle::sheetLoaded() directly. (not via StyleSheetContents::checkLoaded()). ...
6 years, 11 months ago (2014-01-11 02:04:33 UTC) #22
tasak
Would you review this CL? I think, I fixed ASSERT(isCacheable) FAILURE.
6 years, 11 months ago (2014-01-14 04:06:31 UTC) #23
esprehn
LGTM, can you expand the description to explain what you did? https://codereview.chromium.org/28553005/diff/810001/Source/core/css/StyleSheetContents.cpp File Source/core/css/StyleSheetContents.cpp (right): ...
6 years, 11 months ago (2014-01-14 05:09:42 UTC) #24
tasak
Thank you for reviewing. Sure. I have just updated the description. https://codereview.chromium.org/28553005/diff/810001/Source/core/css/StyleSheetContents.cpp File Source/core/css/StyleSheetContents.cpp (right): ...
6 years, 11 months ago (2014-01-14 08:03:54 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tasak@google.com/28553005/830007
6 years, 11 months ago (2014-01-15 07:53:27 UTC) #26
commit-bot: I haz the power
6 years, 11 months ago (2014-01-15 15:57:49 UTC) #27
Message was sent while issue was closed.
Change committed as 165139

Powered by Google App Engine
This is Rietveld 408576698