Title: [98429] trunk/Source
Revision
98429
Author
nd...@chromium.org
Date
2011-10-25 22:02:41 -0700 (Tue, 25 Oct 2011)

Log Message

[chromium] Enable threaded compositing via CCThreadProxy::hasThread only
https://bugs.webkit.org/show_bug.cgi?id=70838

Reviewed by James Robinson.

Source/WebCore:

* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::initialize):
* platform/graphics/chromium/WebGLLayerChromium.cpp:
(WebCore::WebGLLayerChromium::layerRendererContext):
* platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp:
(WebCore::CCHeadsUpDisplay::enabled):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::initialize):
(WebCore::CCLayerTreeHost::context):
(WebCore::CCLayerTreeHost::setNeedsAnimate):
(WebCore::CCLayerTreeHost::setNeedsCommitThenRedraw):
(WebCore::CCLayerTreeHost::setNeedsRedraw):
(WebCore::CCLayerTreeHost::composite):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(WebCore::CCSettings::CCSettings):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::hasThread):
* platform/graphics/chromium/cc/CCThreadProxy.h:

Source/WebKit/chromium:

* public/WebLayerTreeView.h:
* src/WebCompositorImpl.cpp:
* src/WebLayerTreeView.cpp:
(WebKit::WebLayerTreeView::Settings::operator CCSettings):
(WebKit::WebLayerTreeView::composite):
* src/WebLayerTreeViewImpl.cpp:
(WebKit::WebLayerTreeViewImpl::createLayerTreeHostContext3D):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98428 => 98429)


--- trunk/Source/WebCore/ChangeLog	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebCore/ChangeLog	2011-10-26 05:02:41 UTC (rev 98429)
@@ -1,3 +1,29 @@
+2011-10-25  Nat Duca  <nd...@chromium.org>
+
+        [chromium] Enable threaded compositing via CCThreadProxy::hasThread only
+        https://bugs.webkit.org/show_bug.cgi?id=70838
+
+        Reviewed by James Robinson.
+
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::initialize):
+        * platform/graphics/chromium/WebGLLayerChromium.cpp:
+        (WebCore::WebGLLayerChromium::layerRendererContext):
+        * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp:
+        (WebCore::CCHeadsUpDisplay::enabled):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::initialize):
+        (WebCore::CCLayerTreeHost::context):
+        (WebCore::CCLayerTreeHost::setNeedsAnimate):
+        (WebCore::CCLayerTreeHost::setNeedsCommitThenRedraw):
+        (WebCore::CCLayerTreeHost::setNeedsRedraw):
+        (WebCore::CCLayerTreeHost::composite):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (WebCore::CCSettings::CCSettings):
+        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+        (WebCore::CCThreadProxy::hasThread):
+        * platform/graphics/chromium/cc/CCThreadProxy.h:
+
 2011-10-25  Xiaomei Ji  <x...@chromium.org>
 
         --webkit-visual-word does not work in multi-line

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (98428 => 98429)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-10-26 05:02:41 UTC (rev 98429)
@@ -190,7 +190,7 @@
         extensions->ensureEnabled("GL_CHROMIUM_map_sub");
 
     // Use the swapBuffers callback only with the threaded proxy.
