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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2023033003: scheduler: Throttle timers in out-of-view frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add cross origin check, tests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 4117 matching lines...) Expand 10 before | Expand all | Expand 10 after
4128 m_needsUpdateViewportIntersectionInSubtree = false; 4128 m_needsUpdateViewportIntersectionInSubtree = false;
4129 4129
4130 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { 4130 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
4131 if (!child->isLocalFrame()) 4131 if (!child->isLocalFrame())
4132 continue; 4132 continue;
4133 if (FrameView* view = toLocalFrame(child)->view()) 4133 if (FrameView* view = toLocalFrame(child)->view())
4134 view->updateViewportIntersectionsForSubtree(phases); 4134 view->updateViewportIntersectionsForSubtree(phases);
4135 } 4135 }
4136 } 4136 }
4137 4137
4138 void FrameView::updateThrottlingStatus() 4138 void FrameView::updateThrottlingStatus()
alex clarke (OOO till 29th) 2016/06/28 17:11:28 Does this get called often?
Sami 2016/06/28 17:22:45 Only when a frame enters or leaves the viewport. M
4139 { 4139 {
4140 // Only offscreen frames can be throttled. 4140 // Only offscreen frames can be throttled.
4141 m_hiddenForThrottling = m_viewportIntersectionValid && m_viewportIntersectio n.isEmpty(); 4141 m_hiddenForThrottling = m_viewportIntersectionValid && m_viewportIntersectio n.isEmpty();
4142 m_frame->frameScheduler()->setFrameVisible(!m_hiddenForThrottling);
4142 4143
4143 // We only throttle the rendering pipeline in cross-origin frames. This is 4144 // We only throttle the rendering pipeline in cross-origin frames. This is
4144 // to avoid a situation where an ancestor frame directly depends on the 4145 // to avoid a situation where an ancestor frame directly depends on the
4145 // pipeline timing of a descendant and breaks as a result of throttling. 4146 // pipeline timing of a descendant and breaks as a result of throttling.
4146 // The rationale is that cross-origin frames must already communicate with 4147 // The rationale is that cross-origin frames must already communicate with
4147 // asynchronous messages, so they should be able to tolerate some delay in 4148 // asynchronous messages, so they should be able to tolerate some delay in
4148 // receiving replies from a throttled peer. 4149 // receiving replies from a throttled peer.
4149 // 4150 //
4150 // Check if we can access our parent's security origin. 4151 // Check if we can access our parent's security origin.
4151 m_crossOriginForThrottling = false; 4152 m_crossOriginForThrottling = false;
4152 // If any of our parents are throttled, we must be too. 4153 // If any of our parents are throttled, we must be too.
4153 m_subtreeThrottled = false; 4154 m_subtreeThrottled = false;
4154 const SecurityOrigin* origin = frame().securityContext()->getSecurityOrigin( ); 4155 const SecurityOrigin* origin = frame().securityContext()->getSecurityOrigin( );
4155 for (Frame* parentFrame = m_frame->tree().parent(); parentFrame; parentFrame = parentFrame->tree().parent()) { 4156 for (Frame* parentFrame = m_frame->tree().parent(); parentFrame; parentFrame = parentFrame->tree().parent()) {
4156 const SecurityOrigin* parentOrigin = parentFrame->securityContext()->get SecurityOrigin(); 4157 const SecurityOrigin* parentOrigin = parentFrame->securityContext()->get SecurityOrigin();
4157 if (!origin->canAccess(parentOrigin)) 4158 if (!origin->canAccess(parentOrigin))
4158 m_crossOriginForThrottling = true; 4159 m_crossOriginForThrottling = true;
4159 if (parentFrame->isLocalFrame() && toLocalFrame(parentFrame)->view() && toLocalFrame(parentFrame)->view()->canThrottleRendering()) 4160 if (parentFrame->isLocalFrame() && toLocalFrame(parentFrame)->view() && toLocalFrame(parentFrame)->view()->canThrottleRendering())
4160 m_subtreeThrottled = true; 4161 m_subtreeThrottled = true;
4161 } 4162 }
4163 m_frame->frameScheduler()->setCrossOrigin(m_crossOriginForThrottling);
4162 } 4164 }
4163 4165
4164 void FrameView::notifyRenderThrottlingObserversForTesting() 4166 void FrameView::notifyRenderThrottlingObserversForTesting()
4165 { 4167 {
4166 DCHECK(m_renderThrottlingObserverNotificationFactory->isPending()); 4168 DCHECK(m_renderThrottlingObserverNotificationFactory->isPending());
4167 notifyRenderThrottlingObservers(); 4169 notifyRenderThrottlingObservers();
4168 } 4170 }
4169 4171
4170 void FrameView::notifyRenderThrottlingObservers() 4172 void FrameView::notifyRenderThrottlingObservers()
4171 { 4173 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
4230 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4232 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4231 } 4233 }
4232 4234
4233 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4235 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4234 { 4236 {
4235 ASSERT(!layoutViewItem().isNull()); 4237 ASSERT(!layoutViewItem().isNull());
4236 return *layoutView(); 4238 return *layoutView();
4237 } 4239 }
4238 4240
4239 } // namespace blink 4241 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698