OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 4164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4175 | 4175 |
4176 // Notify javascript IntersectionObservers | 4176 // Notify javascript IntersectionObservers |
4177 if (targetState == DocumentLifecycle::PaintClean && frame().document()->inte rsectionObserverController()) | 4177 if (targetState == DocumentLifecycle::PaintClean && frame().document()->inte rsectionObserverController()) |
4178 frame().document()->intersectionObserverController()->computeTrackedInte rsectionObservations(); | 4178 frame().document()->intersectionObserverController()->computeTrackedInte rsectionObservations(); |
4179 | 4179 |
4180 // Adjust render throttling for iframes based on visibility | 4180 // Adjust render throttling for iframes based on visibility |
4181 bool shouldNotify = !hadValidIntersection || hadEmptyIntersection != m_viewp ortIntersection.isEmpty(); | 4181 bool shouldNotify = !hadValidIntersection || hadEmptyIntersection != m_viewp ortIntersection.isEmpty(); |
4182 if (shouldNotify && !m_renderThrottlingObserverNotificationFactory->isPendin g()) | 4182 if (shouldNotify && !m_renderThrottlingObserverNotificationFactory->isPendin g()) |
4183 m_frame->frameScheduler()->unthrottledTaskRunner()->postTask(BLINK_FROM_ HERE, m_renderThrottlingObserverNotificationFactory->cancelAndCreate()); | 4183 m_frame->frameScheduler()->unthrottledTaskRunner()->postTask(BLINK_FROM_ HERE, m_renderThrottlingObserverNotificationFactory->cancelAndCreate()); |
4184 | 4184 |
4185 // TODO(dgrogan): Document why we need this check. For cycles in the frame t ree? | |
Sami
2016/08/08 11:09:47
This is so that we don't traverse the frame tree u
dgrogan
2016/08/08 17:45:48
It what cases will it be triggered though?
ojan
2016/08/08 22:01:53
https://cs.chromium.org/chromium/src/third_party/W
| |
4185 if (!m_needsUpdateViewportIntersectionInSubtree) | 4186 if (!m_needsUpdateViewportIntersectionInSubtree) |
4186 return; | 4187 return; |
4187 m_needsUpdateViewportIntersectionInSubtree = false; | 4188 m_needsUpdateViewportIntersectionInSubtree = false; |
4188 | 4189 |
4189 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { | 4190 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { |
4190 if (!child->isLocalFrame()) | 4191 if (!child->isLocalFrame()) |
4191 continue; | 4192 continue; |
4192 if (FrameView* view = toLocalFrame(child)->view()) | 4193 if (FrameView* view = toLocalFrame(child)->view()) |
4193 view->updateViewportIntersectionsForSubtree(targetState); | 4194 view->updateViewportIntersectionsForSubtree(targetState); |
4194 } | 4195 } |
4195 } | 4196 } |
4196 | 4197 |
4197 void FrameView::updateThrottlingStatus() | 4198 void FrameView::updateThrottlingStatus() |
4198 { | 4199 { |
4199 // Only offscreen frames can be throttled. | 4200 // Only offscreen frames can be throttled. |
4201 // TODO(dgrogan): Change this to DCHECK(m_viewportIntersectionValid)? | |
Sami
2016/08/08 11:09:47
Right, we should be able to require that.
ojan
2016/08/08 22:01:54
Same as above, either add the DCHECK or leave the
dgrogan
2016/08/09 00:30:15
Sorry, it wasn't clear at all, but these comments
| |
4200 m_hiddenForThrottling = m_viewportIntersectionValid && m_viewportIntersectio n.isEmpty(); | 4202 m_hiddenForThrottling = m_viewportIntersectionValid && m_viewportIntersectio n.isEmpty(); |
4201 | 4203 |
4202 // We only throttle the rendering pipeline in cross-origin frames. This is | 4204 // We only throttle the rendering pipeline in cross-origin frames. This is |
4203 // to avoid a situation where an ancestor frame directly depends on the | 4205 // to avoid a situation where an ancestor frame directly depends on the |
4204 // pipeline timing of a descendant and breaks as a result of throttling. | 4206 // pipeline timing of a descendant and breaks as a result of throttling. |
4205 // The rationale is that cross-origin frames must already communicate with | 4207 // The rationale is that cross-origin frames must already communicate with |
4206 // asynchronous messages, so they should be able to tolerate some delay in | 4208 // asynchronous messages, so they should be able to tolerate some delay in |
4207 // receiving replies from a throttled peer. | 4209 // receiving replies from a throttled peer. |
4208 // | 4210 // |
4209 // Check if we can access our parent's security origin. | 4211 // Check if we can access our parent's security origin. |
(...skipping 18 matching lines...) Expand all Loading... | |
4228 | 4230 |
4229 void FrameView::notifyRenderThrottlingObservers() | 4231 void FrameView::notifyRenderThrottlingObservers() |
4230 { | 4232 { |
4231 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); | 4233 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); |
4232 DCHECK(!isInPerformLayout()); | 4234 DCHECK(!isInPerformLayout()); |
4233 DCHECK(!m_frame->document() || !m_frame->document()->inStyleRecalc()); | 4235 DCHECK(!m_frame->document() || !m_frame->document()->inStyleRecalc()); |
4234 bool wasThrottled = canThrottleRendering(); | 4236 bool wasThrottled = canThrottleRendering(); |
4235 | 4237 |
4236 updateThrottlingStatus(); | 4238 updateThrottlingStatus(); |
4237 | 4239 |
4240 frame().onVisibilityMaybeChanged(!m_hiddenForThrottling); | |
4241 | |
4238 bool becameThrottled = !wasThrottled && canThrottleRendering(); | 4242 bool becameThrottled = !wasThrottled && canThrottleRendering(); |
4239 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); | 4243 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); |
4240 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); | 4244 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); |
4241 if (becameThrottled) { | 4245 if (becameThrottled) { |
4242 // If this FrameView became throttled, we must make sure all of its | 4246 // If this FrameView became throttled, we must make sure all of its |
4243 // children become throttled at the same time. Otherwise we might | 4247 // children become throttled at the same time. Otherwise we might |
4244 // attempt to paint one of the children with an out-of-date layout | 4248 // attempt to paint one of the children with an out-of-date layout |
4245 // before |notifyRenderThrottlingObservers| has made it throttled. | 4249 // before |notifyRenderThrottlingObservers| has made it throttled. |
4246 forAllNonThrottledFrameViews([](FrameView& frameView) { | 4250 forAllNonThrottledFrameViews([](FrameView& frameView) { |
4247 frameView.m_subtreeThrottled = true; | 4251 frameView.m_subtreeThrottled = true; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4283 } | 4287 } |
4284 | 4288 |
4285 bool FrameView::canThrottleRendering() const | 4289 bool FrameView::canThrottleRendering() const |
4286 { | 4290 { |
4287 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) | 4291 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) |
4288 return false; | 4292 return false; |
4289 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); | 4293 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); |
4290 } | 4294 } |
4291 | 4295 |
4292 } // namespace blink | 4296 } // namespace blink |
OLD | NEW |