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

Issue 2397983002: MHTML saving optimization: don't generate CSS code that will be discarded. (Closed)

Created:
4 years, 2 months ago by carlosk
Modified:
4 years, 2 months ago
CC:
chromium-reviews, blink-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MHTML saving optimization: don't generate CSS code that will be discarded. FrameSerializer::serializeCSSStyleSheet code was generating CSS code for all style elements in a frame even if they were already included in the main HTML body generation executed earlier on in FrameSerializer::serializeFrame. This generated code was simply discarded later on. This change detects early on if generating the CSS code will be really needed and skips it if not. Also, when the CSS can be uniquely identified by its URL and that URL was already analyzed before the method simply returns. Tests on a Samsung Galaxy J1 loading a CSS-heavy web page [1] showed roughly 40% less CSS code generated and 20% less accumulative time taken from all render processes' main threads for the whole save operation. [1] http://www.creativebloq.com/web-design/examples-css-912710 BUG=651525 Committed: https://crrev.com/f72e2c5e69ca7a44db46622e96f2eaab2849d70a Cr-Commit-Position: refs/heads/master@{#424032}

Patch Set 1 : Initial upload #

Total comments: 3

Patch Set 2 : Further optimization. #

Total comments: 6

Patch Set 3 : Fixed snafu beteween local branches. #

Patch Set 4 : Improved comments and variable naming. #

Total comments: 2

Patch Set 5 : Simplified code as lukasza@ suggested. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+31 lines, -17 lines) Patch
M third_party/WebKit/Source/core/frame/FrameSerializer.cpp View 1 2 3 4 3 chunks +31 lines, -17 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 41 (29 generated)
carlosk
tkent@, lukasza@: PTAL.
4 years, 2 months ago (2016-10-06 02:59:02 UTC) #4
Łukasz Anforowicz
Thanks carlosk@ - this looks like a reasonable optimization (one that we possible should have ...
4 years, 2 months ago (2016-10-06 17:21:56 UTC) #13
carlosk
Thanks. https://codereview.chromium.org/2397983002/diff/20001/third_party/WebKit/Source/core/frame/FrameSerializer.cpp File third_party/WebKit/Source/core/frame/FrameSerializer.cpp (right): https://codereview.chromium.org/2397983002/diff/20001/third_party/WebKit/Source/core/frame/FrameSerializer.cpp#newcode371 third_party/WebKit/Source/core/frame/FrameSerializer.cpp:371: // Even if no text is needed, associated ...
4 years, 2 months ago (2016-10-06 18:07:25 UTC) #14
carlosk
Thanks. https://codereview.chromium.org/2397983002/diff/20001/third_party/WebKit/Source/core/frame/FrameSerializer.cpp File third_party/WebKit/Source/core/frame/FrameSerializer.cpp (right): https://codereview.chromium.org/2397983002/diff/20001/third_party/WebKit/Source/core/frame/FrameSerializer.cpp#newcode371 third_party/WebKit/Source/core/frame/FrameSerializer.cpp:371: // Even if no text is needed, associated ...
4 years, 2 months ago (2016-10-07 18:47:29 UTC) #17
Łukasz Anforowicz
Thanks - LGTM. I wonder if the 2nd paragraph of CL description should be reworded ...
4 years, 2 months ago (2016-10-07 19:07:49 UTC) #18
carlosk
Thanks! I also updated this change description given the latest changes. https://codereview.chromium.org/2397983002/diff/40001/third_party/WebKit/Source/core/frame/FrameSerializer.cpp File third_party/WebKit/Source/core/frame/FrameSerializer.cpp (right): ...
4 years, 2 months ago (2016-10-07 21:54:24 UTC) #27
carlosk
dcheng@: PTAL. Sorry for not waiting for your review tkent@. I'm trying to still get ...
4 years, 2 months ago (2016-10-07 22:00:27 UTC) #29
dcheng
LGTM with an optional nit. Also, I talked with lukasza and it apepars that this ...
4 years, 2 months ago (2016-10-07 22:34:28 UTC) #30
carlosk
Thanks. I'll update tests to cover this case in a follow up CL. https://codereview.chromium.org/2397983002/diff/100001/third_party/WebKit/Source/core/frame/FrameSerializer.cpp File ...
4 years, 2 months ago (2016-10-07 23:16:07 UTC) #33
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/2397983002/120001
4 years, 2 months ago (2016-10-08 01:00:14 UTC) #38
commit-bot: I haz the power
Committed patchset #5 (id:120001)
4 years, 2 months ago (2016-10-08 01:05:49 UTC) #39
commit-bot: I haz the power
4 years, 2 months ago (2016-10-08 01:07:36 UTC) #41
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/f72e2c5e69ca7a44db46622e96f2eaab2849d70a
Cr-Commit-Position: refs/heads/master@{#424032}

Powered by Google App Engine
This is Rietveld 408576698