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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 157963002: Stop deferring commits on body tag insertion if there are no pending stylesheet loads. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index ebc75115e5f198aaa7ed25cdf679f102931bcd92..d211f674e9592aa31fcf1561ef596d7be94aa77e 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -3476,18 +3476,35 @@ void WebViewImpl::didCommitLoad(bool isNewNavigation, bool isNavigationWithinPag
resetSavedScrollAndScaleState();
}
-void WebViewImpl::layoutUpdated(WebFrameImpl* webframe)
+void WebViewImpl::willInsertBody(WebFrameImpl* webframe)
{
- if (!m_client || webframe != mainFrameImpl())
+ if (webframe != mainFrameImpl())
return;
+ // If we get to the <body> tag and we have no pending stylesheet loads, we
+ // can be fairly confident we'll have something sensible to paint soon and
+ // can turn off deferred commits.
+ if (m_page->mainFrame()->document()->haveStylesheetsLoaded())
+ resumeTreeViewCommits();
+}
+
+void WebViewImpl::resumeTreeViewCommits()
+{
if (m_layerTreeViewCommitsDeferred) {
- // If we finished a layout while in deferred commit mode,
- // that means it's time to start producing frames again so un-defer.
if (m_layerTreeView)
m_layerTreeView->setDeferCommits(false);
m_layerTreeViewCommitsDeferred = false;
}
+}
+
+void WebViewImpl::layoutUpdated(WebFrameImpl* webframe)
+{
+ if (!m_client || webframe != mainFrameImpl())
+ return;
+
+ // If we finished a layout while in deferred commit mode,
+ // that means it's time to start producing frames again so un-defer.
+ resumeTreeViewCommits();
if (m_shouldAutoResize && mainFrameImpl()->frame() && mainFrameImpl()->frame()->view()) {
WebSize frameSize = mainFrameImpl()->frame()->view()->frameRect().size();
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698