[chromium] Use WebCompositorSupport functions instead of WebCompositor statics
authorjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Sep 2012 23:17:48 +0000 (23:17 +0000)
committerjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Sep 2012 23:17:48 +0000 (23:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=96007

Reviewed by Adrienne Walker.

Source/Platform:

Updates comment to reference WebCompositorSupport instead of WebCompositor.

* chromium/public/WebLayerTreeView.h:
(WebLayerTreeView):

Source/WebCore:

Calls WebCompositorSupport functions instead of WebCompositor statics.

* platform/graphics/chromium/Canvas2DLayerBridge.cpp:
(WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
* platform/graphics/chromium/DrawingBufferChromium.cpp:
(WebCore::DrawingBuffer::DrawingBuffer):

Source/WebKit/chromium:

Updates many tests to initialize / shutdown compositing with WebCompositorSupport. Adds a
WebCompositorInitializer RAII class to simplify this somewhat tedious process.

* WebKit.gypi:
* public/WebCompositorInputHandlerClient.h:
(WebCompositorInputHandlerClient):
* src/WebCompositorInputHandlerImpl.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::composite):
(WebKit::WebViewImpl::scheduleAnimation):
(WebKit::WebViewImpl::scheduleComposite):
* tests/CCPrioritizedTextureTest.cpp:
(WTF::CCPrioritizedTextureTest::CCPrioritizedTextureTest):
(WTF::CCPrioritizedTextureTest::~CCPrioritizedTextureTest):
(CCPrioritizedTextureTest):
* tests/CCRendererGLTest.cpp:
(CCRendererGLTest::CCRendererGLTest):
(CCRendererGLTest::SetUp):
(CCRendererGLTest):
* tests/CCTextureUpdateControllerTest.cpp:
* tests/CCThreadedTest.cpp:
(WebKitTests::CCThreadedTest::runTest):
* tests/Canvas2DLayerBridgeTest.cpp:
(Canvas2DLayerBridgeTest::fullLifecycleTest):
* tests/GraphicsLayerChromiumTest.cpp:
(WebKit::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest):
(WebKit::GraphicsLayerChromiumTest::~GraphicsLayerChromiumTest):
* tests/LayerChromiumTest.cpp:
* tests/LinkHighlightTest.cpp:
(WebCore::TEST):
* tests/TextureLayerChromiumTest.cpp:
* tests/TiledLayerChromiumTest.cpp:
* tests/WebCompositorInitializer.h: Added.
(WebKit):
(WebKitTests):
(WebCompositorInitializer):
(WebKitTests::WebCompositorInitializer::WebCompositorInitializer):
(WebKitTests::WebCompositorInitializer::~WebCompositorInitializer):
* tests/WebCompositorInputHandlerImplTest.cpp:
(WebKit::TEST):
(WebKit::WebCompositorInputHandlerImplTest::WebCompositorInputHandlerImplTest):
(WebCompositorInputHandlerImplTest):
* tests/WebLayerTest.cpp:
* tests/WebLayerTreeViewTest.cpp:

Tools:

Fixes initialization / settings code to use WebCompositorSupport.

* DumpRenderTree/chromium/DumpRenderTree.cpp:
(main):
* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::initialize):
(TestShell::setPerTilePaintingEnabled):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127794 268f45cc-cd09-0410-ab3c-d52691b4dbfc

27 files changed:
Source/Platform/ChangeLog
Source/Platform/chromium/public/WebLayerTreeView.h
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp
Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gypi
Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h
Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp
Source/WebKit/chromium/tests/CCRendererGLTest.cpp
Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp
Source/WebKit/chromium/tests/CCThreadedTest.cpp
Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp
Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp
Source/WebKit/chromium/tests/LayerChromiumTest.cpp
Source/WebKit/chromium/tests/LinkHighlightTest.cpp
Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp
Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
Source/WebKit/chromium/tests/WebCompositorInitializer.h [new file with mode: 0644]
Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp
Source/WebKit/chromium/tests/WebLayerTest.cpp
Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp
Tools/ChangeLog
Tools/DumpRenderTree/chromium/DumpRenderTree.cpp
Tools/DumpRenderTree/chromium/TestShell.cpp

index 2a932eb..29d1e0d 100644 (file)
@@ -1,3 +1,15 @@
+2012-09-06  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Use WebCompositorSupport functions instead of WebCompositor statics
+        https://bugs.webkit.org/show_bug.cgi?id=96007
+
+        Reviewed by Adrienne Walker.
+
+        Updates comment to reference WebCompositorSupport instead of WebCompositor.
+
+        * chromium/public/WebLayerTreeView.h:
+        (WebLayerTreeView):
+
 2012-09-06  Jeff Timanus  <twiz@chromium.org>
 
         [Chromium] Remove contentsScale and related logic from GraphicsLayerChromium.
index 4918379..40a3bbd 100644 (file)
@@ -133,7 +133,7 @@ public:
     virtual bool commitRequested() const = 0;
 
     // Triggers a compositing pass. If the compositor thread was not
-    // enabled via WebCompositor::initialize, the compositing pass happens
+    // enabled via WebCompositorSupport::initialize, the compositing pass happens
     // immediately. If it is enabled, the compositing pass will happen at a
     // later time. Before the compositing pass happens (i.e. before composite()
     // returns when the compositor thread is disabled), WebContentLayers will be
