Diff
Modified: trunk/Source/WebCore/ChangeLog (96765 => 96766)
--- trunk/Source/WebCore/ChangeLog 2011-10-05 23:40:09 UTC (rev 96765)
+++ trunk/Source/WebCore/ChangeLog 2011-10-05 23:46:21 UTC (rev 96766)
@@ -1,3 +1,27 @@
+2011-10-05 Vangelis Kokkevis <[email protected]>
+
+ Switching threaded compositor from a compile time option to a
+ run time one.
+ https://bugs.webkit.org/show_bug.cgi?id=69391
+
+ Reviewed by Darin Fisher.
+
+ Mostly converted #if USE(THREADED_COMPOSITING) to a regular if statements.
+ In addition, CCLayerTreeHost::scheduleComposite() is removed as it wasn't being
+ called from anywhere,
+
+ No new tests as it doesn't add new functionality.
+
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::setNeedsCommitThenRedraw):
+ (WebCore::CCLayerTreeHost::setNeedsRedraw):
+ (WebCore::CCLayerTreeHost::composite):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+ * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
+ (WebCore::CCSingleThreadProxy::setNeedsCommitThenRedraw):
+ (WebCore::CCSingleThreadProxy::compositeImmediately):
+ * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
+
2011-10-05 Dean Jackson <[email protected]>
Parse '-webkit-filter' property syntax
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (96765 => 96766)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2011-10-05 23:40:09 UTC (rev 96765)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2011-10-05 23:46:21 UTC (rev 96766)
@@ -163,13 +163,6 @@
m_client->didRecreateGraphicsContext(success);
}
-#if !USE(THREADED_COMPOSITING)
-void CCLayerTreeHost::scheduleComposite()
-{
- m_client->scheduleComposite();
-}
-#endif
-
// Temporary hack until WebViewImpl context creation gets simplified
GraphicsContext3D* CCLayerTreeHost::context()
{
@@ -204,21 +197,19 @@
void CCLayerTreeHost::setNeedsCommitThenRedraw()
{
-#if USE(THREADED_COMPOSITING)
- TRACE_EVENT("CCLayerTreeHost::setNeedsCommitThenRedraw", this, 0);
- m_proxy->setNeedsCommitThenRedraw();
-#else
- m_client->scheduleComposite();
-#endif
+ if (m_settings.enableCompositorThread) {
+ TRACE_EVENT("CCLayerTreeHost::setNeedsRedraw", this, 0);
+ m_proxy->setNeedsCommitThenRedraw();
+ } else
+ m_client->scheduleComposite();
}
void CCLayerTreeHost::setNeedsRedraw()
{
-#if USE(THREADED_COMPOSITING)
- m_proxy->setNeedsRedraw();
-#else
- m_client->scheduleComposite();
-#endif
+ if (m_settings.enableCompositorThread)
+ m_proxy->setNeedsRedraw();
+ else
+ m_client->scheduleComposite();
}
void CCLayerTreeHost::setViewport(const IntSize& viewportSize)
@@ -249,13 +240,11 @@
return m_contentsTextureManager.get();
}
-#if !USE(THREADED_COMPOSITING)
void CCLayerTreeHost::composite()
{
ASSERT(!m_settings.enableCompositorThread);
static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately();
}
-#endif // !USE(THREADED_COMPOSITING)
void CCLayerTreeHost::updateLayers()
{
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (96765 => 96766)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2011-10-05 23:40:09 UTC (rev 96765)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2011-10-05 23:46:21 UTC (rev 96766)
@@ -102,9 +102,6 @@
PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D();
virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl();
void didRecreateGraphicsContext(bool success);
-#if !USE(THREADED_COMPOSITING)
- void scheduleComposite();
-#endif
void deleteContentsTexturesOnCCThread(TextureAllocator*);
// CCLayerTreeHost interface to WebView.
@@ -115,9 +112,8 @@
int compositorIdentifier() const { return m_compositorIdentifier; }
-#if !USE(THREADED_COMPOSITING)
+ // Only used when compositing on the main thread.
void composite();
-#endif
GraphicsContext3D* context();
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp (96765 => 96766)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp 2011-10-05 23:40:09 UTC (rev 96765)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp 2011-10-05 23:46:21 UTC (rev 96766)
@@ -161,12 +161,7 @@
void CCSingleThreadProxy::setNeedsCommitThenRedraw()
{
ASSERT(CCProxy::isMainThread());
-#if !USE(THREADED_COMPOSITING)
- m_layerTreeHost->scheduleComposite();
-#else
- // Single threaded only works with THREADED_COMPOSITING.
- CRASH();
-#endif
+ m_layerTreeHost->setNeedsCommitThenRedraw();
}
void CCSingleThreadProxy::setNeedsRedraw()
@@ -188,7 +183,6 @@
m_layerTreeHost = 0;
}
-#if !USE(THREADED_COMPOSITING)
// Called by the legacy scheduling path (e.g. where render_widget does the scheduling)
void CCSingleThreadProxy::compositeImmediately()
{
@@ -200,9 +194,7 @@
if (doComposite())
m_layerTreeHostImpl->present();
}
-#endif
-
bool CCSingleThreadProxy::recreateContextIfNeeded()
{
ASSERT(CCProxy::isMainThread());
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h (96765 => 96766)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h 2011-10-05 23:40:09 UTC (rev 96765)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h 2011-10-05 23:46:21 UTC (rev 96766)
@@ -54,10 +54,8 @@
virtual void start();
virtual void stop();
- // Special case functions.
-#if !USE(THREADED_COMPOSITING)
+ // Called by the legacy path where RenderWidget does the scheduling.
void compositeImmediately();
-#endif
private:
explicit CCSingleThreadProxy(CCLayerTreeHost*);
Modified: trunk/Source/WebKit/chromium/ChangeLog (96765 => 96766)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-10-05 23:40:09 UTC (rev 96765)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-10-05 23:46:21 UTC (rev 96766)
@@ -1,3 +1,27 @@
+2011-10-05 Vangelis Kokkevis <[email protected]>
+
+ Switching threaded compositor from a compile time option to a
+ run time one.
+ https://bugs.webkit.org/show_bug.cgi?id=69391
+
+ Reviewed by Darin Fisher.
+
+ * public/WebSettings.h:
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::WebSettingsImpl):
+ (WebKit::WebSettingsImpl::setMinimumAccelerated2dCanvasSize):
+ (WebKit::WebSettingsImpl::setUseThreadedCompositor):
+ * src/WebSettingsImpl.h:
+ (WebKit::WebSettingsImpl::useThreadedCompositor):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::animate):
+ (WebKit::WebViewImpl::composite):
+ (WebKit::WebViewImpl::setRootLayerNeedsDisplay):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ (WebKit::WebViewImpl::createLayerTreeHostContext3D):
+ (WebKit::WebViewImpl::scheduleComposite):
+ (WebKit::WebViewImpl::graphicsContext3D):
+
2011-10-05 Jer Noble <[email protected]>
WEB_AUDIO does not compile on Leopard 32-bit.
Modified: trunk/Source/WebKit/chromium/public/WebSettings.h (96765 => 96766)
--- trunk/Source/WebKit/chromium/public/WebSettings.h 2011-10-05 23:40:09 UTC (rev 96765)
+++ trunk/Source/WebKit/chromium/public/WebSettings.h 2011-10-05 23:46:21 UTC (rev 96766)
@@ -115,6 +115,8 @@
virtual void setLegacyAccelerated2dCanvasEnabled(bool) = 0;
virtual void setMinimumAccelerated2dCanvasSize(int) = 0;
virtual void setAcceleratedDrawingEnabled(bool) = 0;
+ virtual void setUseThreadedCompositor(bool) = 0;
+ virtual bool useThreadedCompositor() const = 0;
virtual void setMemoryInfoEnabled(bool) = 0;
virtual void setHyperlinkAuditingEnabled(bool) = 0;
virtual void setAsynchronousSpellCheckingEnabled(bool) = 0;
Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp (96765 => 96766)
--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp 2011-10-05 23:40:09 UTC (rev 96765)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp 2011-10-05 23:46:21 UTC (rev 96766)
@@ -50,6 +50,7 @@
, m_compositeToTextureEnabled(false)
, m_showFPSCounter(false)
, m_showPlatformLayerTree(false)
+ , m_useThreadedCompositor(false)
{
ASSERT(settings);
}
@@ -368,6 +369,11 @@
m_settings->setMinimumAccelerated2dCanvasSize(numPixels);
}
+void WebSettingsImpl::setUseThreadedCompositor(bool useThreadedCompositor)
+{
+ m_useThreadedCompositor = useThreadedCompositor;
+}
+
void WebSettingsImpl::setMemoryInfoEnabled(bool enabled)
{
m_settings->setMemoryInfoEnabled(enabled);
Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.h (96765 => 96766)
--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.h 2011-10-05 23:40:09 UTC (rev 96765)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.h 2011-10-05 23:46:21 UTC (rev 96766)
@@ -107,6 +107,8 @@
virtual void setLegacyAccelerated2dCanvasEnabled(bool);
virtual void setMinimumAccelerated2dCanvasSize(int);
virtual void setAcceleratedDrawingEnabled(bool);
+ virtual void setUseThreadedCompositor(bool);
+ virtual bool useThreadedCompositor() const { return m_useThreadedCompositor; }
virtual void setMemoryInfoEnabled(bool);
virtual void setHyperlinkAuditingEnabled(bool);
virtual void setAsynchronousSpellCheckingEnabled(bool);
@@ -126,6 +128,7 @@
bool m_compositeToTextureEnabled;
bool m_showFPSCounter;
bool m_showPlatformLayerTree;
+ bool m_useThreadedCompositor;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (96765 => 96766)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-10-05 23:40:09 UTC (rev 96765)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-10-05 23:46:21 UTC (rev 96766)
@@ -1051,15 +1051,13 @@
if (webframe) {
FrameView* view = webframe->frameView();
if (view) {
-#if !USE(THREADED_COMPOSITING)
- if (m_layerTreeHost)
+ if (!settings()->useThreadedCompositor() && m_layerTreeHost)
m_layerTreeHost->setAnimating(true);
-#endif
+
view->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(frameBeginTime));
-#if !USE(THREADED_COMPOSITING)
- if (m_layerTreeHost)
+
+ if (!settings()->useThreadedCompositor() && m_layerTreeHost)
m_layerTreeHost->setAnimating(false);
-#endif
}
}
#endif
@@ -1160,19 +1158,19 @@
void WebViewImpl::composite(bool)
{
#if USE(ACCELERATED_COMPOSITING)
-#if USE(THREADED_COMPOSITING)
- m_layerTreeHost->setNeedsRedraw();
-#else
- ASSERT(isAcceleratedCompositingActive());
- if (!page())
- return;
+ if (settings()->useThreadedCompositor())
+ m_layerTreeHost->setNeedsRedraw();
+ else {
+ ASSERT(isAcceleratedCompositingActive());
+ if (!page())
+ return;
- if (m_pageOverlay)
- m_pageOverlay->update();
+ if (m_pageOverlay)
+ m_pageOverlay->update();
- m_layerTreeHost->composite();
+ m_layerTreeHost->composite();
+ }
#endif
-#endif
}
void WebViewImpl::loseCompositorContext(int numTimes)
@@ -2570,12 +2568,8 @@
zoomMatrix.scale(m_page->settings()->zoomAnimatorScale());
m_layerTreeHost->setZoomAnimatorTransform(zoomMatrix);
}
-#if USE(THREADED_COMPOSITING)
if (m_layerTreeHost)
m_layerTreeHost->setNeedsCommitThenRedraw();
-#else
- m_client->scheduleComposite();
-#endif
}
void WebViewImpl::scrollRootLayerRect(const IntSize& scrollDelta, const IntRect& clipRect)
@@ -2657,11 +2651,7 @@
WebCore::CCSettings ccSettings;
ccSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled();
ccSettings.compositeOffscreen = settings()->compositeToTextureEnabled();
-#if USE(THREADED_COMPOSITING)
- ccSettings.enableCompositorThread = true;
-#else
- ccSettings.enableCompositorThread = false;
-#endif
+ ccSettings.enableCompositorThread = settings()->useThreadedCompositor();
ccSettings.showFPSCounter = settings()->showFPSCounter();
ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree();
@@ -2692,11 +2682,10 @@
{
RefPtr<GraphicsContext3D> context = m_temporaryOnscreenGraphicsContext3D.release();
if (!context) {
-#if USE(THREADED_COMPOSITING)
- context = GraphicsContext3DPrivate::createGraphicsContextForAnotherThread(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
-#else
- context = GraphicsContext3D::create(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
-#endif
+ if (settings()->useThreadedCompositor())
+ context = GraphicsContext3DPrivate::createGraphicsContextForAnotherThread(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
+ else
+ context = GraphicsContext3D::create(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
}
return context;
}
@@ -2734,12 +2723,11 @@
m_pageOverlay->update();
}
-#if !USE(THREADED_COMPOSITING)
void WebViewImpl::scheduleComposite()
{
+ ASSERT(!settings()->useThreadedCompositor());
m_client->scheduleComposite();
}
-#endif
void WebViewImpl::updateLayerTreeViewport()
{
@@ -2768,11 +2756,11 @@
if (webContext && !webContext->isContextLost())
return webContext;
}
-#if USE(THREADED_COMPOSITING)
- m_temporaryOnscreenGraphicsContext3D = GraphicsContext3DPrivate::createGraphicsContextForAnotherThread(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
-#else
- m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
-#endif
+ if (settings()->useThreadedCompositor())
+ m_temporaryOnscreenGraphicsContext3D = GraphicsContext3DPrivate::createGraphicsContextForAnotherThread(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
+ else
+ m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
+
return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_temporaryOnscreenGraphicsContext3D.get());
}
#endif