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

Issue 2272773002: Use intersection observer to control frame throttling (Closed)

Created:
4 years, 4 months ago by Sami
Modified:
4 years, 1 month ago
CC:
blink-reviews, blink-reviews-dom_chromium.org, chromium-reviews, dglazkov+blink, dgrogan, eae+blinkwatch, haraken, kinuko+watch, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use intersection observer to control frame throttling This patch removes the FrameView-specific code for computing viewport visibility in favor of registering an internal intersection observer. BUG=616519, 647393, 661182 Committed: https://crrev.com/3c364c812da0312a104e976ca5838507efe3488e Cr-Commit-Position: refs/heads/master@{#429046}

Patch Set 1 #

Patch Set 2 : Cleanup #

Patch Set 3 : Use unthrottled task runner. Build fix. #

Patch Set 4 : Handle suspension #

Patch Set 5 : Windows build fix #

Patch Set 6 : OOPIF fix #

Patch Set 7 : Adjust OOPIF expectations #

Total comments: 19

Patch Set 8 : Review comments #

Total comments: 2

Patch Set 9 : Review comments #

Total comments: 1

Patch Set 10 : Rebased #

Total comments: 6

Patch Set 11 : Rebased #

Patch Set 12 : Crash fix #

Patch Set 13 : SVG mapAncestorToLocal fix #

Patch Set 14 : Don't try to register observer too early #

Patch Set 15 : Update test expectations #

Patch Set 16 : Throttle immediately when attaching to a throttled parent #

Patch Set 17 : Fix rebase typo #

Total comments: 2

Patch Set 18 : Fix Gmail painting issue by observing frame owner instead of doc element #

Patch Set 19 : Switch to ElementVisibilityObserver #

Patch Set 20 : Fix DeferredLoadingTest #

Patch Set 21 : Add support for setting initial observer state #

Total comments: 5

Patch Set 22 : Remove extraneous (?) check #

Patch Set 23 : Turns out we need the check after all #

Total comments: 8

Patch Set 24 : Adjust setInitialState API #

Patch Set 25 : Update LeakExpectations #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+210 lines, -159 lines) Patch
M third_party/WebKit/LayoutTests/LeakExpectations View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/activedomobject/media.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/activedomobject/media-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Document.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +2 lines, -0 lines 1 comment Download
M third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 chunks +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/IntersectionObserver.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 3 chunks +16 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/IntersectionObserver.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 3 chunks +12 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/FrameView.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 6 chunks +6 lines, -12 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 12 13 14 15 16 17 18 19 20 21 22 23 13 chunks +96 lines, -133 lines 0 comments Download
M third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/layout/svg/LayoutSVGModelObject.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +56 lines, -2 lines 0 comments Download

Messages