index b94b5b2..c50126f 100644 (file)
@@ -1,3 +1,17 @@
+2012-09-06  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Use WebCompositorSupport functions instead of WebCompositor statics
+        https://bugs.webkit.org/show_bug.cgi?id=96007
+
+        Reviewed by Adrienne Walker.
+
+        Calls WebCompositorSupport functions instead of WebCompositor statics.
+
+        * platform/graphics/chromium/Canvas2DLayerBridge.cpp:
+        (WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
+        * platform/graphics/chromium/DrawingBufferChromium.cpp:
+        (WebCore::DrawingBuffer::DrawingBuffer):
+
 2012-09-06  Alec Flett  <alecflett@chromium.org>
 
         IndexedDB: make IDBKeyPath's string and array constructors explicit
index 12303e3..126d62d 100644 (file)
@@ -35,7 +35,6 @@
 #include "GraphicsLayerChromium.h"
 #include "TraceEvent.h"
 #include <public/Platform.h>
-#include <public/WebCompositor.h>
 #include <public/WebCompositorSupport.h>
 #include <public/WebGraphicsContext3D.h>
 
@@ -47,11 +46,6 @@ namespace WebCore {
 
 Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context, const IntSize& size, DeferralMode deferralMode, unsigned textureId)
     : m_deferralMode(deferralMode)
-    // FIXME: We currently turn off double buffering when canvas rendering is
-    // deferred. What we should be doing is to use a smarter heuristic based
-    // on GPU resource monitoring and other factors to chose between single
-    // and double buffering.
-    , m_useDoubleBuffering(WebKit::WebCompositor::isThreadingEnabled() && deferralMode == NonDeferred)
     , m_frontBufferTexture(0)
     , m_backBufferTexture(textureId)
     , m_size(size)
@@ -61,6 +55,13 @@ Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context,
     , m_next(0)
     , m_prev(0)
 {
+    bool compositorThreadingEnabled = WebKit::Platform::current()->compositorSupport()->isThreadingEnabled();
+    // FIXME: We currently turn off double buffering when canvas rendering is
+    // deferred. What we should be doing is to use a smarter heuristic based
+    // on GPU resource monitoring and other factors to chose between single
+    // and double buffering.
+    m_useDoubleBuffering = compositorThreadingEnabled && deferralMode == NonDeferred;
+
     if (m_useDoubleBuffering) {
         m_context->makeContextCurrent();
         GLC(m_context.get(), m_frontBufferTexture = m_context->createTexture());
@@ -82,7 +83,7 @@ Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context,
         m_layer = adoptPtr(WebKit::WebExternalTextureLayer::create(this));
 
     m_layer->setTextureId(textureId);
-    m_layer->setRateLimitContext(!WebKit::WebCompositor::isThreadingEnabled() || m_useDoubleBuffering);
+    m_layer->setRateLimitContext(!compositorThreadingEnabled || m_useDoubleBuffering);
     GraphicsLayerChromium::registerContentsLayer(m_layer->layer());
 }
 
index f5d3c89..ba495ed 100644 (file)
@@ -39,7 +39,6 @@
 #include "GraphicsLayerChromium.h"
 #include <algorithm>
 #include <public/Platform.h>
-#include <public/WebCompositor.h>
 #include <public/WebCompositorSupport.h>
 #include <public/WebExternalTextureLayer.h>
 #include <public/WebExternalTextureLayerClient.h>
@@ -84,7 +83,6 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context,
     , m_fbo(0)
     , m_colorBuffer(0)
     , m_frontColorBuffer(0)
-    , m_separateFrontTexture(m_preserveDrawingBuffer == Preserve || WebKit::WebCompositor::isThreadingEnabled())
     , m_depthStencilBuffer(0)
     , m_depthBuffer(0)
     , m_stencilBuffer(0)
@@ -92,6 +90,9 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context,
     , m_multisampleColorBuffer(0)
     , m_contentsChanged(true)
 {
+    // We need a separate front and back textures if ...
+    m_separateFrontTexture = m_preserveDrawingBuffer == Preserve // ... we have to preserve contents after compositing, which is done with a copy or ...
+                             || WebKit::Platform::current()->compositorSupport()->isThreadingEnabled(); // ... if we're in threaded mode and need to double buffer.
     initialize(size);
 }
 
index 9a7d685..edb53dd 100644 (file)
@@ -1,3 +1,55 @@
+2012-09-06  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Use WebCompositorSupport functions instead of WebCompositor statics
+        https://bugs.webkit.org/show_bug.cgi?id=96007
+
+        Reviewed by Adrienne Walker.
+
+        Updates many tests to initialize / shutdown compositing with WebCompositorSupport. Adds a
+        WebCompositorInitializer RAII class to simplify this somewhat tedious process.
+
+        * WebKit.gypi:
+        * public/WebCompositorInputHandlerClient.h:
+        (WebCompositorInputHandlerClient):
+        * src/WebCompositorInputHandlerImpl.h:
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::composite):
+        (WebKit::WebViewImpl::scheduleAnimation):
+        (WebKit::WebViewImpl::scheduleComposite):
+        * tests/CCPrioritizedTextureTest.cpp:
+        (WTF::CCPrioritizedTextureTest::CCPrioritizedTextureTest):
+        (WTF::CCPrioritizedTextureTest::~CCPrioritizedTextureTest):
+        (CCPrioritizedTextureTest):
+        * tests/CCRendererGLTest.cpp:
+        (CCRendererGLTest::CCRendererGLTest):
+        (CCRendererGLTest::SetUp):
+        (CCRendererGLTest):
+        * tests/CCTextureUpdateControllerTest.cpp:
+        * tests/CCThreadedTest.cpp:
+        (WebKitTests::CCThreadedTest::runTest):
+        * tests/Canvas2DLayerBridgeTest.cpp:
+        (Canvas2DLayerBridgeTest::fullLifecycleTest):
+        * tests/GraphicsLayerChromiumTest.cpp:
+        (WebKit::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest):
+        (WebKit::GraphicsLayerChromiumTest::~GraphicsLayerChromiumTest):
+        * tests/LayerChromiumTest.cpp:
+        * tests/LinkHighlightTest.cpp:
+        (WebCore::TEST):
+        * tests/TextureLayerChromiumTest.cpp:
+        * tests/TiledLayerChromiumTest.cpp:
+        * tests/WebCompositorInitializer.h: Added.
+        (WebKit):
+        (WebKitTests):
+        (WebCompositorInitializer):
+        (WebKitTests::WebCompositorInitializer::WebCompositorInitializer):
+        (WebKitTests::WebCompositorInitializer::~WebCompositorInitializer):
+        * tests/WebCompositorInputHandlerImplTest.cpp:
+        (WebKit::TEST):
+        (WebKit::WebCompositorInputHandlerImplTest::WebCompositorInputHandlerImplTest):
+        (WebCompositorInputHandlerImplTest):
+        * tests/WebLayerTest.cpp:
+        * tests/WebLayerTreeViewTest.cpp:
+
 2012-09-06  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed.  Rolled DEPS.
index 66a99d9..e0411c2 100644 (file)
             'tests/URLTestHelpers.cpp',
             'tests/URLTestHelpers.h',
             'tests/WebCompositorInputHandlerImplTest.cpp',
+            'tests/WebCompositorInitializer.h',
             'tests/WebFrameTest.cpp',
             'tests/WebMediaPlayerClientImplTest.cpp',
             'tests/WebPageNewSerializerTest.cpp',
index 7c911d8..a4c4f62 100644 (file)
@@ -35,12 +35,12 @@ public:
     // Callbacks invoked from the compositor thread.
     virtual void willShutdown() = 0;
 
-    // Exactly one of the following two callbacks will be invoked after every call to WebCompositor::handleInputEvent():
+    // Exactly one of the following two callbacks will be invoked after every call to WebCompositorInputHandler::handleInputEvent():
 
-    // Called when the WebCompositor handled the input event and no further processing is required.
+    // Called when the WebCompositorInputHandler handled the input event and no further processing is required.
     virtual void didHandleInputEvent() = 0;
 
-    // Called when the WebCompositor did not handle the input event. If sendToWidget is true, the input event
+    // Called when the WebCompositorInputHandler did not handle the input event. If sendToWidget is true, the input event
     // should be forwarded to the WebWidget associated with this compositor for further processing.
     virtual void didNotHandleInputEvent(bool sendToWidget) = 0;
 
index 9474b21..c9feeef 100644 (file)
@@ -31,7 +31,6 @@
 #include "WebActiveWheelFlingParameters.h"
 #include "WebCompositorInputHandler.h"
 #include "WebInputEvent.h"
-#include <public/WebCompositor.h>
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/OwnPtr.h>
index 14c4bb4..1bad7c7 100644 (file)
 #include "WebAccessibilityObject.h"
 #include "WebActiveWheelFlingParameters.h"
 #include "WebAutofillClient.h"
-#include "WebCompositorImpl.h"
 #include "WebDevToolsAgentImpl.h"
 #include "WebDevToolsAgentPrivate.h"
 #include "WebFrameImpl.h"
 #include "WheelEvent.h"
 #include "painting/GraphicsContextBuilder.h"
 #include <public/Platform.h>
-#include <public/WebCompositor.h>
 #include <public/WebCompositorOutputSurface.h>
+#include <public/WebCompositorSupport.h>
 #include <public/WebDragData.h>
 #include <public/WebFloatPoint.h>
 #include <public/WebGraphicsContext3D.h>
@@ -1819,7 +1818,7 @@ void WebViewImpl::themeChanged()
 void WebViewImpl::composite(bool)
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (WebCompositor::isThreadingEnabled())
+    if (Platform::current()->compositorSupport()->isThreadingEnabled())
         m_layerTreeView->setNeedsRedraw();
     else {
         ASSERT(isAcceleratedCompositingActive());
@@ -3735,7 +3734,7 @@ WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer()
 void WebViewImpl::scheduleAnimation()
 {
     if (isAcceleratedCompositingActive()) {
-        if (WebCompositor::isThreadingEnabled()) {
+        if (Platform::current()->compositorSupport()->isThreadingEnabled()) {
             ASSERT(m_layerTreeView);
             m_layerTreeView->setNeedsAnimate();
         } else
@@ -3968,7 +3967,7 @@ void WebViewImpl::didRecreateOutputSurface(bool success)
 
 void WebViewImpl::scheduleComposite()
 {
-    ASSERT(!WebCompositor::isThreadingEnabled());
+    ASSERT(!Platform::current()->compositorSupport()->isThreadingEnabled());
     m_client->scheduleComposite();
 }
 
index 383fa59..9076d34 100644 (file)
@@ -31,8 +31,8 @@
 #include "CCTexture.h"
 #include "CCTiledLayerTestCommon.h"
 #include "FakeCCGraphicsContext.h"
+#include "WebCompositorInitializer.h"
 #include <gtest/gtest.h>
-#include <public/WebCompositor.h>
 
 using namespace WebCore;
 using namespace WebKitTests;
@@ -45,20 +45,17 @@ public:
     CCPrioritizedTextureTest()
         : m_textureSize(256, 256)
         , m_textureFormat(GraphicsContext3D::RGBA)
+        , m_compositorInitializer(0)
         , m_context(WebKit::createFakeCCGraphicsContext())
     {
-        WebKit::WebCompositor::initialize(0);
         DebugScopedSetImplThread implThread;
         m_resourceProvider = CCResourceProvider::create(m_context.get());
     }
 
     virtual ~CCPrioritizedTextureTest()
     {
-        {
-            DebugScopedSetImplThread implThread;
-            m_resourceProvider.clear();
-        }
-        WebKit::WebCompositor::shutdown();
+        DebugScopedSetImplThread implThread;
+        m_resourceProvider.clear();
     }
 
     size_t texturesMemorySize(size_t textureCount)
@@ -93,6 +90,7 @@ public:
 protected:
     const IntSize m_textureSize;
     const GC3Denum m_textureFormat;
+    WebCompositorInitializer m_compositorInitializer;
     OwnPtr<CCGraphicsContext> m_context;
     OwnPtr<CCResourceProvider> m_resourceProvider;
 };
index 2f3fd6a..9d6f223 100644 (file)
@@ -33,9 +33,9 @@
 #include "FakeWebCompositorOutputSurface.h"
 #include "FakeWebGraphicsContext3D.h"
 #include "GraphicsContext3D.h"
+#include "WebCompositorInitializer.h"
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
-#include <public/WebCompositor.h>
 #include <public/WebTransformationMatrix.h>
 
 using namespace WebCore;
@@ -128,6 +128,7 @@ protected:
     CCRendererGLTest()
         : m_suggestHaveBackbufferYes(1, true)
         , m_suggestHaveBackbufferNo(1, false)
+        , m_compositorInitializer(0)
         , m_context(FakeWebCompositorOutputSurface::create(adoptPtr(new FrameCountingMemoryAllocationSettingContext())))
         , m_resourceProvider(CCResourceProvider::create(m_context.get()))
         , m_renderer(&m_mockClient, m_resourceProvider.get())
@@ -136,15 +137,9 @@ protected:
 
     virtual void SetUp()
     {
-        WebKit::WebCompositor::initialize(0);
         m_renderer.initialize();
     }
 
-    virtual void TearDown()
-    {
-        WebKit::WebCompositor::shutdown();
-    }
-
     void swapBuffers()
     {
         m_renderer.swapBuffers();
@@ -155,6 +150,7 @@ protected:
     WebGraphicsMemoryAllocation m_suggestHaveBackbufferYes;
     WebGraphicsMemoryAllocation m_suggestHaveBackbufferNo;
 
+    WebCompositorInitializer m_compositorInitializer;
     OwnPtr<CCGraphicsContext> m_context;
     FakeCCRendererClient m_mockClient;
     OwnPtr<CCResourceProvider> m_resourceProvider;
index 11659f6..baf63c2 100644 (file)
@@ -31,8 +31,8 @@
 #include "CCTiledLayerTestCommon.h"
 #include "FakeWebCompositorOutputSurface.h"
 #include "FakeWebGraphicsContext3D.h"
+#include "WebCompositorInitializer.h"
 #include <gtest/gtest.h>
-#include <public/WebCompositor.h>
 #include <public/WebThread.h>
 #include <wtf/RefPtr.h>
 
@@ -95,21 +95,23 @@ public:
 class CCTextureUpdateControllerTest : public Test {
 public:
     CCTextureUpdateControllerTest()
-    : m_queue(adoptPtr(new CCTextureUpdateQueue))
-    , m_uploader(this)
-    , m_fullUploadCountExpected(0)
-    , m_partialCountExpected(0)
-    , m_totalUploadCountExpected(0)
-    , m_maxUploadCountPerUpdate(0)
-    , m_numBeginUploads(0)
-    , m_numEndUploads(0)
-    , m_numConsecutiveFlushes(0)
-    , m_numDanglingUploads(0)
-    , m_numTotalUploads(0)
-    , m_numTotalFlushes(0)
-    , m_numPreviousUploads(0)
-    , m_numPreviousFlushes(0)
-    { }
+        : m_queue(adoptPtr(new CCTextureUpdateQueue))
+        , m_uploader(this)
+        , m_compositorInitializer(m_thread.get())
+        , m_fullUploadCountExpected(0)
+        , m_partialCountExpected(0)
+        , m_totalUploadCountExpected(0)
+        , m_maxUploadCountPerUpdate(0)
+        , m_numBeginUploads(0)
+        , m_numEndUploads(0)
+        , m_numConsecutiveFlushes(0)
+        , m_numDanglingUploads(0)
+        , m_numTotalUploads(0)
+        , m_numTotalFlushes(0)
+        , m_numPreviousUploads(0)
+        , m_numPreviousFlushes(0)
+    {
+    }
 
 public:
     void onFlush()
@@ -170,19 +172,11 @@ public:
 protected:
     virtual void SetUp()
     {
-        OwnPtr<WebThread> thread;
-        WebCompositor::initialize(thread.get());
-
         m_context = FakeWebCompositorOutputSurface::create(adoptPtr(new WebGraphicsContext3DForUploadTest(this)));
         DebugScopedSetImplThread implThread;
         m_resourceProvider = CCResourceProvider::create(m_context.get());
     }
 
-    virtual void TearDown()
-    {
-        WebCompositor::shutdown();
-    }
-
     void appendFullUploadsToUpdateQueue(int count)
     {
         m_fullUploadCountExpected += count;
@@ -218,6 +212,9 @@ protected:
     TextureForUploadTest m_texture;
     FakeTextureCopier m_copier;
     TextureUploaderForUploadTest m_uploader;
+    OwnPtr<WebThread> m_thread;
+    WebCompositorInitializer m_compositorInitializer;
+
 
     // Properties / expectations of this test
     int m_fullUploadCountExpected;
index 4ed1277..aeb35a5 100644 (file)
@@ -44,7 +44,7 @@
 #include "LayerChromium.h"
 #include <gmock/gmock.h>
 #include <public/Platform.h>
-#include <public/WebCompositor.h>
+#include <public/WebCompositorSupport.h>
 #include <public/WebFilterOperation.h>
 #include <public/WebFilterOperations.h>
 #include <public/WebThread.h>
@@ -600,13 +600,13 @@ void CCThreadedTest::dispatchDidAddAnimation(void* self)
 void CCThreadedTest::runTest(bool threaded)
 {
     // For these tests, we will enable threaded animations.
-    WebCompositor::setAcceleratedAnimationEnabled(true);
+    Platform::current()->compositorSupport()->setAcceleratedAnimationEnabled(true);
 
     if (threaded) {
         m_webThread = adoptPtr(WebKit::Platform::current()->createThread("CCThreadedTest"));
-        WebCompositor::initialize(m_webThread.get());
+        Platform::current()->compositorSupport()->initialize(m_webThread.get());
     } else
-        WebCompositor::initialize(0);
+        Platform::current()->compositorSupport()->initialize(0);
 
     ASSERT(CCProxy::isMainThread());
     m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread());
@@ -633,11 +633,11 @@ void CCThreadedTest::runTest(bool threaded)
     m_client.clear();
     if (m_timedOut) {
         FAIL() << "Test timed out";
-        WebCompositor::shutdown();
+        Platform::current()->compositorSupport()->shutdown();
         return;
     }
     afterTest();
-    WebCompositor::shutdown();
+    Platform::current()->compositorSupport()->shutdown();
 }
 
 } // namespace WebKitTests
index 6972424..26bdd4f 100644 (file)
@@ -30,8 +30,8 @@
 #include "FakeWebGraphicsContext3D.h"
 #include "GraphicsContext3DPrivate.h"
 #include "ImageBuffer.h"
+#include "WebCompositorInitializer.h"
 #include <public/Platform.h>
-#include <public/WebCompositor.h>
 #include <public/WebThread.h>
 
 #include <gmock/gmock.h>
@@ -81,7 +81,7 @@ protected:
         OwnPtr<WebThread> thread;
         if (threadMode == Threaded)
             thread = adoptPtr(WebKit::Platform::current()->createThread("Canvas2DLayerBridgeTest"));
-        WebCompositor::initialize(thread.get());
+        WebKitTests::WebCompositorInitializer initializer(thread.get());
 
         WebGLId backTextureId = 1;
         WebGLId frontTextureId = 1;
@@ -109,8 +109,6 @@ protected:
             EXPECT_CALL(mainMock, flush());
         }
         bridge.clear();
-
-        WebCompositor::shutdown();
     }
 };
 
index 7fab0d2..8c4deda 100644 (file)
@@ -37,7 +37,8 @@
 #include "TranslateTransformOperation.h"
 #include "WebLayerTreeViewTestCommon.h"
 #include <gtest/gtest.h>
-#include <public/WebCompositor.h>
+#include <public/Platform.h>
+#include <public/WebCompositorSupport.h>
 #include <public/WebFloatAnimationCurve.h>
 #include <public/WebGraphicsContext3D.h>
 #include <public/WebLayerTreeView.h>
@@ -63,8 +64,8 @@ public:
     GraphicsLayerChromiumTest()
     {
         // For these tests, we will enable threaded animations.
-        WebCompositor::setAcceleratedAnimationEnabled(true);
-        WebCompositor::initialize(0);
+        Platform::current()->compositorSupport()->setAcceleratedAnimationEnabled(true);
+        Platform::current()->compositorSupport()->initialize(0);
         m_graphicsLayer = static_pointer_cast<GraphicsLayerChromium>(GraphicsLayer::create(&m_client));
         m_platformLayer = m_graphicsLayer->platformLayer();
         m_layerTreeView = adoptPtr(WebLayerTreeView::create(&m_layerTreeViewClient, *m_platformLayer, WebLayerTreeView::Settings()));
@@ -75,7 +76,7 @@ public:
     {
         m_graphicsLayer.clear();
         m_layerTreeView.clear();
-        WebCompositor::shutdown();
+        Platform::current()->compositorSupport()->shutdown();
     }
 
 protected:
index 1283c79..a17b076 100644 (file)
@@ -32,9 +32,9 @@
 #include "CCSingleThreadProxy.h"
 #include "FakeCCLayerTreeHostClient.h"
 #include "LayerPainterChromium.h"
+#include "WebCompositorInitializer.h"
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
-#include <public/WebCompositor.h>
 #include <public/WebTransformationMatrix.h>
 
 using namespace WebCore;
@@ -74,11 +74,15 @@ public:
 
 
 class LayerChromiumTest : public testing::Test {
+public:
+    LayerChromiumTest()
+        : m_compositorInitializer(0)
+    {
+    }
+
 protected:
     virtual void SetUp()
     {
-        // Initialize without threading support.
-        WebKit::WebCompositor::initialize(0);
         m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost);
     }
 
@@ -96,7 +100,6 @@ protected:
 
         m_layerTreeHost->setRootLayer(0);
         m_layerTreeHost.clear();
-        WebKit::WebCompositor::shutdown();
     }
 
     void verifyTestTreeInitialState() const
@@ -149,6 +152,7 @@ protected:
 
     OwnPtr<MockCCLayerTreeHost> m_layerTreeHost;
     RefPtr<LayerChromium> m_parent, m_child1, m_child2, m_child3, m_grandChild1, m_grandChild2, m_grandChild3;
+    WebCompositorInitializer m_compositorInitializer;
 };
 
 TEST_F(LayerChromiumTest, basicCreateAndDestroy)
@@ -635,7 +639,7 @@ void assertLayerTreeHostMatchesForSubtree(LayerChromium* layer, CCLayerTreeHost*
 
 TEST(LayerChromiumLayerTreeHostTest, enteringTree)
 {
-    WebKit::WebCompositor::initialize(0);
+    WebCompositorInitializer compositorInitializer(0);
     RefPtr<LayerChromium> parent = LayerChromium::create();
     RefPtr<LayerChromium> child = LayerChromium::create();
     RefPtr<LayerChromium> mask = LayerChromium::create();
@@ -662,12 +666,11 @@ TEST(LayerChromiumLayerTreeHostTest, enteringTree)
     assertLayerTreeHostMatchesForSubtree(parent.get(), 0);
 
     layerTreeHost.clear();
-    WebKit::WebCompositor::shutdown();
 }
 
 TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree)
 {
-    WebKit::WebCompositor::initialize(0);
+    WebCompositorInitializer compositorInitializer(0);
     RefPtr<LayerChromium> parent = LayerChromium::create();
     OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
 
@@ -693,12 +696,11 @@ TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree)
 
     layerTreeHost->setRootLayer(0);
     layerTreeHost.clear();
-    WebKit::WebCompositor::shutdown();
 }
 
 TEST(LayerChromiumLayerTreeHostTest, changeHost)
 {
-    WebKit::WebCompositor::initialize(0);
+    WebCompositorInitializer compositorInitializer(0);
     RefPtr<LayerChromium> parent = LayerChromium::create();
     RefPtr<LayerChromium> child = LayerChromium::create();
     RefPtr<LayerChromium> mask = LayerChromium::create();
@@ -726,12 +728,11 @@ TEST(LayerChromiumLayerTreeHostTest, changeHost)
     secondLayerTreeHost->setRootLayer(0);
     firstLayerTreeHost.clear();
     secondLayerTreeHost.clear();
-    WebKit::WebCompositor::shutdown();
 }
 
 TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree)
 {
-    WebKit::WebCompositor::initialize(0);
+    WebCompositorInitializer compositorInitializer(0);
     RefPtr<LayerChromium> firstParent = LayerChromium::create();
     RefPtr<LayerChromium> firstChild = LayerChromium::create();
     RefPtr<LayerChromium> secondParent = LayerChromium::create();
@@ -763,12 +764,11 @@ TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree)
     secondLayerTreeHost->setRootLayer(0);
     firstLayerTreeHost.clear();
     secondLayerTreeHost.clear();
-    WebKit::WebCompositor::shutdown();
 }
 
 TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer)
 {
-    WebKit::WebCompositor::initialize(0);
+    WebCompositorInitializer compositorInitializer(0);
     RefPtr<LayerChromium> parent = LayerChromium::create();
     RefPtr<LayerChromium> mask = LayerChromium::create();
     RefPtr<LayerChromium> replica = LayerChromium::create();
@@ -800,19 +800,17 @@ TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer)
     // Test over, cleanup time.
     layerTreeHost->setRootLayer(0);
     layerTreeHost.clear();
-    WebKit::WebCompositor::shutdown();
 }
 
 TEST(LayerChromiumLayerTreeHostTest, destroyHostWithNonNullRootLayer)
 {
-    WebKit::WebCompositor::initialize(0);
+    WebCompositorInitializer compositorInitializer(0);
     RefPtr<LayerChromium> root = LayerChromium::create();
     RefPtr<LayerChromium> child = LayerChromium::create();
     root->addChild(child);
     OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
     layerTreeHost->setRootLayer(root);
     layerTreeHost.clear();
-    WebKit::WebCompositor::shutdown();
 }
 
 class MockLayerChromium : public LayerChromium {
index 64830ef..eafe230 100644 (file)
 #include "IntRect.h"
 #include "Node.h"
 #include "URLTestHelpers.h"
+#include "WebCompositorInitializer.h"
 #include "WebFrame.h"
 #include "WebViewImpl.h"
 #include <gtest/gtest.h>
-#include <public/WebCompositor.h>
 #include <public/WebContentLayer.h>
 #include <public/WebFloatPoint.h>
 #include <public/WebSize.h>
@@ -47,7 +47,7 @@ namespace {
 #if ENABLE(GESTURE_EVENTS)
 TEST(LinkHighlightTest, verifyWebViewImplIntegration)
 {
-    WebCompositor::initialize(0);
+    WebKitTests::WebCompositorInitializer compositorInitializer(0);
 
     const std::string baseURL("http://www.test.com/");
     const std::string fileName("test_touch_link_highlight.html");
@@ -82,7 +82,6 @@ TEST(LinkHighlightTest, verifyWebViewImplIntegration)
     ASSERT_TRUE(webViewImpl->linkHighlight());
 
     webViewImpl->close();
-    WebCompositor::shutdown();
 }
 #endif
 
index a4830e5..72e0206 100644 (file)
@@ -28,9 +28,9 @@
 
 #include "CCLayerTreeHost.h"
 #include "FakeCCLayerTreeHostClient.h"
+#include "WebCompositorInitializer.h"
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
-#include <public/WebCompositor.h>
 
 using namespace WebCore;
 using ::testing::Mock;
@@ -56,11 +56,15 @@ private:
 
 
 class TextureLayerChromiumTest : public testing::Test {
+public:
+    TextureLayerChromiumTest()
+        : m_compositorInitializer(0)
+    {
+    }
+
 protected:
     virtual void SetUp()
     {
-        // Initialize without threading support.
-        WebKit::WebCompositor::initialize(0);
         m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost);
     }
 
@@ -71,10 +75,11 @@ protected:
 
         m_layerTreeHost->setRootLayer(0);
         m_layerTreeHost.clear();
-        WebKit::WebCompositor::shutdown();
     }
 
     OwnPtr<MockCCLayerTreeHost> m_layerTreeHost;
+private:
+    WebKitTests::WebCompositorInitializer m_compositorInitializer;
 };
 
 TEST_F(TextureLayerChromiumTest, syncImplWhenChangingTextureId)
index d9b9ea9..85821a8 100644 (file)
@@ -37,8 +37,8 @@
 #include "FakeCCGraphicsContext.h"
 #include "FakeCCLayerTreeHostClient.h"
 #include "LayerPainterChromium.h"
+#include "WebCompositorInitializer.h"
 #include <gtest/gtest.h>
-#include <public/WebCompositor.h>
 #include <public/WebTransformationMatrix.h>
 
 using namespace WebCore;
@@ -70,11 +70,11 @@ private:
 class TiledLayerChromiumTest : public testing::Test {
 public:
     TiledLayerChromiumTest()
-        : m_context(WebKit::createFakeCCGraphicsContext())
+        : m_compositorInitializer(0)
+        , m_context(WebKit::createFakeCCGraphicsContext())
         , m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool))
         , m_occlusion(0)
     {
-        WebKit::WebCompositor::initialize(0);
         DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
         m_resourceProvider = CCResourceProvider::create(m_context.get());
     }
@@ -82,11 +82,8 @@ public:
     virtual ~TiledLayerChromiumTest()
     {
         textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.get());
-        {
-            DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
-            m_resourceProvider.clear();
-        }
-        WebKit::WebCompositor::shutdown();
+        DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
+        m_resourceProvider.clear();
     }
 
     // Helper classes and functions that set the current thread to be the impl thread
