Commit a58e3808 authored by jamesr@google.com's avatar jamesr@google.com

[chromium] Defer commits between page unload and first invalidation in threaded compositing mode

https://bugs.webkit.org/show_bug.cgi?id=100702

Reviewed by Adrienne Walker.

In threaded compositing mode, it's not terribly useful to commit after unloading a page and before receiving
the first invalidation for the new page since the document is likely not loaded enough to paint usefully.
This defers commits from the time compositing is deactivated (which in force compositing mode only happens
at FrameView destruction) until we get the first invalidation from WebCore.

* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::invalidateContentsAndRootView):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::invalidateRect):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
(WebKit):
* src/WebViewImpl.h:
(WebViewImpl):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132862 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f00186e6
2012-10-29 James Robinson <jamesr@chromium.org>
[chromium] Defer commits between page unload and first invalidation in threaded compositing mode
https://bugs.webkit.org/show_bug.cgi?id=100702
Reviewed by Adrienne Walker.
In threaded compositing mode, it's not terribly useful to commit after unloading a page and before receiving
the first invalidation for the new page since the document is likely not loaded enough to paint usefully.
This defers commits from the time compositing is deactivated (which in force compositing mode only happens
at FrameView destruction) until we get the first invalidation from WebCore.
* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::invalidateContentsAndRootView):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::invalidateRect):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
(WebKit):
* src/WebViewImpl.h:
(WebViewImpl):
2012-10-29 Stephen White <senorblanco@chromium.org>
Unreviewed. Rolled DEPS.
......
......@@ -495,15 +495,7 @@ void ChromeClientImpl::invalidateContentsAndRootView(const IntRect& updateRect,
{
if (updateRect.isEmpty())
return;
#if USE(ACCELERATED_COMPOSITING)
if (!m_webView->isAcceleratedCompositingActive()) {
#endif
if (m_webView->client())
m_webView->client()->didInvalidateRect(updateRect);
#if USE(ACCELERATED_COMPOSITING)
} else
m_webView->invalidateRootLayerRect(updateRect);
#endif
m_webView->invalidateRect(updateRect);
}
void ChromeClientImpl::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate)
......
......@@ -419,6 +419,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_rootLayer(0)
, m_rootGraphicsLayer(0)
, m_isAcceleratedCompositingActive(false)
, m_layerTreeViewCommitsDeferred(false)
, m_compositorCreationFailed(false)
, m_recreatingGraphicsContext(false)
, m_compositorSurfaceReady(false)
......@@ -3830,17 +3831,26 @@ void WebViewImpl::scrollRootLayerRect(const IntSize&, const IntRect&)
updateLayerTreeViewport();
}
void WebViewImpl::invalidateRootLayerRect(const IntRect& rect)
void WebViewImpl::invalidateRect(const IntRect& rect)
{
ASSERT(m_layerTreeView);
if (m_layerTreeViewCommitsDeferred) {
// If we receive an invalidation from WebKit while in deferred commit mode,
// that means it's time to start producing frames again so un-defer.
m_layerTreeView->setDeferCommits(false);
m_layerTreeViewCommitsDeferred = false;
}
if (m_isAcceleratedCompositingActive) {
ASSERT(m_layerTreeView);
if (!page())
return;
if (!page())
return;
FrameView* view = page()->mainFrame()->view();
IntRect dirtyRect = view->windowToContents(rect);
updateLayerTreeViewport();
m_nonCompositedContentHost->invalidateRect(dirtyRect);
FrameView* view = page()->mainFrame()->view();
IntRect dirtyRect = view->windowToContents(rect);
updateLayerTreeViewport();
m_nonCompositedContentHost->invalidateRect(dirtyRect);
} else
m_client->didInvalidateRect(rect);
}
NonCompositedContentHost* WebViewImpl::nonCompositedContentHost()
......@@ -3907,6 +3917,14 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
if (m_layerTreeView && !page()->settings()->forceCompositingMode())
m_layerTreeView->finishAllRendering();
m_client->didDeactivateCompositor();
if (WebKit::Platform::current()->compositorSupport()->isThreadingEnabled()) {
ASSERT(m_layerTreeView);
// In threaded compositing mode, force compositing mode is always on so setIsAcceleratedCompositingActive(false)
// means that we're transitioning to a new page. Suppress commits until WebKit generates invalidations so
// we don't attempt to paint too early in the next page load.
m_layerTreeView->setDeferCommits(true);
m_layerTreeViewCommitsDeferred = true;
}
} else if (m_layerTreeView) {
m_isAcceleratedCompositingActive = true;
updateLayerTreeViewport();
......
......@@ -327,6 +327,7 @@ public:
// WebViewImpl
void suppressInvalidations(bool enable);
void invalidateRect(const WebCore::IntRect&);
void setIgnoreInputEvents(bool newValue);
WebDevToolsAgentPrivate* devToolsAgentPrivate() { return m_devToolsAgent.get(); }
......@@ -532,7 +533,6 @@ public:
void setRootGraphicsLayer(WebCore::GraphicsLayer*);
void scheduleCompositingLayerSync();
void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect);
void invalidateRootLayerRect(const WebCore::IntRect&);
void paintRootLayer(WebCore::GraphicsContext&, const WebCore::IntRect& contentRect);
NonCompositedContentHost* nonCompositedContentHost();
void setBackgroundColor(const WebCore::Color&);
......@@ -837,6 +837,7 @@ private:
WebLayer* m_rootLayer;
WebCore::GraphicsLayer* m_rootGraphicsLayer;
bool m_isAcceleratedCompositingActive;
bool m_layerTreeViewCommitsDeferred;
bool m_compositorCreationFailed;
// If true, the graphics context is being restored.
bool m_recreatingGraphicsContext;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment