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

Issue 1364063007: Throttle rendering pipeline for invisible frames (Closed)

Created:
5 years, 3 months ago by Sami
Modified:
5 years, 2 months ago
CC:
chromium-reviews, darin-cc_chromium.org, eae, jam, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org, Timothy Loh
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Throttle rendering pipeline for invisible frames This patch avoids computing animations (rAF), layout, style, compositing or painting updates for cross origin frames which aren't visible in the root viewport. This helps to reduce the amount of processing we do for updates which would not be seen by the user anyway. Design doc: https://docs.google.com/document/d/1Dd4qi1b_iX-OCZpelvXxizjq6dDJ76XNtk37SZEoTYQ/edit#heading=h.baug2xj0sa2b BUG=487937 Committed: https://crrev.com/8ab2ba28e9dafe5b45ad914a274197128017221f Cr-Commit-Position: refs/heads/master@{#354780}

Patch Set 1 #

Patch Set 2 : Might help to include the test source code. #

Total comments: 25

Patch Set 3 : Make tests more realistic. #

Patch Set 4 : Rebased. #

Patch Set 5 : Rebased. #

Patch Set 6 : IntersectionObserverification #

Total comments: 6

Patch Set 7 : Rebased. #

Patch Set 8 : Review comments. Fixed forced layouts and added a test. #

Patch Set 9 : Early-out for intersection update walk. #

Total comments: 60

Patch Set 10 : Scopes. #

Patch Set 11 : Fix typo in comment. #

Total comments: 6

Patch Set 12 : Rebased + review comments. #