@@ -171,6 +168,7 @@ public:
     }
 
 public:
+    WebKitTests::WebCompositorInitializer m_compositorInitializer;
     OwnPtr<CCGraphicsContext> m_context;
     OwnPtr<CCResourceProvider> m_resourceProvider;
     CCTextureUpdateQueue m_queue;
diff --git a/Source/WebKit/chromium/tests/WebCompositorInitializer.h b/Source/WebKit/chromium/tests/WebCompositorInitializer.h
new file mode 100644 (file)
index 0000000..d0893ae
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebCompositorInitializer_h
+#define WebCompositorInitializer_h
+
+#include <public/Platform.h>
+#include <public/WebCompositorSupport.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebKit {
+class WebThread;
+}
+
+namespace WebKitTests {
+
+class WebCompositorInitializer {
+    WTF_MAKE_NONCOPYABLE(WebCompositorInitializer);
+public:
+    explicit WebCompositorInitializer(WebKit::WebThread* thread)
+    {
+        WebKit::Platform::current()->compositorSupport()->initialize(thread);
+    }
+
+    ~WebCompositorInitializer()
+    {
+        WebKit::Platform::current()->compositorSupport()->shutdown();
+    }
+};
+
+}
+
+#endif // WebCompositorInitializer_h
index 82e3b54..1b077ec 100644 (file)
 #include "CCActiveGestureAnimation.h"
 #include "CCInputHandler.h"
 #include "CCSingleThreadProxy.h"
