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

Issue 2290983003: CSSStyleSheetResource should cache decoded text instead of raw bytes (Closed)

Created:
4 years, 3 months ago by kouhei (in TOK)
Modified:
4 years, 2 months ago
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-dom_chromium.org, blink-reviews-html_chromium.org, blink-reviews-style_chromium.org, caseq+blink_chromium.org, chromium-reviews, devtools-reviews_chromium.org, dglazkov+blink, eae+blinkwatch, gavinp+prerender_chromium.org, gavinp+loader_chromium.org, Nate Chapin, kinuko+watch, kozyatinskiy+blink_chromium.org, loading-reviews+fetch_chromium.org, loading-reviews+parser_chromium.org, loading-reviews_chromium.org, lushnikov+blink_chromium.org, pfeldman+blink_chromium.org, rwlbuis, sof, tyoshino+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

CSSStyleSheetResource should cache decoded text instead of raw bytes Before this CL, CSSStyleSheetResource kept undecoded text alive, and decoded text whenever it was requested. After this CL, the decoded text is kept alive as cache. It discards undecoded text when the whole sheet text is loaded to avoid unnecessary memory usage. As a side-effect, CSSStyleSheetResource::sheetText is no longer const, as it may cache m_decodedSheetText. BUG=642722, 653502 Committed: https://crrev.com/afa48c3ed31f7229c306ce7cda62111be593f719 Cr-Commit-Position: refs/heads/master@{#424941}

Patch Set 1 #

Total comments: 6

Patch Set 2 : hiroshige review #

Total comments: 1

Patch Set 3 : hiroshige review2 #

Total comments: 7

Patch Set 4 : hiroshige review2 #

Total comments: 2

Patch Set 5 : csharrison review #

Patch Set 6 : test pass? #

Patch Set 7 : rebased #

Patch Set 8 : move sri info to Resource #

Patch Set 9 : add dcheck #

Total comments: 11

Patch Set 10 : depCL to 2398733003 #

Patch Set 11 : really set upstream #

Patch Set 12 : address comments #

Patch Set 13 : set const #

Patch Set 14 : add test #

Patch Set 15 : add test #