Total messages: 137 (96 generated)
Sami
PTAL.
4 years, 4 months ago (2016-08-24 17:56:32 UTC) #4
szager1
https://codereview.chromium.org/2272773002/diff/120001/third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp File third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp (right): https://codereview.chromium.org/2272773002/diff/120001/third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp#newcode27 third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp:27: , m_lowLatencyCallbackFiredWhileSuspended(false) I don't think you need m_lowLatencyCallbacksFiredWhileSuspended. Instead, ...
4 years, 3 months ago (2016-08-30 23:57:12 UTC) #32
ojan
I didn't look closely at the patch, but I think if we are adding a ...
4 years, 3 months ago (2016-08-31 01:11:08 UTC) #33
Sami
> I didn't look closely at the patch, but I think if we are adding ...
4 years, 3 months ago (2016-08-31 11:08:56 UTC) #36
szager1
https://codereview.chromium.org/2272773002/diff/120001/third_party/WebKit/Source/core/frame/FrameView.cpp File third_party/WebKit/Source/core/frame/FrameView.cpp (right): https://codereview.chromium.org/2272773002/diff/120001/third_party/WebKit/Source/core/frame/FrameView.cpp#newcode286 third_party/WebKit/Source/core/frame/FrameView.cpp:286: On 2016/08/31 11:08:56, Sami wrote: > On 2016/08/30 23:57:12, ...
4 years, 3 months ago (2016-08-31 20:54:27 UTC) #39
ojan
On 2016/08/31 at 11:08:56, skyostil wrote: > > I didn't look closely at the patch, ...
4 years, 3 months ago (2016-09-01 05:04:30 UTC) #40
Sami
> There's a few options on the table. One would be to stop using an ...
4 years, 3 months ago (2016-09-01 11:11:35 UTC) #41
ojan
lgtm https://codereview.chromium.org/2272773002/diff/160001/third_party/WebKit/Source/core/dom/IntersectionObserver.h File third_party/WebKit/Source/core/dom/IntersectionObserver.h (right): https://codereview.chromium.org/2272773002/diff/160001/third_party/WebKit/Source/core/dom/IntersectionObserver.h#newcode65 third_party/WebKit/Source/core/dom/IntersectionObserver.h:65: // authors and adjust/remove this API accordingly. FWIW, ...
4 years, 3 months ago (2016-09-06 21:16:35 UTC) #46
szager1
lgtm
4 years, 3 months ago (2016-09-06 22:09:05 UTC) #47
ojan
https://codereview.chromium.org/2272773002/diff/180001/third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp File third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp (right): https://codereview.chromium.org/2272773002/diff/180001/third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp#newcode59 third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp:59: TaskRunnerHelper::get(TaskType::Unthrottled, getExecutionContext())->postTask(BLINK_FROM_HERE, m_lowLatencyNotificationTask->cancelAndCreate()); In retrospect, I wonder if unthrottled ...
4 years, 3 months ago (2016-09-10 02:18:27 UTC) #48
haraken
https://codereview.chromium.org/2272773002/diff/180001/third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp File third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp (right): https://codereview.chromium.org/2272773002/diff/180001/third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp#newcode59 third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp:59: TaskRunnerHelper::get(TaskType::Unthrottled, getExecutionContext())->postTask(BLINK_FROM_HERE, m_lowLatencyNotificationTask->cancelAndCreate()); On 2016/09/10 02:18:27, ojan wrote: > ...
4 years, 3 months ago (2016-09-12 00:46:33 UTC) #50
dgrogan
https://codereview.chromium.org/2272773002/diff/180001/third_party/WebKit/Source/core/frame/FrameView.cpp File third_party/WebKit/Source/core/frame/FrameView.cpp (left): https://codereview.chromium.org/2272773002/diff/180001/third_party/WebKit/Source/core/frame/FrameView.cpp#oldcode4299 third_party/WebKit/Source/core/frame/FrameView.cpp:4299: frame().document()->onVisibilityMaybeChanged(!m_hiddenForThrottling); If this was unintentionally dropped in the new ...
4 years, 3 months ago (2016-09-15 23:47:08 UTC) #52
dgrogan
What's the status/plan for this CL? I'm looking to piggy-back some more data-gathering in your ...
4 years, 3 months ago (2016-09-21 17:55:56 UTC) #53
Sami
> What's the status/plan for this CL? I'm looking to piggy-back some more > data-gathering ...
4 years, 3 months ago (2016-09-22 10:49:29 UTC) #54
Sami
Alright, I've rebased the patch and the trybots seem content with it, so I'd like ...
4 years, 2 months ago (2016-10-13 07:02:06 UTC) #80
szager1
On 2016/10/13 07:02:06, Sami (slow -- traveling) wrote: > Alright, I've rebased the patch and ...
4 years, 2 months ago (2016-10-13 19:12:30 UTC) #81
Sami
On 2016/10/13 19:12:30, szager1 wrote: > On 2016/10/13 07:02:06, Sami (slow -- traveling) wrote: > ...
4 years, 2 months ago (2016-10-14 00:51:13 UTC) #82
ojan
I think you should use ElementVisibilityObserver if you can. Is there a reason you can't? ...
4 years, 2 months ago (2016-10-14 02:25:48 UTC) #83
Sami
On 2016/10/14 02:25:48, ojan wrote: > I think you should use ElementVisibilityObserver if you can. ...
4 years, 1 month ago (2016-10-25 17:47:00 UTC) #94
Sami
https://codereview.chromium.org/2272773002/diff/320001/third_party/WebKit/Source/core/frame/FrameView.cpp File third_party/WebKit/Source/core/frame/FrameView.cpp (right): https://codereview.chromium.org/2272773002/diff/320001/third_party/WebKit/Source/core/frame/FrameView.cpp#newcode313 third_party/WebKit/Source/core/frame/FrameView.cpp:313: observation->setLastThresholdIndex(std::numeric_limits<unsigned>::max()); On 2016/10/14 02:25:47, ojan wrote: > This is ...
4 years, 1 month ago (2016-10-25 17:47:12 UTC) #95
dgrogan
https://codereview.chromium.org/2272773002/diff/400001/third_party/WebKit/Source/core/frame/FrameView.cpp File third_party/WebKit/Source/core/frame/FrameView.cpp (right): https://codereview.chromium.org/2272773002/diff/400001/third_party/WebKit/Source/core/frame/FrameView.cpp#newcode4406 third_party/WebKit/Source/core/frame/FrameView.cpp:4406: if (frame().document()->frame()) { Removing this doesn't cause any of ...
4 years, 1 month ago (2016-10-25 22:29:37 UTC) #98
szager1
https://codereview.chromium.org/2272773002/diff/400001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h File third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h (right): https://codereview.chromium.org/2272773002/diff/400001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h#newcode39 third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h:39: void deliverObservationsForTesting(); Can we avoid this by adding calls ...
4 years, 1 month ago (2016-10-25 22:39:35 UTC) #99
Sami
https://codereview.chromium.org/2272773002/diff/400001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h File third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h (right): https://codereview.chromium.org/2272773002/diff/400001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h#newcode39 third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h:39: void deliverObservationsForTesting(); On 2016/10/25 22:39:35, szager1 wrote: > Can ...
4 years, 1 month ago (2016-10-26 17:59:35 UTC) #102
szager1
lgtm
4 years, 1 month ago (2016-10-26 19:55:13 UTC) #105
Sami
https://codereview.chromium.org/2272773002/diff/400001/third_party/WebKit/Source/core/frame/FrameView.cpp File third_party/WebKit/Source/core/frame/FrameView.cpp (right): https://codereview.chromium.org/2272773002/diff/400001/third_party/WebKit/Source/core/frame/FrameView.cpp#newcode4406 third_party/WebKit/Source/core/frame/FrameView.cpp:4406: if (frame().document()->frame()) { On 2016/10/26 17:59:35, Sami wrote: > ...
4 years, 1 month ago (2016-10-27 09:11:10 UTC) #108
Sami
Hey Ojan, do you think this is good to land now?
4 years, 1 month ago (2016-10-28 10:05:04 UTC) #111
ojan
https://codereview.chromium.org/2272773002/diff/440001/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp File third_party/WebKit/Source/core/dom/IntersectionObserver.cpp (right): https://codereview.chromium.org/2272773002/diff/440001/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp#newcode348 third_party/WebKit/Source/core/dom/IntersectionObserver.cpp:348: void IntersectionObserver::setInitialState(InitialState initialState) { This will happen to work ...
4 years, 1 month ago (2016-10-31 19:37:10 UTC) #112
ojan
https://codereview.chromium.org/2272773002/diff/440001/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp File third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp (right): https://codereview.chromium.org/2272773002/diff/440001/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp#newcode782 third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp:782: ->updateRenderThrottlingStatusForTesting(); On 2016/10/31 at 19:37:10, ojan wrote: > I ...
4 years, 1 month ago (2016-10-31 19:38:27 UTC) #113
ojan
So, lgtm, unless there's contention around changing the enum name and the setInitialState thing.
4 years, 1 month ago (2016-10-31 19:41:12 UTC) #114
Sami
Thanks! https://codereview.chromium.org/2272773002/diff/440001/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp File third_party/WebKit/Source/core/dom/IntersectionObserver.cpp (right): https://codereview.chromium.org/2272773002/diff/440001/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp#newcode348 third_party/WebKit/Source/core/dom/IntersectionObserver.cpp:348: void IntersectionObserver::setInitialState(InitialState initialState) { On 2016/10/31 19:37:09, ojan ...
4 years, 1 month ago (2016-11-01 10:44:48 UTC) #115
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/2272773002/460001
4 years, 1 month ago (2016-11-01 10:45:29 UTC) #118
commit-bot: I haz the power
Committed patchset #24 (id:460001)
4 years, 1 month ago (2016-11-01 12:02:54 UTC) #120
commit-bot: I haz the power
Patchset 24 (id:??) landed as https://crrev.com/5d3d4c00320aadad4a044dcb0241b86fc184b114 Cr-Commit-Position: refs/heads/master@{#428984}
4 years, 1 month ago (2016-11-01 12:06:34 UTC) #122
please use gerrit instead
A revert of this CL (patchset #24 id:460001) has been created in https://codereview.chromium.org/2470793002/ by rouslan@chromium.org. ...
4 years, 1 month ago (2016-11-01 14:39:18 UTC) #123
Sami
Thanks for linking to the failures. I believe there is a pre-existing leak in fast/loader/open-in-srcdoc-unload.html ...
4 years, 1 month ago (2016-11-01 16:29:55 UTC) #126
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/2272773002/480001
4 years, 1 month ago (2016-11-01 16:30:54 UTC) #129
commit-bot: I haz the power
Committed patchset #25 (id:480001)
4 years, 1 month ago (2016-11-01 17:56:38 UTC) #131
commit-bot: I haz the power
Patchset 25 (id:??) landed as https://crrev.com/3c364c812da0312a104e976ca5838507efe3488e Cr-Commit-Position: refs/heads/master@{#429046}
4 years, 1 month ago (2016-11-01 18:24:47 UTC) #133
esprehn
This patch broke timer throttling for hidden iframes, it removed the calls to setCrossOrigin and ...
4 years, 1 month ago (2016-11-05 01:32:20 UTC) #135
esprehn
https://codereview.chromium.org/2272773002/diff/480001/third_party/WebKit/Source/core/dom/Document.cpp File third_party/WebKit/Source/core/dom/Document.cpp (right): https://codereview.chromium.org/2272773002/diff/480001/third_party/WebKit/Source/core/dom/Document.cpp#newcode5217 third_party/WebKit/Source/core/dom/Document.cpp:5217: frame->view()->setupRenderThrottling(); Why do you need to call this here ...
4 years, 1 month ago (2016-11-05 03:01:11 UTC) #136
Sami
4 years, 1 month ago (2016-11-07 11:47:42 UTC) #137
Message was sent while issue was closed.
On 2016/11/05 01:32:20, esprehn wrote:
> This patch broke timer throttling for hidden iframes, it removed the calls to
> 
> setCrossOrigin and setFrameVisible that were in there, those now have no
callers
> so I think we're never throttling off screen cross origin frame tasks which is
> supposed to be shipped per:
> 
> TimerThrottlingForHiddenFrames status=stable
> 
> looks like there's no tests for this, just unit tests for the scheduler:
> RepeatingTimer_FrameHidden_SameOrigin
> 
> there should really be some layout tests for timer throttling too. :)

Sorry about that, must have been a rebase snafu on my part. I'll land a fix
along with some new tests once I have some time to work on this again.

FYI the master switch for hidden timer throttling is here[1] and is currently
disabled. The switch needs to be there because Finch doesn't know about Blink
features.

[1]
https://cs.chromium.org/chromium/src/content/public/common/content_features.c...

Powered by Google App Engine
This is Rietveld 408576698