+#include "WebCompositorInitializer.h"
 #include "WebCompositorInputHandlerClient.h"
 #include "WebInputEvent.h"
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
 #include <public/WebCompositor.h>
 #include <public/WebFloatPoint.h>
 #include <public/WebPoint.h>
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 #include <wtf/OwnPtr.h>
 
 using namespace WebKit;
@@ -93,7 +93,7 @@ public:
 
 TEST(WebCompositorInputHandlerImpl, fromIdentifier)
 {
-    WebCompositor::initialize(0);
+    WebKitTests::WebCompositorInitializer initializer(0);
     WebCore::DebugScopedSetImplThread alwaysImplThread;
 
     // Before creating any WebCompositorInputHandlers, lookups for any value should fail and not crash.
@@ -114,26 +114,13 @@ TEST(WebCompositorInputHandlerImpl, fromIdentifier)
 
     // After the compositor is destroyed, its entry should be removed from the map.
     EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(compositorIdentifier));
-    WebCompositor::shutdown();
 }
 
-class WebCompositorInitializer {
-public:
-    WebCompositorInitializer()
-    {
-        WebCompositor::initialize(0);
-    }
-
-    ~WebCompositorInitializer()
-    {
-        WebCompositor::shutdown();
-    }
-};
-
 class WebCompositorInputHandlerImplTest : public testing::Test {
 public:
     WebCompositorInputHandlerImplTest()
-        : m_expectedDisposition(DidHandle)
+        : m_initializer(0)
+        , m_expectedDisposition(DidHandle)
     {
         m_inputHandler = WebCompositorInputHandlerImpl::create(&m_mockCCInputHandlerClient);
         m_inputHandler->setClient(&m_mockClient);
@@ -178,7 +165,7 @@ protected:
     MockWebCompositorInputHandlerClient m_mockClient;
     WebGestureEvent gesture;
     WebCore::DebugScopedSetImplThread alwaysImplThread;
-    WebCompositorInitializer initializer;
+    WebKitTests::WebCompositorInitializer m_initializer;
 
     enum ExpectedDisposition { DidHandle, DidNotHandle, DropEvent };
     ExpectedDisposition m_expectedDisposition;
index 5873bad..eb544b2 100644 (file)
@@ -26,9 +26,9 @@
 #include <public/WebLayer.h>
 
 #include "CompositorFakeWebGraphicsContext3D.h"
+#include "WebCompositorInitializer.h"
 #include "WebLayerImpl.h"
 #include "WebLayerTreeViewTestCommon.h"
-#include <public/WebCompositor.h>
 #include <public/WebContentLayer.h>
 #include <public/WebContentLayerClient.h>
 #include <public/WebExternalTextureLayer.h>
@@ -59,10 +59,13 @@ public:
 
 class WebLayerTest : public Test {
 public:
+    WebLayerTest()
+        : m_compositorInitializer(0)
+    {
+    }
+
     virtual void SetUp()
     {
-        // Initialize without threading support.
-        WebKit::WebCompositor::initialize(0);
         m_rootLayer = adoptPtr(WebLayer::create());
         EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
         EXPECT_TRUE(m_view = adoptPtr(WebLayerTreeView::create(&m_client, *m_rootLayer, WebLayerTreeView::Settings())));
@@ -75,10 +78,10 @@ public:
         EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
         m_rootLayer.clear();
         m_view.clear();
-        WebKit::WebCompositor::shutdown();
     }
 
 protected:
+    WebKitTests::WebCompositorInitializer m_compositorInitializer;
     MockWebLayerTreeViewClient m_client;
     OwnPtr<WebLayer> m_rootLayer;
     OwnPtr<WebLayerTreeView> m_view;
index 6ad17f5..c136e01 100644 (file)
@@ -31,7 +31,7 @@
 #include "WebLayerTreeViewTestCommon.h"
 #include <gmock/gmock.h>
 #include <public/Platform.h>
-#include <public/WebCompositor.h>
+#include <public/WebCompositorSupport.h>
 #include <public/WebLayer.h>
 #include <public/WebLayerTreeViewClient.h>
 #include <public/WebThread.h>
@@ -73,7 +73,7 @@ public:
 
         m_rootLayer.clear();
         m_view.clear();
-        WebKit::WebCompositor::shutdown();
+        WebKit::Platform::current()->compositorSupport()->shutdown();
     }
 
 protected:
@@ -90,7 +90,7 @@ protected:
 
     virtual void initializeCompositor() OVERRIDE
     {
-        WebKit::WebCompositor::initialize(0);
+        WebKit::Platform::current()->compositorSupport()->initialize(0);
     }
 
     virtual WebLayerTreeViewClient* client() OVERRIDE
@@ -169,7 +169,7 @@ protected:
     virtual void initializeCompositor() OVERRIDE
     {
         m_webThread = adoptPtr(WebKit::Platform::current()->createThread("WebLayerTreeViewTest"));
-        WebCompositor::initialize(m_webThread.get());
+        WebKit::Platform::current()->compositorSupport()->initialize(m_webThread.get());
     }
 
     virtual WebLayerTreeViewClient* client() OVERRIDE
index 7cb893e..5178bc6 100644 (file)
@@ -1,3 +1,18 @@
+2012-09-06  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Use WebCompositorSupport functions instead of WebCompositor statics
+        https://bugs.webkit.org/show_bug.cgi?id=96007
+
+        Reviewed by Adrienne Walker.
+
+        Fixes initialization / settings code to use WebCompositorSupport.
+
+        * DumpRenderTree/chromium/DumpRenderTree.cpp:
+        (main):
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::initialize):
+        (TestShell::setPerTilePaintingEnabled):
+
 2012-09-06  Christophe Dumez  <christophe.dumez@intel.com>
 
         [EFL][WK2] Provide implementation for PlatformWebView::windowFrame()
index 9a8bd7f..bee1777 100644 (file)
@@ -34,7 +34,7 @@
 #include "MockWebKitPlatformSupport.h"
 #include "TestShell.h"
 #include "webkit/support/webkit_support.h"
-#include <public/WebCompositor.h>
+#include <public/WebCompositorSupport.h>
 #include <v8/include/v8-testing.h>
 #include <v8/include/v8.h>
 #include <wtf/OwnPtr.h>
@@ -259,7 +259,7 @@ int main(int argc, char* argv[])
     }
 
     // Shutdown WebCompositor after TestShell is destructed properly.