Patch Set 16 : rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+122 lines, -32 lines) Patch
A + third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/resources/mark-result-red.css View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -2 lines 0 comments Download
A + third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/resources/mark-result2-blue.css View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -2 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-load-css-after-failed-integrity.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +50 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +31 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/Resource.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/fetch/Resource.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLLinkElement.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +31 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 102 (75 generated)
kouhei (in TOK)
Would you take a look?
4 years, 3 months ago (2016-08-31 07:10:48 UTC) #3
hiroshige
https://codereview.chromium.org/2290983003/diff/1/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp File third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp (right): https://codereview.chromium.org/2290983003/diff/1/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp#newcode111 third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp:111: return m_decodedSheetText; IIUC, the Lines 106--111 are executed only ...
4 years, 3 months ago (2016-08-31 07:30:25 UTC) #6
kouhei (in TOK)
https://codereview.chromium.org/2290983003/diff/1/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp File third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp (right): https://codereview.chromium.org/2290983003/diff/1/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp#newcode111 third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp:111: return m_decodedSheetText; On 2016/08/31 07:30:25, hiroshige wrote: > IIUC, ...
4 years, 3 months ago (2016-08-31 10:27:43 UTC) #9
hiroshige
https://codereview.chromium.org/2290983003/diff/20001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp File third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp (right): https://codereview.chromium.org/2290983003/diff/20001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp#newcode138 third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp:138: m_decodedSheetText = String(); Probably clearing |m_decodedSheetText| in destroyDecodedDataIfPossible() will ...
4 years, 3 months ago (2016-08-31 10:34:53 UTC) #12
Charlie Harrison
Thanks for the patch! Feel free to add issue 642722 as BUG=, which I created ...
4 years, 3 months ago (2016-08-31 13:01:19 UTC) #16
Charlie Harrison
I wonder if we could decode the bytes as they stream in? I am thinking ...
4 years, 3 months ago (2016-09-01 16:52:05 UTC) #27
Charlie Harrison
https://codereview.chromium.org/2290983003/diff/60001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp File third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp (right): https://codereview.chromium.org/2290983003/diff/60001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp#newcode101 third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp:101: DCHECK(getStatus() != Resource::Cached); I think this DCHECK isn't quite ...
4 years, 3 months ago (2016-09-02 03:40:49 UTC) #29
kouhei (in TOK)
https://codereview.chromium.org/2290983003/diff/40001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp File third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp (right): https://codereview.chromium.org/2290983003/diff/40001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp#newcode101 third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp:101: DCHECK(getStatus() != Resource::Cached); On 2016/08/31 13:01:18, Charlie Harrison wrote: ...
4 years, 3 months ago (2016-09-02 03:43:42 UTC) #30
Charlie Harrison
This is breaking the @import css scanner, which calls decodedText() in appendData() callbacks. Two solutions: ...
4 years, 3 months ago (2016-09-02 12:17:15 UTC) #35
kouhei (in TOK)
On 2016/09/02 12:17:15, Charlie Harrison wrote: > This is breaking the @import css scanner, which ...
4 years, 3 months ago (2016-09-02 13:55:56 UTC) #36
Charlie Harrison
On 2016/09/02 13:55:56, kouhei wrote: > On 2016/09/02 12:17:15, Charlie Harrison wrote: > > This ...
4 years, 3 months ago (2016-09-02 13:59:27 UTC) #37
Charlie Harrison
What is the current status here?
4 years, 2 months ago (2016-10-03 18:24:59 UTC) #50
kouhei (in TOK)
I think the CL is now ready for first pass. Would you take a look?
4 years, 2 months ago (2016-10-05 13:44:51 UTC) #56
Charlie Harrison
Looks good, but can you update the description enumerating the changes to SRI? Namely that ...
4 years, 2 months ago (2016-10-05 15:24:49 UTC) #59
jww
Please add a similar test to third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-load-regular-script-after-failed-integrity.html but which covers the stylesheet variant. This is ...
4 years, 2 months ago (2016-10-05 15:32:49 UTC) #60
kouhei (in TOK)
Thanks for review comments! > Looks good, but can you update the description enumerating the ...
4 years, 2 months ago (2016-10-05 23:38:22 UTC) #63
jww
https://codereview.chromium.org/2290983003/diff/160001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp File third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp (right): https://codereview.chromium.org/2290983003/diff/160001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp#newcode49 third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp:49: resource->setIntegrityMetadata(request.integrityMetadata()); On 2016/10/05 15:24:48, Charlie Harrison wrote: > It ...
4 years, 2 months ago (2016-10-06 01:55:04 UTC) #64
Charlie Harrison
https://codereview.chromium.org/2290983003/diff/160001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp File third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp (right): https://codereview.chromium.org/2290983003/diff/160001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp#newcode49 third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp:49: resource->setIntegrityMetadata(request.integrityMetadata()); On 2016/10/06 01:55:04, jww wrote: > On 2016/10/05 ...
4 years, 2 months ago (2016-10-06 03:59:08 UTC) #65
kouhei (in TOK)
I'll work on test tomorrow JST https://codereview.chromium.org/2290983003/diff/160001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp File third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp (right): https://codereview.chromium.org/2290983003/diff/160001/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp#newcode49 third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp:49: resource->setIntegrityMetadata(request.integrityMetadata()); On 2016/10/06 ...
4 years, 2 months ago (2016-10-06 12:02:37 UTC) #67
kouhei (in TOK)
Added tests. PTAL.
4 years, 2 months ago (2016-10-11 00:56:28 UTC) #88
Charlie Harrison
non-owner LGTM
4 years, 2 months ago (2016-10-11 03:32:34 UTC) #89
Yoav Weiss
On 2016/10/11 03:32:34, Charlie Harrison wrote: > non-owner LGTM RSLGTM
4 years, 2 months ago (2016-10-11 08:28:15 UTC) #90
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2290983003/280001
4 years, 2 months ago (2016-10-11 22:48:04 UTC) #93
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/278750)
4 years, 2 months ago (2016-10-11 23:00:31 UTC) #95
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2290983003/300001
4 years, 2 months ago (2016-10-13 01:54:57 UTC) #98
commit-bot: I haz the power
Committed patchset #16 (id:300001)
4 years, 2 months ago (2016-10-13 03:05:06 UTC) #100
commit-bot: I haz the power
4 years, 2 months ago (2016-10-13 03:08:41 UTC) #102
Message was sent while issue was closed.
Patchset 16 (id:??) landed as
https://crrev.com/afa48c3ed31f7229c306ce7cda62111be593f719
Cr-Commit-Position: refs/heads/master@{#424941}

Powered by Google App Engine
This is Rietveld 408576698