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

Unified Diff: Source/core/frame/FrameView.cpp

Issue 131233003: Refactor ResourceLoadPriorityOptimizer to avoid walking render tree (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use esprehn's suggestion. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index da1ffa226151929878792d65c96c7e7c2061e4e2..074405f58ae8fdc0894ab1ec8a6d7e3179632a4b 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -112,6 +112,7 @@ double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0;
// The maximum number of updateWidgets iterations that should be done before returning.
static const unsigned maxUpdateWidgetsIterations = 2;
+static const double timeToWaitAfterScrollInterval = 0.250;
esprehn 2014/01/15 01:27:45 Needs a better name, resourcePriorityUpdateDelayAf
shatch 2014/01/15 19:28:52 Done.
static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLayer* layer, bool isRelayoutingSubtree, bool didFullRepaint)
{
@@ -193,6 +194,7 @@ FrameView::FrameView(Frame* frame)
, m_inputEventsScaleFactorForEmulation(1)
, m_partialLayout()
, m_layoutSizeFixedToFrameSize(true)
+ , m_didScrollTimer(this, &FrameView::didScrollTimerFired)
{
ASSERT(m_frame);
init();
@@ -226,6 +228,9 @@ FrameView::~FrameView()
if (m_postLayoutTasksTimer.isActive())
m_postLayoutTasksTimer.stop();
+ if (m_didScrollTimer.isActive())
+ m_didScrollTimer.stop();
+
removeFromAXObjectCache();
resetScrollbars();
@@ -920,8 +925,7 @@ void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
rootForThisLayout->layout();
gatherDebugLayoutRects(rootForThisLayout);
- ResourceLoadPriorityOptimizer modifier;
- rootForThisLayout->didLayout(modifier);
+ resourceLoadPriorityOptimizer()->updateAllImageResourcePriorities();
}
TextAutosizer* textAutosizer = frame().document()->textAutosizer();
@@ -931,9 +935,6 @@ void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
LayoutIndicator layoutIndicator;
rootForThisLayout->layout();
gatherDebugLayoutRects(rootForThisLayout);
-
- ResourceLoadPriorityOptimizer modifier;
- rootForThisLayout->didLayout(modifier);
}
m_inLayout = false;
@@ -1726,9 +1727,15 @@ void FrameView::scrollPositionChanged()
renderView->compositor()->frameViewDidScroll();
}
+ if (m_didScrollTimer.isActive())
+ m_didScrollTimer.stop();
+ m_didScrollTimer.startOneShot(timeToWaitAfterScrollInterval);
+}
+
+void FrameView::didScrollTimerFired(Timer<FrameView>*)
+{
if (m_frame->document() && m_frame->document()->renderer()) {
- ResourceLoadPriorityOptimizer modifier;
- m_frame->document()->renderer()->didScroll(modifier);
+ resourceLoadPriorityOptimizer()->updateAllImageResourcePriorities();
}
}

Powered by Google App Engine
This is Rietveld 408576698