-    WebKit::WebCompositor::shutdown();
+    WebKit::Platform::current()->compositorSupport()->shutdown();
 
     return EXIT_SUCCESS;
 }
index 9abb13f..e5e9ded 100644 (file)
@@ -53,7 +53,7 @@
 #include "webkit/support/webkit_support.h"
 #include "webkit/support/webkit_support_gfx.h"
 #include <public/Platform.h>
-#include <public/WebCompositor.h>
+#include <public/WebCompositorSupport.h>
 #include <public/WebPoint.h>
 #include <public/WebSize.h>
 #include <public/WebString.h>
@@ -162,11 +162,9 @@ void TestShell::initialize()
 
     WTF::initializeThreading();
 
-    if (m_threadedCompositingEnabled) {
+    if (m_threadedCompositingEnabled)
         m_webCompositorThread = adoptPtr(WebKit::Platform::current()->createThread("Compositor"));
-        WebCompositor::initialize(m_webCompositorThread.get());
-    } else
-        WebCompositor::initialize(0);
+    WebKit::Platform::current()->compositorSupport()->initialize(m_webCompositorThread.get());
 
     createMainWindow();
 }
@@ -381,7 +379,7 @@ void TestShell::testTimedOut()
 
 void TestShell::setPerTilePaintingEnabled(bool enabled)
 {
-    WebCompositor::setPerTilePaintingEnabled(enabled);
+    Platform::current()->compositorSupport()->setPerTilePaintingEnabled(enabled);
 }
 
 static string dumpDocumentText(WebFrame* frame)