-    if (settings().enableCompositorThread)
+    if (CCThreadProxy::hasThread())
         m_capabilities.usingSwapCompleteCallback = extensions->supports("GL_CHROMIUM_swapbuffers_complete_callback");
     if (m_capabilities.usingSwapCompleteCallback) {
         extensions->ensureEnabled("GL_CHROMIUM_swapbuffers_complete_callback");

Modified: trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp (98428 => 98429)


--- trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp	2011-10-26 05:02:41 UTC (rev 98429)
@@ -38,6 +38,7 @@
 #include "GraphicsContext3D.h"
 #include "LayerRendererChromium.h"
 #include "TraceEvent.h"
+#include "cc/CCThreadProxy.h"
 
 namespace WebCore {
 
@@ -149,7 +150,7 @@
 {
     // FIXME: In the threaded case, paintRenderedResultsToCanvas must be
     // refactored to be asynchronous. Currently this is unimplemented.
-    if (!layerTreeHost() || layerTreeHost()->settings().enableCompositorThread)
+    if (!layerTreeHost() || CCThreadProxy::hasThread())
         return 0;
     return layerTreeHost()->context();
 }

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp (98428 => 98429)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp	2011-10-26 05:02:41 UTC (rev 98429)
@@ -39,6 +39,7 @@
 #include "TextRun.h"
 #include "TextStream.h"
 #include "TextureManager.h"
+#include "cc/CCThreadProxy.h"
 #include <wtf/CurrentTime.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
@@ -90,7 +91,7 @@
 bool CCHeadsUpDisplay::enabled() const
 {
     // FIXME: HUD does not work in compositor thread mode.
-    if (settings().enableCompositorThread)
+    if (CCThreadProxy::hasThread())
         return false;
     return settings().showPlatformLayerTree || settings().showFPSCounter;
 }

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (98428 => 98429)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2011-10-26 05:02:41 UTC (rev 98429)
@@ -64,7 +64,7 @@
 bool CCLayerTreeHost::initialize()
 {
     TRACE_EVENT("CCLayerTreeHost::initialize", this, 0);
-    if (m_settings.enableCompositorThread) {
+    if (CCThreadProxy::hasThread()) {
         // The HUD does not work in threaded mode. Turn it off.
         m_settings.showFPSCounter = false;
         m_settings.showPlatformLayerTree = false;
@@ -166,7 +166,7 @@
 // Temporary hack until WebViewImpl context creation gets simplified
 GraphicsContext3D* CCLayerTreeHost::context()
 {
-    ASSERT(!m_settings.enableCompositorThread);
+    ASSERT(!CCThreadProxy::hasThread());
     return m_proxy->context();
 }
 
@@ -197,13 +197,15 @@
 
 void CCLayerTreeHost::setNeedsAnimate()
 {
-    ASSERT(m_settings.enableCompositorThread);
-    m_proxy->setNeedsAnimate();
+    if (CCThreadProxy::hasThread())
+        m_proxy->setNeedsAnimate();
+    else
+        m_client->scheduleComposite();
 }
 
 void CCLayerTreeHost::setNeedsCommitThenRedraw()
 {
-    if (m_settings.enableCompositorThread) {
+    if (CCThreadProxy::hasThread()) {
         TRACE_EVENT("CCLayerTreeHost::setNeedsRedraw", this, 0);
         m_proxy->setNeedsCommitThenRedraw();
     } else
@@ -212,7 +214,7 @@
 
 void CCLayerTreeHost::setNeedsRedraw()
 {
-    if (m_settings.enableCompositorThread)
+    if (CCThreadProxy::hasThread())
         m_proxy->setNeedsRedraw();
     else
         m_client->scheduleComposite();
@@ -248,7 +250,7 @@
 
 void CCLayerTreeHost::composite()
 {
-    ASSERT(!m_settings.enableCompositorThread);
+    ASSERT(!CCThreadProxy::hasThread());
     static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately();
 }
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (98428 => 98429)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2011-10-26 05:02:41 UTC (rev 98429)
@@ -67,13 +67,11 @@
     CCSettings()
             : acceleratePainting(false)
             , compositeOffscreen(false)
-            , enableCompositorThread(false)
             , showFPSCounter(false)
             , showPlatformLayerTree(false) { }
 
     bool acceleratePainting;
     bool compositeOffscreen;
-    bool enableCompositorThread;
     bool showFPSCounter;
     bool showPlatformLayerTree;
 };

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (98428 => 98429)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2011-10-26 05:02:41 UTC (rev 98429)
@@ -45,11 +45,16 @@
 
 CCThread* CCThreadProxy::s_ccThread = 0;
 
+bool CCThreadProxy::hasThread()
+{
+    return s_ccThread;
+}
+
 void CCThreadProxy::setThread(CCThread* ccThread)
 {
     s_ccThread = ccThread;
 #ifndef NDEBUG
-    CCProxy::setImplThread(s_ccThread->threadID());
+    CCProxy::setImplThread(s_ccThread ? s_ccThread->threadID() : 0);
 #endif
 }
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h (98428 => 98429)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h	2011-10-26 05:02:41 UTC (rev 98429)
@@ -43,6 +43,7 @@
 class CCThreadProxy : public CCProxy, CCLayerTreeHostImplClient {
     friend class CCThreadProxySchedulerClient;
 public:
+    static bool hasThread();
     static void setThread(CCThread*);
 
     static PassOwnPtr<CCProxy> create(CCLayerTreeHost*);

Modified: trunk/Source/WebKit/chromium/ChangeLog (98428 => 98429)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-10-26 05:02:41 UTC (rev 98429)
@@ -1,3 +1,20 @@
+2011-10-25  Nat Duca  <nd...@chromium.org>
+
+        [chromium] Enable threaded compositing via CCThreadProxy::hasThread only
+        https://bugs.webkit.org/show_bug.cgi?id=70838
+
+        Reviewed by James Robinson.
+
+        * public/WebLayerTreeView.h:
+        * src/WebCompositorImpl.cpp:
+        * src/WebLayerTreeView.cpp:
+        (WebKit::WebLayerTreeView::Settings::operator CCSettings):
+        (WebKit::WebLayerTreeView::composite):
+        * src/WebLayerTreeViewImpl.cpp:
+        (WebKit::WebLayerTreeViewImpl::createLayerTreeHostContext3D):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+
 2011-10-25  Antoine Labour  <pi...@chromium.org>
 
         Fix teardown in Web*LayerImpl, and add tests for Web*Layer

Modified: trunk/Source/WebKit/chromium/public/WebLayerTreeView.h (98428 => 98429)


--- trunk/Source/WebKit/chromium/public/WebLayerTreeView.h	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebKit/chromium/public/WebLayerTreeView.h	2011-10-26 05:02:41 UTC (rev 98429)
@@ -49,6 +49,8 @@
 
         bool acceleratePainting;
         bool compositeOffscreen;
+        // FIXME: this field is ignored, but is currently in use by downstream code.
+        // Remove this field once downstream stops setting it.
         bool enableCompositorThread;
 #if WEBKIT_IMPLEMENTATION
         operator WebCore::CCSettings() const;

Modified: trunk/Source/WebKit/chromium/src/WebCompositorImpl.cpp (98428 => 98429)


--- trunk/Source/WebKit/chromium/src/WebCompositorImpl.cpp	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebKit/chromium/src/WebCompositorImpl.cpp	2011-10-26 05:02:41 UTC (rev 98429)
@@ -49,8 +49,10 @@
 
 void WebCompositor::setThread(WebThread* compositorThread)
 {
-    ASSERT(compositorThread);
-    CCThreadProxy::setThread(CCThreadImpl::create(compositorThread).leakPtr());
+    if (compositorThread)
+        CCThreadProxy::setThread(CCThreadImpl::create(compositorThread).leakPtr());
+    else
+        CCThreadProxy::setThread(0);
 }
 
 
@@ -127,4 +129,3 @@
 }
 
 }
-

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp (98428 => 98429)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp	2011-10-26 05:02:41 UTC (rev 98429)
@@ -29,6 +29,7 @@
 #include "WebLayerTreeViewImpl.h"
 #include "WebSize.h"
 #include "cc/CCLayerTreeHost.h"
+#include "cc/CCThreadProxy.h"
 
 using namespace WebCore;
 
@@ -38,7 +39,6 @@
     CCSettings settings;
     settings.acceleratePainting = acceleratePainting;
     settings.compositeOffscreen = compositeOffscreen;
-    settings.enableCompositorThread = enableCompositorThread;
 
     // FIXME: showFPSCounter / showPlatformLayerTree aren't supported currently.
     settings.showFPSCounter = false;
@@ -68,7 +68,7 @@
 
 void WebLayerTreeView::composite()
 {
-    if (m_private->settings().enableCompositorThread)
+    if (CCThreadProxy::hasThread())
         m_private->setNeedsCommitThenRedraw();
     else
         m_private->composite();

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp (98428 => 98429)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp	2011-10-26 05:02:41 UTC (rev 98429)
@@ -35,6 +35,7 @@
 #include "WebLayerTreeViewClient.h"
 #include "WebSize.h"
 #include "WebThread.h"
+#include "cc/CCThreadProxy.h"
 
 using namespace WebCore;
 
@@ -91,7 +92,7 @@
     attributes.preserveDrawingBuffer = false;
 
     GraphicsContext3D::RenderStyle style = GraphicsContext3D::RenderDirectlyToHostWindow;
-    GraphicsContext3DPrivate::ThreadUsage usage = settings().enableCompositorThread ? GraphicsContext3DPrivate::ForUseOnAnotherThread : GraphicsContext3DPrivate::ForUseOnThisThread;
+    GraphicsContext3DPrivate::ThreadUsage usage = CCThreadProxy::hasThread() ? GraphicsContext3DPrivate::ForUseOnAnotherThread : GraphicsContext3DPrivate::ForUseOnThisThread;
     return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), attributes, 0, style, usage);
 }
 

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (98428 => 98429)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-10-26 05:02:41 UTC (rev 98429)
@@ -2678,7 +2678,6 @@
         WebCore::CCSettings ccSettings;
         ccSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled();
         ccSettings.compositeOffscreen = settings()->compositeToTextureEnabled();
-        ccSettings.enableCompositorThread = settings()->useThreadedCompositor();
         ccSettings.showFPSCounter = settings()->showFPSCounter();
         ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree();
 

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (98428 => 98429)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2011-10-26 04:57:39 UTC (rev 98428)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2011-10-26 05:02:41 UTC (rev 98429)
@@ -222,13 +222,6 @@
         , m_endWhenBeginReturns(false)
         , m_timedOut(false)
     {
-        m_webThread = adoptPtr(webKitPlatformSupport()->createThread("CCLayerTreeHostTest"));
-        WebCompositor::setThread(m_webThread.get());
-#ifndef NDEBUG
-        CCProxy::setMainThread(currentThread());
-#endif
-        ASSERT(CCProxy::isMainThread());
-        m_mainThreadProxy = CCScopedMainThreadProxy::create();
     }
 
     void doBeginTest();
@@ -296,7 +289,18 @@
 
     virtual void runTest(bool threaded)
     {
-        m_settings.enableCompositorThread = threaded;
+        if (threaded) {
+            m_webThread = adoptPtr(webKitPlatformSupport()->createThread("CCLayerTreeHostTest"));
+            WebCompositor::setThread(m_webThread.get());
+        } else
+            WebCompositor::setThread(0);
+
+#ifndef NDEBUG
+        CCProxy::setMainThread(currentThread());
+#endif
+        ASSERT(CCProxy::isMainThread());
+        m_mainThreadProxy = CCScopedMainThreadProxy::create();
+
         webkit_support::PostDelayedTask(CCLayerTreeHostTest::onBeginTest, static_cast<void*>(this), 0);
         m_timeoutTask = new TimeoutTask(this);
         webkit_support::PostDelayedTask(m_timeoutTask, 5000); // webkit_support takes ownership of the task
@@ -313,6 +317,7 @@
             return;
         }
         afterTest();
+        WebCompositor::setThread(0);
     }
 
     CCSettings m_settings;
@@ -753,4 +758,3 @@
 }
 
 } // namespace
-
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to