Patch Set 13 : Fix layout test by not dumping throttled FrameViews. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+578 lines, -18 lines) Patch
M third_party/WebKit/Source/core/dom/Document.cpp View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +9 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/DocumentLifecycle.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +10 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +20 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/Frame.h View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/Frame.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +7 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/FrameView.h View 1 2 3 4 5 6 7 8 9 10 11 8 chunks +33 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/frame/FrameView.cpp View 1 2 3 4 5 6 7 8 9 10 11 18 chunks +147 lines, -4 lines 2 comments Download
M third_party/WebKit/Source/core/frame/LocalFrame.h View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/LocalFrame.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutObject.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +5 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutPart.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutPart.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutView.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp View 1 2 3 4 5 6 7 8 9 4 chunks +16 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/page/PageAnimator.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +9 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/paint/ViewPainter.cpp View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +287 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/tests/sim/SimCompositor.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +2 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/web/web.gypi View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 28 (7 generated)
Sami
(Migrated from https://codereview.chromium.org/1246173002/)
5 years, 3 months ago (2015-09-24 15:58:44 UTC) #2
chrishtr
LGTM for paint. I also talked with Xianzhu and we agree that subsequence caching will ...
5 years, 2 months ago (2015-09-25 18:25:00 UTC) #3
ojan
This patch looks great! I really like the unittests for this (kudos to esprehn for ...
5 years, 2 months ago (2015-10-01 06:25:55 UTC) #4
esprehn
Sim is modeling the real lifecycle, don't call layout() or mess with setNeedsLayout or setNeedsAnimate ...
5 years, 2 months ago (2015-10-01 08:21:37 UTC) #5
Sami
Thanks for the comments guys. I'll respond to Ojan first and then dig into Elliott's ...
5 years, 2 months ago (2015-10-01 15:39:33 UTC) #6
Sami
https://codereview.chromium.org/1364063007/diff/20001/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp File third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp (right): https://codereview.chromium.org/1364063007/diff/20001/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp#newcode95 third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp:95: frameView->finalizeLifecycleUpdate(); On 2015/10/01 08:21:37, esprehn wrote: > m_compositor.beginFrame() Done. ...
5 years, 2 months ago (2015-10-05 17:58:25 UTC) #7
Sami
Ojan and I had a great whiteboard session about how this throttling could be done ...
5 years, 2 months ago (2015-10-13 15:18:12 UTC) #8
ojan
Very close! Just a few small issues. Also, this patch reemphasizes to me the importance ...
5 years, 2 months ago (2015-10-13 23:31:29 UTC) #9
Sami
Thanks Ojan. I also noticed a bug with synchronous/forced layouts where throttling was preventing them ...
5 years, 2 months ago (2015-10-14 16:52:11 UTC) #10
esprehn
this looks really good https://codereview.chromium.org/1364063007/diff/160001/third_party/WebKit/Source/core/dom/Document.cpp File third_party/WebKit/Source/core/dom/Document.cpp (right): https://codereview.chromium.org/1364063007/diff/160001/third_party/WebKit/Source/core/dom/Document.cpp#newcode1534 third_party/WebKit/Source/core/dom/Document.cpp:1534: if (!view() || !view()->shouldThrottleRendering()) we ...
5 years, 2 months ago (2015-10-14 22:09:47 UTC) #11
ojan
I'm happy with this once you address Elliott's comments. Elliott, please l-g-t-m+cq when you're happy. ...
5 years, 2 months ago (2015-10-15 04:18:26 UTC) #12
Sami
Thanks for the scoping idea -- it makes many things here much cleaner. https://codereview.chromium.org/1364063007/diff/160001/third_party/WebKit/Source/core/dom/Document.cpp File ...
5 years, 2 months ago (2015-10-16 16:48:09 UTC) #13
esprehn
lgtm, your patch is awesome! http://i.imgur.com/0tc6uqt.gif fyi: isActive() implies layoutView() is not null, frameView() is ...
5 years, 2 months ago (2015-10-16 21:40:45 UTC) #14
Sami
Thanks for all the feedback everyone (especially in gif form!) https://codereview.chromium.org/1364063007/diff/200001/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp File third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp (right): https://codereview.chromium.org/1364063007/diff/200001/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp#newcode72 ...
5 years, 2 months ago (2015-10-19 10:51:06 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1364063007/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1364063007/220001
5 years, 2 months ago (2015-10-19 10:51:32 UTC) #18
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/128166)
5 years, 2 months ago (2015-10-19 11:45:54 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1364063007/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1364063007/240001
5 years, 2 months ago (2015-10-19 14:15:55 UTC) #23
commit-bot: I haz the power
Committed patchset #13 (id:240001)
5 years, 2 months ago (2015-10-19 15:34:26 UTC) #24
commit-bot: I haz the power
Patchset 13 (id:??) landed as https://crrev.com/8ab2ba28e9dafe5b45ad914a274197128017221f Cr-Commit-Position: refs/heads/master@{#354780}
5 years, 2 months ago (2015-10-19 15:35:48 UTC) #25
alogvinov
https://codereview.chromium.org/1364063007/diff/240001/third_party/WebKit/Source/core/frame/FrameView.cpp File third_party/WebKit/Source/core/frame/FrameView.cpp (left): https://codereview.chromium.org/1364063007/diff/240001/third_party/WebKit/Source/core/frame/FrameView.cpp#oldcode2411 third_party/WebKit/Source/core/frame/FrameView.cpp:2411: ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean); Shouldn't this assert be removed or ...
5 years, 2 months ago (2015-10-21 13:02:44 UTC) #27
Sami
5 years, 2 months ago (2015-10-21 13:15:16 UTC) #28
Message was sent while issue was closed.
https://codereview.chromium.org/1364063007/diff/240001/third_party/WebKit/Sou...
File third_party/WebKit/Source/core/frame/FrameView.cpp (left):

https://codereview.chromium.org/1364063007/diff/240001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/frame/FrameView.cpp:2411:
ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean);
On 2015/10/21 13:02:44, alogvinov wrote:
> Shouldn't this assert be removed or amended now that
> updateStyleAndLayoutIfNeededRecursive() may return immediately if
> shouldThrottleRendering() is true, leaving lifecycle().state() unchanged?

Right now I think this works since we never throttle the local root, but that
shouldn't really be baked in at this level so I agree that this should be
relaxed. Let me put together a patch.

Powered by Google App Engine
This is Rietveld 408576698