[chromium] Enable threaded compositing via CCThreadProxy::hasThread only
authornduca@chromium.org <nduca@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2011 01:24:01 +0000 (01:24 +0000)
committernduca@chromium.org <nduca@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2011 01:24:01 +0000 (01:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70838

Source/WebCore:

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::setNeedsCommit):
(WebCore::CCLayerTreeHost::setNeedsRedraw):
(WebCore::CCLayerTreeHost::composite):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(WebCore::CCSettings::CCSettings):
* platform/graphics/chromium/cc/CCProxy.cpp:
(WebCore::CCProxy::isMainThread):
(WebCore::CCProxy::isImplThread):
(WebCore::CCProxy::setMainThreadIsImplThread):
* platform/graphics/chromium/cc/CCProxy.h:
* platform/graphics/chromium/cc/CCSingleThreadProxy.h:
(WebCore::DebugScopedSetImplThread::DebugScopedSetImplThread):
(WebCore::DebugScopedSetImplThread::~DebugScopedSetImplThread):

Source/WebKit/chromium:

Reviewed by James Robinson.

* public/WebCompositor.h:
* public/WebLayerTreeView.h:
(WebKit::WebLayerTreeView::Settings::Settings):
* public/WebSettings.h:
* src/WebCompositorImpl.cpp:
(WebKit::WebCompositor::initialize):
(WebKit::WebCompositor::shutdown):
(WebKit::WebCompositor::fromIdentifier):
* src/WebKit.cpp:
(WebKit::initializeWithoutV8):
* src/WebLayerTreeView.cpp:
(WebKit::WebLayerTreeView::Settings::operator CCSettings):
(WebKit::WebLayerTreeView::composite):
* src/WebLayerTreeViewImpl.cpp:
(WebKit::WebLayerTreeViewImpl::createLayerTreeHostContext3D):
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::WebSettingsImpl):
* src/WebSettingsImpl.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::animate):
(WebKit::WebViewImpl::composite):
(WebKit::WebViewImpl::scheduleAnimation):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
(WebKit::WebViewImpl::createLayerTreeHostContext3D):
(WebKit::WebViewImpl::scheduleComposite):
(WebKit::WebViewImpl::graphicsContext3D):
* tests/CCLayerTreeHostTest.cpp:
(WTF::CCLayerTreeHostTest::CCLayerTreeHostTest):
(WTF::CCLayerTreeHostTest::runTest):

Tools:

Patch by nduca@chromium.org <nduca@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc> on 2011-11-30
Reviewed by James Robinson.

* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::resetWebSettings):
* DumpRenderTree/chromium/TestShell.h:
(TestShell::threadedCompositingEnabled):
* DumpRenderTree/chromium/WebPreferences.cpp:
(WebPreferences::reset):
(WebPreferences::applyTo):
* DumpRenderTree/chromium/WebPreferences.h:
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::WebViewHost):
(WebViewHost::~WebViewHost):

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

37 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
Source/WebCore/platform/graphics/chromium/cc/CCProxy.cpp
Source/WebCore/platform/graphics/chromium/cc/CCProxy.h
Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gyp
Source/WebKit/chromium/WebKit.gypi
Source/WebKit/chromium/public/WebCompositor.h
Source/WebKit/chromium/public/WebCompositorClient.h
Source/WebKit/chromium/public/WebCompositorInputHandler.h [new file with mode: 0644]
Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h [new file with mode: 0644]
Source/WebKit/chromium/public/WebLayerTreeView.h
Source/WebKit/chromium/public/WebSettings.h
Source/WebKit/chromium/src/WebCompositorImpl.cpp
Source/WebKit/chromium/src/WebCompositorImpl.h
Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp [new file with mode: 0644]
Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h [new file with mode: 0644]
Source/WebKit/chromium/src/WebKit.cpp
Source/WebKit/chromium/src/WebLayerTreeView.cpp
Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
Source/WebKit/chromium/src/WebSettingsImpl.cpp
Source/WebKit/chromium/src/WebSettingsImpl.h
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp [moved from Source/WebKit/chromium/tests/WebCompositorImplTest.cpp with 63% similarity]
Tools/ChangeLog
Tools/DumpRenderTree/chromium/TestShell.cpp
Tools/DumpRenderTree/chromium/TestShell.h
Tools/DumpRenderTree/chromium/WebPreferences.cpp
Tools/DumpRenderTree/chromium/WebPreferences.h
Tools/DumpRenderTree/chromium/WebViewHost.cpp
Tools/DumpRenderTree/chromium/WebViewHost.h

index c47c5a5..b04bab0 100644 (file)
@@ -1,3 +1,34 @@
+2011-11-18  Nat Duca  <nduca@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::setNeedsCommit):
+        (WebCore::CCLayerTreeHost::setNeedsRedraw):
+        (WebCore::CCLayerTreeHost::composite):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (WebCore::CCSettings::CCSettings):
+        * platform/graphics/chromium/cc/CCProxy.cpp:
+        (WebCore::CCProxy::isMainThread):
+        (WebCore::CCProxy::isImplThread):
+        (WebCore::CCProxy::setMainThreadIsImplThread):
+        * platform/graphics/chromium/cc/CCProxy.h:
+        * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
+        (WebCore::DebugScopedSetImplThread::DebugScopedSetImplThread):
+        (WebCore::DebugScopedSetImplThread::~DebugScopedSetImplThread):
+
 2011-11-30  Enrica Casucci  <enrica@apple.com>
 
         Copy/paste of the same content produces increasingly nested markup
index 0778e5d..d472c7a 100644 (file)
@@ -200,7 +200,7 @@ bool LayerRendererChromium::initialize()
         extensions->ensureEnabled("GL_CHROMIUM_map_sub");
 
     // Use the swapBuffers callback only with the threaded proxy.
-    if (settings().enableCompositorThread)
+    if (CCProxy::hasImplThread())
         m_capabilities.usingSwapCompleteCallback = extensions->supports("GL_CHROMIUM_swapbuffers_complete_callback");
     if (m_capabilities.usingSwapCompleteCallback) {
         extensions->ensureEnabled("GL_CHROMIUM_swapbuffers_complete_callback");
index 276f3c9..2b0d16e 100644 (file)
@@ -162,7 +162,7 @@ GraphicsContext3D* WebGLLayerChromium::layerRendererContext()
 {
     // FIXME: In the threaded case, paintRenderedResultsToCanvas must be
     // refactored to be asynchronous. Currently this is unimplemented.
-    if (!layerTreeHost() || layerTreeHost()->settings().enableCompositorThread)
+    if (!layerTreeHost() || CCProxy::hasImplThread())
         return 0;
     return layerTreeHost()->context();
 }
index b68f46c..708bcff 100644 (file)
@@ -90,7 +90,7 @@ void CCHeadsUpDisplay::onSwapBuffers()
 bool CCHeadsUpDisplay::enabled() const
 {
     // FIXME: HUD does not work in compositor thread mode.
-    if (settings().enableCompositorThread)
+    if (CCProxy::hasImplThread())
         return false;
     return settings().showPlatformLayerTree || settings().showFPSCounter;
 }
index abdf162..145a799 100644 (file)
 #include "cc/CCThread.h"
 #include "cc/CCThreadProxy.h"
 
+namespace {
+static int numLayerTreeInstances;
+}
+
 namespace WebCore {
 
+bool CCLayerTreeHost::anyLayerTreeHostInstanceExists()
+{
+    return numLayerTreeInstances > 0;
+}
+
 PassRefPtr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, const CCSettings& settings)
 {
     RefPtr<CCLayerTreeHost> layerTreeHost = adoptRef(new CCLayerTreeHost(client, settings));
@@ -60,12 +69,13 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCSettings
     , m_maxPageScale(1)
 {
     ASSERT(CCProxy::isMainThread());
+    numLayerTreeInstances++;
 }
 
 bool CCLayerTreeHost::initialize()
 {
     TRACE_EVENT("CCLayerTreeHost::initialize", this, 0);
-    if (m_settings.enableCompositorThread) {
+    if (CCProxy::hasImplThread()) {
         // The HUD does not work in threaded mode. Turn it off.
         m_settings.showFPSCounter = false;
         m_settings.showPlatformLayerTree = false;
@@ -95,6 +105,7 @@ CCLayerTreeHost::~CCLayerTreeHost()
     m_proxy->stop();
     m_proxy.clear();
     clearPendingUpdate();
+    numLayerTreeInstances--;
 }
 
 void CCLayerTreeHost::deleteContentsTexturesOnImplThread(TextureAllocator* allocator)
@@ -169,7 +180,7 @@ void CCLayerTreeHost::didRecreateGraphicsContext(bool success)
 // Temporary hack until WebViewImpl context creation gets simplified
 GraphicsContext3D* CCLayerTreeHost::context()
 {
-    ASSERT(!m_settings.enableCompositorThread);
+    ASSERT(!CCProxy::hasImplThread());
     return m_proxy->context();
 }
 
@@ -200,13 +211,13 @@ void CCLayerTreeHost::setZoomAnimatorTransform(const TransformationMatrix& zoom)
 
 void CCLayerTreeHost::setNeedsAnimate()
 {
-    ASSERT(m_settings.enableCompositorThread);
+    ASSERT(CCProxy::hasImplThread());
     m_proxy->setNeedsAnimate();
 }
 
 void CCLayerTreeHost::setNeedsCommit()
 {
-    if (m_settings.enableCompositorThread) {
+    if (CCThreadProxy::implThread()) {
         TRACE_EVENT("CCLayerTreeHost::setNeedsCommit", this, 0);
         m_proxy->setNeedsCommit();
     } else
@@ -215,7 +226,7 @@ void CCLayerTreeHost::setNeedsCommit()
 
 void CCLayerTreeHost::setNeedsRedraw()
 {
-    if (m_settings.enableCompositorThread)
+    if (CCThreadProxy::implThread())
         m_proxy->setNeedsRedraw();
     else
         m_client->scheduleComposite();
@@ -295,7 +306,7 @@ TextureManager* CCLayerTreeHost::contentsTextureManager() const
 
 void CCLayerTreeHost::composite()
 {
-    ASSERT(!m_settings.enableCompositorThread);
+    ASSERT(!CCThreadProxy::implThread());
     static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately();
 }
 
index 56d2b6c..5093013 100644 (file)
@@ -72,7 +72,6 @@ struct CCSettings {
             : acceleratePainting(false)
             , compositeOffscreen(false)
             , discardAllTextures(false)
-            , enableCompositorThread(false)
             , showFPSCounter(false)
             , showPlatformLayerTree(false)
             , useDamageTracker(false)
@@ -81,7 +80,6 @@ struct CCSettings {
     bool acceleratePainting;
     bool compositeOffscreen;
     bool discardAllTextures;
-    bool enableCompositorThread;
     bool showFPSCounter;
     bool showPlatformLayerTree;
     bool useDamageTracker;
@@ -115,6 +113,9 @@ public:
     static PassRefPtr<CCLayerTreeHost> create(CCLayerTreeHostClient*, const CCSettings&);
     virtual ~CCLayerTreeHost();
 
+    // Returns true if any CCLayerTreeHost is alive.
+    static bool anyLayerTreeHostInstanceExists();
+
     // CCLayerTreeHost interface to CCProxy.
     void animateAndLayout(double frameBeginTime);
     void beginCommitOnImplThread(CCLayerTreeHostImpl*);
index 6062ec0..e4d6014 100644 (file)
@@ -37,7 +37,8 @@ namespace WebCore {
 
 namespace {
 #ifndef NDEBUG
-bool fakeImplThread = false;
+bool implThreadIsOverridden = false;
+ThreadIdentifier threadIDOverridenToBeImplThread;
 #endif
 CCThread* s_mainThread = 0;
 CCThread* s_implThread = 0;
@@ -53,6 +54,11 @@ CCThread* CCProxy::mainThread()
     return s_mainThread;
 }
 
+bool CCProxy::hasImplThread()
+{
+    return s_implThread;
+}
+
 void CCProxy::setImplThread(CCThread* thread)
 {
     s_implThread = thread;
@@ -67,18 +73,24 @@ CCThread* CCProxy::implThread()
 bool CCProxy::isMainThread()
 {
     ASSERT(s_mainThread);
-    return !fakeImplThread && currentThread() == s_mainThread->threadID();
+    if (implThreadIsOverridden && currentThread() == threadIDOverridenToBeImplThread)
+        return false;
+    return currentThread() == s_mainThread->threadID();
 }
 
 bool CCProxy::isImplThread()
 {
     WTF::ThreadIdentifier implThreadID = s_implThread ? s_implThread->threadID() : 0;
-    return fakeImplThread || currentThread() == implThreadID;
+    if (implThreadIsOverridden && currentThread() == threadIDOverridenToBeImplThread)
+        return true;
+    return currentThread() == implThreadID;
 }
 
-void CCProxy::setImplThread(bool isImplThread)
+void CCProxy::setCurrentThreadIsImplThread(bool isImplThread)
 {
-    fakeImplThread = isImplThread;
+    implThreadIsOverridden = isImplThread;
+    if (isImplThread)
+        threadIDOverridenToBeImplThread = currentThread();
 }
 #endif
 
index a6230ea..bb37801 100644 (file)
@@ -53,6 +53,7 @@ public:
     static void setMainThread(CCThread*);
     static CCThread* mainThread();
 
+    static bool hasImplThread();
     static void setImplThread(CCThread*);
     static CCThread* implThread();
 
@@ -91,7 +92,7 @@ public:
     virtual void loseCompositorContext(int numTimes) = 0;
 
 #ifndef NDEBUG
-    static void setImplThread(bool);
+    static void setCurrentThreadIsImplThread(bool);
 #endif
 
 protected:
index edab61f..0d5a4a2 100644 (file)
@@ -91,13 +91,13 @@ public:
     DebugScopedSetImplThread()
     {
 #if !ASSERT_DISABLED
-        CCProxy::setImplThread(true);
+        CCProxy::setCurrentThreadIsImplThread(true);
 #endif
     }
     ~DebugScopedSetImplThread()
     {
 #if !ASSERT_DISABLED
-        CCProxy::setImplThread(false);
+        CCProxy::setCurrentThreadIsImplThread(false);
 #endif
     }
 };
index 7f2d6ea..e5781ec 100644 (file)
@@ -1,3 +1,40 @@
+2011-11-18  Nat Duca  <nduca@chromium.org>
+
+        [chromium] Enable threaded compositing via CCThreadProxy::hasThread only
+        https://bugs.webkit.org/show_bug.cgi?id=70838
+
+        Reviewed by James Robinson.
+
+        * public/WebCompositor.h:
+        * public/WebLayerTreeView.h:
+        (WebKit::WebLayerTreeView::Settings::Settings):
+        * public/WebSettings.h:
+        * src/WebCompositorImpl.cpp:
+        (WebKit::WebCompositor::initialize):
+        (WebKit::WebCompositor::shutdown):
+        (WebKit::WebCompositor::fromIdentifier):
+        * src/WebKit.cpp:
+        (WebKit::initializeWithoutV8):
+        * src/WebLayerTreeView.cpp:
+        (WebKit::WebLayerTreeView::Settings::operator CCSettings):
+        (WebKit::WebLayerTreeView::composite):
+        * src/WebLayerTreeViewImpl.cpp:
+        (WebKit::WebLayerTreeViewImpl::createLayerTreeHostContext3D):
+        * src/WebSettingsImpl.cpp:
+        (WebKit::WebSettingsImpl::WebSettingsImpl):
+        * src/WebSettingsImpl.h:
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::animate):
+        (WebKit::WebViewImpl::composite):
+        (WebKit::WebViewImpl::scheduleAnimation):
+        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+        (WebKit::WebViewImpl::createLayerTreeHostContext3D):
+        (WebKit::WebViewImpl::scheduleComposite):
+        (WebKit::WebViewImpl::graphicsContext3D):
+        * tests/CCLayerTreeHostTest.cpp:
+        (WTF::CCLayerTreeHostTest::CCLayerTreeHostTest):
+        (WTF::CCLayerTreeHostTest::runTest):
+
 2011-11-30  David Levin  <levin@chromium.org>
 
         [chromium] Move didUpdateLayout from WebFrameClient to WebViewClient.
index 4e2a760..78a7e0d 100644 (file)
                 'public/WebCompositionUnderline.h',
                 'public/WebCompositorClient.h',
                 'public/WebCompositor.h',
+                'public/WebCompositorInputHandlerClient.h',
+                'public/WebCompositorInputHandler.h',
                 'public/WebConsoleMessage.h',
                 'public/WebContentLayer.h',
                 'public/WebContentLayerClient.h',
                 'src/WebCommon.cpp',
                 'src/WebCompositorImpl.cpp',
                 'src/WebCompositorImpl.h',
+                'src/WebCompositorInputHandlerImpl.cpp',
+                'src/WebCompositorInputHandlerImpl.h',
                 'src/WebContentLayer.cpp',
                 'src/WebContentLayerImpl.cpp',
                 'src/WebContentLayerImpl.h',
index c906689..d7433ab 100644 (file)
@@ -89,7 +89,7 @@
             'tests/TreeSynchronizerTest.cpp',
             'tests/TreeTestHelpers.cpp',
             'tests/TreeTestHelpers.h',
-            'tests/WebCompositorImplTest.cpp',
+            'tests/WebCompositorInputHandlerImplTest.cpp',
             'tests/WebFrameTest.cpp',
             'tests/WebLayerTest.cpp',
             'tests/WebPageNewSerializerTest.cpp',
index 326b2ac..32b60e2 100644 (file)
 #ifndef WebCompositor_h
 #define WebCompositor_h
 
+#include "WebCompositorInputHandler.h"
 #include "platform/WebCommon.h"
 
 namespace WebKit {
 
-class WebCompositorClient;
 class WebInputEvent;
 class WebThread;
 
-// This represents the compositor associated with a WebWidget. All calls to the WebCompositor must
-// be made from the compositor thread.
-class WebCompositor {
+#define WEBCOMPOSITOR_HAS_INITIALIZE
+
+// This class contains global routines for interacting with the
+// compositor.
+//
+// All calls to the WebCompositor must be made from the main thread.
+//
+// This class currently temporarily inherits from WebCompositorInputHandler
+// while we migrate downstream code to use WebCompositorInputHandler directly.
+class WebCompositor : public WebCompositorInputHandler {
 public:
-    // This must be called once with a non-null WebThread before any compositors attempt to initialize.
-    WEBKIT_EXPORT static void setThread(WebThread*);
-    WEBKIT_EXPORT static WebCompositor* fromIdentifier(int);
+    // Initializes the compositor. Threaded compositing is enabled by passing in
+    // a non-null WebThread. No compositor classes or methods should be used
+    // prior to calling initialize.
+    WEBKIT_EXPORT static void initialize(WebThread*);
 
-    virtual void setClient(WebCompositorClient*) = 0;
-    virtual void handleInputEvent(const WebInputEvent&) = 0;
+    // Shuts down the compositor. This must be called when all compositor data
+    // types have been deleted. No compositor classes or methods should be used
+    // after shutdown.
+    WEBKIT_EXPORT static void shutdown();
 
 protected:
     virtual ~WebCompositor() { }
index 2d0b428..c275f70 100644 (file)
 #ifndef WebCompositorClient_h
 #define WebCompositorClient_h
 
+#include "WebCompositorInputHandlerClient.h"
+
 namespace WebKit {
 
-class WebCompositorClient {
+// This class will go away once downstream code has transitioned
+// to WebCompositorInputHandlerClient.
+class WebCompositorClient : public WebCompositorInputHandlerClient {
 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():
-
-    // Called when the WebCompositor 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
-    // should be forwarded to the WebWidget associated with this compositor for further processing.
-    virtual void didNotHandleInputEvent(bool sendToWidget) = 0;
-
 protected:
     virtual ~WebCompositorClient() { }
 };
diff --git a/Source/WebKit/chromium/public/WebCompositorInputHandler.h b/Source/WebKit/chromium/public/WebCompositorInputHandler.h
new file mode 100644 (file)
index 0000000..d8ee686
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 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 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 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 WebCompositorInputHandler_h
+#define WebCompositorInputHandler_h
+
+#include "WebCommon.h"
+
+namespace WebKit {
+
+class WebCompositor;
+class WebCompositorInputHandlerClient;
+class WebInputEvent;
+class WebThread;
+
+// This represents the compositor associated with a WebWidget. All calls to the WebCompositor must
+// be made from the compositor thread.
+class WebCompositorInputHandler {
+public:
+    // The return value is temporarily WebCompositor until all downstream code
+    // is switched to use WebCompositorInputHandler.
+    WEBKIT_EXPORT static WebCompositor* fromIdentifier(int);
+
+    virtual void setClient(WebCompositorInputHandlerClient*) = 0;
+    virtual void handleInputEvent(const WebInputEvent&) = 0;
+
+protected:
+    virtual ~WebCompositorInputHandler() { }
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h b/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h
new file mode 100644 (file)
index 0000000..e8bb555
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2011 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 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 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 WebCompositorInputHandlerClient_h
+#define WebCompositorInputHandlerClient_h
+
+namespace WebKit {
+
+class WebCompositorInputHandlerClient {
+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():
+
+    // Called when the WebCompositor 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
+    // should be forwarded to the WebWidget associated with this compositor for further processing.
+    virtual void didNotHandleInputEvent(bool sendToWidget) = 0;
+
+protected:
+    virtual ~WebCompositorInputHandlerClient() { }
+};
+
+} // namespace WebKit
+
+#endif
index e6d0022..8028ad5 100644 (file)
@@ -46,13 +46,11 @@ public:
         Settings()
             : acceleratePainting(false)
             , compositeOffscreen(false)
-            , enableCompositorThread(false)
             , showFPSCounter(false)
             , showPlatformLayerTree(false) { }
 
         bool acceleratePainting;
         bool compositeOffscreen;
-        bool enableCompositorThread;
         bool showFPSCounter;
         bool showPlatformLayerTree;
 #if WEBKIT_IMPLEMENTATION
@@ -74,8 +72,8 @@ public:
     WEBKIT_EXPORT void assign(const WebLayerTreeView&);
     WEBKIT_EXPORT bool equals(const WebLayerTreeView&) const;
 
-    // Triggers a compositing pass. If the compositor thread is disabled
-    // (enableCompositorThread == false), the compositing pass happens
+    // Triggers a compositing pass. If the compositor thread was not
+    // enabled via WebCompositor::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 464363b..dd77499 100644 (file)
@@ -117,8 +117,6 @@ public:
     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;
index e031e0e..f2fbcd4 100644 (file)
 #include "WebCompositorImpl.h"
 
 #include "CCThreadImpl.h"
+#include "WebKit.h"
+#include "WebKitPlatformSupport.h"
 #include "WebCompositorClient.h"
 #include "WebInputEvent.h"
-#include "cc/CCInputHandler.h"
-#include "cc/CCThreadProxy.h"
+#include "cc/CCLayerTreeHost.h"
+#include "cc/CCProxy.h"
 #include <wtf/ThreadingPrimitives.h>
 
 using namespace WebCore;
 
-namespace WebCore {
-
-PassOwnPtr<CCInputHandler> CCInputHandler::create(CCInputHandlerClient* inputHandlerClient)
-{
-    return WebKit::WebCompositorImpl::create(inputHandlerClient);
-}
-
-}
-
 namespace WebKit {
 
-void WebCompositor::setThread(WebThread* compositorThread)
-{
-    ASSERT(compositorThread);
-    CCThreadProxy::setImplThread(CCThreadImpl::create(compositorThread).leakPtr());
-}
-
-
-// These statics may only be accessed from the compositor thread.
-int WebCompositorImpl::s_nextAvailableIdentifier = 1;
-HashSet<WebCompositorImpl*>* WebCompositorImpl::s_compositors = 0;
-
-WebCompositor* WebCompositor::fromIdentifier(int identifier)
-{
-    ASSERT(CCProxy::isImplThread());
-    return WebCompositorImpl::fromIdentifier(identifier);
-}
+bool WebCompositorImpl::s_initialized = false;
+CCThread* WebCompositorImpl::s_mainThread = 0;
+CCThread* WebCompositorImpl::s_implThread = 0;
 
-WebCompositor* WebCompositorImpl::fromIdentifier(int identifier)
+void WebCompositor::initialize(WebThread* implThread)
 {
-    ASSERT(CCProxy::isImplThread());
-
-    if (!s_compositors)
-        return 0;
-
-    for (HashSet<WebCompositorImpl*>::iterator it = s_compositors->begin(); it != s_compositors->end(); ++it) {
-        if ((*it)->identifier() == identifier)
-            return *it;
-    }
-    return 0;
+    WebCompositorImpl::initialize(implThread);
 }
-
-WebCompositorImpl::WebCompositorImpl(CCInputHandlerClient* inputHandlerClient)
-    : m_client(0)
-    , m_identifier(s_nextAvailableIdentifier++)
-    , m_inputHandlerClient(inputHandlerClient)
+void WebCompositor::shutdown()
 {
-    ASSERT(CCProxy::isImplThread());
-
-    if (!s_compositors)
-        s_compositors = new HashSet<WebCompositorImpl*>;
-    s_compositors->add(this);
+    WebCompositorImpl::shutdown();
 }
 
-WebCompositorImpl::~WebCompositorImpl()
+void WebCompositorImpl::initialize(WebThread* implThread)
 {
-    ASSERT(CCProxy::isImplThread());
-    if (m_client)
-        m_client->willShutdown();
-
-    ASSERT(s_compositors);
-    s_compositors->remove(this);
-    if (!s_compositors->size()) {
-        delete s_compositors;
-        s_compositors = 0;
-    }
+    ASSERT(!s_initialized);
+    s_initialized = true;
+
+    s_mainThread = CCThreadImpl::create(webKitPlatformSupport()->currentThread()).leakPtr();
+    CCProxy::setMainThread(s_mainThread);
+    if (implThread) {
+        s_implThread = CCThreadImpl::create(implThread).leakPtr();
+        CCProxy::setImplThread(s_implThread);
+    } else
+        CCProxy::setImplThread(0);
 }
 
-void WebCompositorImpl::setClient(WebCompositorClient* client)
+bool WebCompositorImpl::initialized()
 {
-    ASSERT(CCProxy::isImplThread());
-    // It's valid to set a new client if we've never had one or to clear the client, but it's not valid to change from having one client to a different one.
-    ASSERT(!m_client || !client);
-    m_client = client;
+    return s_initialized;
 }
 
-void WebCompositorImpl::handleInputEvent(const WebInputEvent& event)
+void WebCompositorImpl::shutdown()
 {
-    ASSERT(CCProxy::isImplThread());
-    ASSERT(m_client);
+    ASSERT(s_initialized);
+    ASSERT(!CCLayerTreeHost::anyLayerTreeHostInstanceExists());
 
-    if (event.type == WebInputEvent::MouseWheel && !m_inputHandlerClient->haveWheelEventHandlers()) {
-        const WebMouseWheelEvent& wheelEvent = *static_cast<const WebMouseWheelEvent*>(&event);
-        m_inputHandlerClient->scrollRootLayer(IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY));
-        m_client->didHandleInputEvent();
-        return;
+    if (s_implThread) {
+        delete s_implThread;
+        s_implThread = 0;
     }
-    m_client->didNotHandleInputEvent(true /* sendToWidget */);
-}
-
-int WebCompositorImpl::identifier() const
-{
-    ASSERT(CCProxy::isImplThread());
-    return m_identifier;
-}
-
-void WebCompositorImpl::willDraw(double frameBeginTimeMs)
-{
+    delete s_mainThread;
+    s_mainThread = 0;
+    CCProxy::setImplThread(0);
+    CCProxy::setMainThread(0);
+    s_initialized = false;
 }
 
 }
index bde0968..34c6bd0 100644 (file)
 
 #include "WebCompositor.h"
 
-#include "cc/CCInputHandler.h"
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
+#include <wtf/OwnPtr.h>
 
-namespace WTF {
-class Mutex;
+namespace WebCore {
+class CCThread;
 }
 
 namespace WebKit {
 
-class WebCompositorClient;
+class WebThread;
 
-class WebCompositorImpl : public WebCompositor, public WebCore::CCInputHandler {
+class WebCompositorImpl : public WebCompositor {
     WTF_MAKE_NONCOPYABLE(WebCompositorImpl);
 public:
-    static WebCompositor* fromIdentifier(int identifier);
-
-    static PassOwnPtr<WebCompositorImpl> create(WebCore::CCInputHandlerClient* client)
-    {
-        return adoptPtr(new WebCompositorImpl(client));
-    }
-
-    virtual ~WebCompositorImpl();
-
-    // WebCompositor implementation
-    virtual void setClient(WebCompositorClient*);
-    virtual void handleInputEvent(const WebInputEvent&);
-
-    // WebCore::CCInputHandler implementation
-    virtual int identifier() const;
-    virtual void willDraw(double frameBeginTime);
+    static bool initialized();
 
 private:
-    explicit WebCompositorImpl(WebCore::CCInputHandlerClient*);
 
-    WebCompositorClient* m_client;
-    int m_identifier;
-    WebCore::CCInputHandlerClient* m_inputHandlerClient;
+    friend class WebCompositor;
+    static void initialize(WebThread* implThread);
+    static void shutdown();
 
-    static int s_nextAvailableIdentifier;
-    static HashSet<WebCompositorImpl*>* s_compositors;
+    static bool s_initialized;
+    static WebCore::CCThread* s_mainThread;
+    static WebCore::CCThread* s_implThread;
 };
 
 }
diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp
new file mode 100644 (file)
index 0000000..ff83f3b
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2011 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 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 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.
+ */
+
+#include "config.h"
+
+#include "WebCompositorInputHandlerImpl.h"
+
+#include "WebCompositorImpl.h"
+#include "WebCompositorInputHandlerClient.h"
+#include "WebInputEvent.h"
+#include "WebKit.h"
+#include "WebKitPlatformSupport.h"
+#include "cc/CCProxy.h"
+#include <wtf/ThreadingPrimitives.h>
+
+using namespace WebCore;
+
+namespace WebCore {
+
+PassOwnPtr<CCInputHandler> CCInputHandler::create(CCInputHandlerClient* inputHandlerClient)
+{
+    return WebKit::WebCompositorInputHandlerImpl::create(inputHandlerClient);
+}
+
+}
+
+namespace WebKit {
+
+// These statics may only be accessed from the compositor thread.
+int WebCompositorInputHandlerImpl::s_nextAvailableIdentifier = 1;
+HashSet<WebCompositorInputHandlerImpl*>* WebCompositorInputHandlerImpl::s_compositors = 0;
+
+WebCompositor* WebCompositorInputHandler::fromIdentifier(int identifier)
+{
+    return static_cast<WebCompositor*>(WebCompositorInputHandlerImpl::fromIdentifier(identifier));
+}
+
+PassOwnPtr<WebCompositorInputHandlerImpl> WebCompositorInputHandlerImpl::create(WebCore::CCInputHandlerClient* inputHandlerClient)
+{
+    return adoptPtr(new WebCompositorInputHandlerImpl(inputHandlerClient));
+}
+
+WebCompositorInputHandler* WebCompositorInputHandlerImpl::fromIdentifier(int identifier)
+{
+    ASSERT(WebCompositorImpl::initialized());
+    ASSERT(CCProxy::isImplThread());
+
+    if (!s_compositors)
+        return 0;
+
+    for (HashSet<WebCompositorInputHandlerImpl*>::iterator it = s_compositors->begin(); it != s_compositors->end(); ++it) {
+        if ((*it)->identifier() == identifier)
+            return *it;
+    }
+    return 0;
+}
+
+WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl(CCInputHandlerClient* inputHandlerClient)
+    : m_client(0)
+    , m_identifier(s_nextAvailableIdentifier++)
+    , m_inputHandlerClient(inputHandlerClient)
+{
+    ASSERT(CCProxy::isImplThread());
+
+    if (!s_compositors)
+        s_compositors = new HashSet<WebCompositorInputHandlerImpl*>;
+    s_compositors->add(this);
+}
+
+WebCompositorInputHandlerImpl::~WebCompositorInputHandlerImpl()
+{
+    ASSERT(CCProxy::isImplThread());
+    if (m_client)
+        m_client->willShutdown();
+
+    ASSERT(s_compositors);
+    s_compositors->remove(this);
+    if (!s_compositors->size()) {
+        delete s_compositors;
+        s_compositors = 0;
+    }
+}
+
+void WebCompositorInputHandlerImpl::setClient(WebCompositorInputHandlerClient* client)
+{
+    ASSERT(CCProxy::isImplThread());
+    // It's valid to set a new client if we've never had one or to clear the client, but it's not valid to change from having one client to a different one.
+    ASSERT(!m_client || !client);
+    m_client = client;
+}
+
+void WebCompositorInputHandlerImpl::handleInputEvent(const WebInputEvent& event)
+{
+    ASSERT(CCProxy::isImplThread());
+    ASSERT(m_client);
+
+    if (event.type == WebInputEvent::MouseWheel && !m_inputHandlerClient->haveWheelEventHandlers()) {
+        const WebMouseWheelEvent& wheelEvent = *static_cast<const WebMouseWheelEvent*>(&event);
+        m_inputHandlerClient->scrollRootLayer(IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY));
+        m_client->didHandleInputEvent();
+        return;
+    }
+    m_client->didNotHandleInputEvent(true /* sendToWidget */);
+}
+
+int WebCompositorInputHandlerImpl::identifier() const
+{
+    ASSERT(CCProxy::isImplThread());
+    return m_identifier;
+}
+
+void WebCompositorInputHandlerImpl::willDraw(double frameBeginTimeMs)
+{
+}
+
+}
diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h
new file mode 100644 (file)
index 0000000..1ebc1e1
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2011 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 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 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 WebCompositorInputHandlerImpl_h
+#define WebCompositorInputHandlerImpl_h
+
+#include "WebCompositor.h"
+#include "WebCompositorInputHandler.h"
+#include "cc/CCInputHandler.h"
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
+
+namespace WTF {
+class Mutex;
+}
+
+namespace WebCore {
+class CCInputHandlerClient;
+class CCThread;
+}
+
+namespace WebKit {
+
+class WebCompositorInputHandlerClient;
+
+// Temporarily subclassing from WebCompositor while downstream changes land.
+class WebCompositorInputHandlerImpl : public WebCompositor, public WebCore::CCInputHandler {
+    WTF_MAKE_NONCOPYABLE(WebCompositorInputHandlerImpl);
+public:
+    static PassOwnPtr<WebCompositorInputHandlerImpl> create(WebCore::CCInputHandlerClient*);
+    static WebCompositorInputHandler* fromIdentifier(int identifier);
+
+    virtual ~WebCompositorInputHandlerImpl();
+
+    // WebCompositor implementation
+    virtual void setClient(WebCompositorInputHandlerClient*);
+    virtual void handleInputEvent(const WebInputEvent&);
+
+    // WebCore::CCInputHandler implementation
+    virtual int identifier() const;
+    virtual void willDraw(double frameBeginTimeMs);
+
+private:
+    explicit WebCompositorInputHandlerImpl(WebCore::CCInputHandlerClient*);
+
+    WebCompositorInputHandlerClient* m_client;
+    int m_identifier;
+    WebCore::CCInputHandlerClient* m_inputHandlerClient;
+
+    static int s_nextAvailableIdentifier;
+    static HashSet<WebCompositorInputHandlerImpl*>* s_compositors;
+};
+
+}
+
+#endif // WebCompositorImpl_h
index 7bcd9cf..62b4180 100644 (file)
@@ -31,8 +31,6 @@
 #include "config.h"
 #include "WebKit.h"
 
-#include "CCThreadImpl.h"
-#include "cc/CCProxy.h"
 #include "Logging.h"
 #include "Page.h"
 #include "RuntimeEnabledFeatures.h"
@@ -98,15 +96,11 @@ void initializeWithoutV8(WebKitPlatformSupport* webKitPlatformSupport)
     // the initialization thread-safe, but given that so many code paths use
     // this, initializing this lazily probably doesn't buy us much.
     WebCore::UTF8Encoding();
-
-    WebCore::CCProxy::setMainThread(CCThreadImpl::create(webKitPlatformSupport->currentThread()).leakPtr());
 }
 
 
 void shutdown()
 {
-    delete WebCore::CCProxy::mainThread();
-    WebCore::CCProxy::setMainThread(0);
     s_webKitPlatformSupport = 0;
 }
 
index e779afa..30bdcbe 100644 (file)
@@ -39,9 +39,12 @@ WebLayerTreeView::Settings::operator CCSettings() const
     CCSettings settings;
     settings.acceleratePainting = acceleratePainting;
     settings.compositeOffscreen = compositeOffscreen;
-    settings.enableCompositorThread = enableCompositorThread;
     settings.showFPSCounter = showFPSCounter;
     settings.showPlatformLayerTree = showPlatformLayerTree;
+
+    // FIXME: showFPSCounter / showPlatformLayerTree aren't supported currently.
+    settings.showFPSCounter = false;
+    settings.showPlatformLayerTree = false;
     return settings;
 }
 
@@ -67,7 +70,7 @@ bool WebLayerTreeView::equals(const WebLayerTreeView& n) const
 
 void WebLayerTreeView::composite()
 {
-    if (m_private->settings().enableCompositorThread)
+    if (CCProxy::hasImplThread())
         m_private->setNeedsCommit();
     else
         m_private->composite();
index 8c8684b..a6f1d0f 100644 (file)
@@ -35,6 +35,7 @@
 #include "WebLayerTreeViewClient.h"
 #include "WebSize.h"
 #include "WebThread.h"
+#include "cc/CCThreadProxy.h"
 
 using namespace WebCore;
 
@@ -92,7 +93,7 @@ PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createLayerTreeHostContext3D
     attributes.preserveDrawingBuffer = false;
 
     GraphicsContext3D::RenderStyle style = GraphicsContext3D::RenderDirectlyToHostWindow;
-    GraphicsContext3DPrivate::ThreadUsage usage = settings().enableCompositorThread ? GraphicsContext3DPrivate::ForUseOnAnotherThread : GraphicsContext3DPrivate::ForUseOnThisThread;
+    GraphicsContext3DPrivate::ThreadUsage usage = CCProxy::hasImplThread() ? GraphicsContext3DPrivate::ForUseOnAnotherThread : GraphicsContext3DPrivate::ForUseOnThisThread;
     return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), attributes, 0, style, usage);
 }
 
index 6fc4628..a1bcebf 100644 (file)
@@ -50,7 +50,6 @@ WebSettingsImpl::WebSettingsImpl(Settings* settings)
     , m_compositeToTextureEnabled(false)
     , m_showFPSCounter(false)
     , m_showPlatformLayerTree(false)
-    , m_useThreadedCompositor(false)
 {
     ASSERT(settings);
 }
@@ -379,11 +378,6 @@ void WebSettingsImpl::setMinimumAccelerated2dCanvasSize(int numPixels)
     m_settings->setMinimumAccelerated2dCanvasSize(numPixels);
 }
 
-void WebSettingsImpl::setUseThreadedCompositor(bool useThreadedCompositor)
-{
-    m_useThreadedCompositor = useThreadedCompositor;
-}
-
 void WebSettingsImpl::setMemoryInfoEnabled(bool enabled)
 {
     m_settings->setMemoryInfoEnabled(enabled);
index 4698443..74b8af9 100644 (file)
@@ -109,8 +109,6 @@ public:
     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);
@@ -132,7 +130,6 @@ private:
     bool m_compositeToTextureEnabled;
     bool m_showFPSCounter;
     bool m_showPlatformLayerTree;
-    bool m_useThreadedCompositor;
 };
 
 } // namespace WebKit
index ee41247..ba403eb 100644 (file)
 #include "WebString.h"
 #include "WebVector.h"
 #include "WebViewClient.h"
-#include "cc/CCHeadsUpDisplay.h"
+#include "cc/CCProxy.h"
 #include <wtf/ByteArray.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/MainThread.h>
@@ -1142,12 +1142,12 @@ void WebViewImpl::animate(double frameBeginTime)
     if (webframe) {
         FrameView* view = webframe->frameView();
         if (view) {
-            if (!settings()->useThreadedCompositor() && m_layerTreeHost)
+            if (!CCProxy::hasImplThread() && m_layerTreeHost)
                 m_layerTreeHost->setAnimating(true);
 
             view->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(frameBeginTime));
 
-            if (!settings()->useThreadedCompositor() && m_layerTreeHost)
+            if (!CCProxy::hasImplThread() && m_layerTreeHost)
                 m_layerTreeHost->setAnimating(false);
         }
     }
@@ -1249,7 +1249,7 @@ void WebViewImpl::themeChanged()
 void WebViewImpl::composite(bool)
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (settings()->useThreadedCompositor())
+    if (CCProxy::hasImplThread())
         m_layerTreeHost->setNeedsRedraw();
     else {
         ASSERT(isAcceleratedCompositingActive());
@@ -2783,7 +2783,7 @@ WebCore::NonCompositedContentHost* WebViewImpl::nonCompositedContentHost()
 void WebViewImpl::scheduleAnimation()
 {
     if (isAcceleratedCompositingActive()) {
-        if (settings()->useThreadedCompositor()) {
+        if (CCProxy::hasImplThread()) {
             ASSERT(m_layerTreeHost);
             m_layerTreeHost->setNeedsAnimate();
         } else
@@ -2854,7 +2854,6 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
         WebCore::CCSettings ccSettings;
         ccSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled();
         ccSettings.compositeOffscreen = settings()->compositeToTextureEnabled();
-        ccSettings.enableCompositorThread = settings()->useThreadedCompositor();
         ccSettings.showFPSCounter = settings()->showFPSCounter();
         ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree();
         ccSettings.refreshRate = screenRefreshRate(page()->mainFrame()->view());
@@ -2891,7 +2890,7 @@ PassRefPtr<GraphicsContext3D> WebViewImpl::createLayerTreeHostContext3D()
 {
     RefPtr<GraphicsContext3D> context = m_temporaryOnscreenGraphicsContext3D.release();
     if (!context) {
-        if (settings()->useThreadedCompositor())
+        if (CCProxy::hasImplThread())
             context = GraphicsContext3DPrivate::createGraphicsContextForAnotherThread(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
         else
             context = GraphicsContext3D::create(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
@@ -2959,7 +2958,7 @@ void WebViewImpl::didRecreateGraphicsContext(bool success)
 
 void WebViewImpl::scheduleComposite()
 {
-    ASSERT(!settings()->useThreadedCompositor());
+    ASSERT(!CCProxy::hasImplThread());
     m_client->scheduleComposite();
 }
 
@@ -2991,7 +2990,7 @@ WebGraphicsContext3D* WebViewImpl::graphicsContext3D()
             if (webContext && !webContext->isContextLost())
                 return webContext;
         }
-        if (settings()->useThreadedCompositor())
+        if (CCProxy::hasImplThread())
             m_temporaryOnscreenGraphicsContext3D = GraphicsContext3DPrivate::createGraphicsContextForAnotherThread(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
         else
             m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
@@ -3002,7 +3001,6 @@ WebGraphicsContext3D* WebViewImpl::graphicsContext3D()
     return 0;
 }
 
-
 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
                                      bool isInitialState) {
     if (!page())
index 4a41796..e220880 100644 (file)
@@ -249,15 +249,7 @@ protected:
     CCLayerTreeHostTest()
         : m_beginning(false)
         , m_endWhenBeginReturns(false)
-        , m_timedOut(false)
-    {
-        m_webThread = adoptPtr(webKitPlatformSupport()->createThread("CCLayerTreeHostTest"));
-        ASSERT(CCProxy::mainThread());
-
-        WebCompositor::setThread(m_webThread.get());
-        ASSERT(CCProxy::isMainThread());
-        m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread());
-    }
+        , m_timedOut(false) { }
 
     void doBeginTest();
 
@@ -271,9 +263,6 @@ protected:
         ASSERT(isMainThread());
         webkit_support::QuitMessageLoop();
         webkit_support::RunAllPendingMessages();
-        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
-        ASSERT_TRUE(test);
-        test->m_layerTreeHost.clear();
     }
 
     static void dispatchSetNeedsAnimate(void* self)
@@ -362,14 +351,27 @@ protected:
 
     virtual void runTest(bool threaded)
     {
-        m_settings.enableCompositorThread = threaded;
         m_settings.refreshRate = 100.0;
+
+        if (threaded) {
+            m_webThread = adoptPtr(webKitPlatformSupport()->createThread("CCLayerTreeHostTest"));
+            WebCompositor::initialize(m_webThread.get());
+        } else
+            WebCompositor::initialize(0);
+
+        ASSERT(CCProxy::isMainThread());
+        m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread());
+
         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
         webkit_support::RunMessageLoop();
         webkit_support::RunAllPendingMessages();
 
+        if (m_layerTreeHost && m_layerTreeHost->rootLayer())
+            m_layerTreeHost->rootLayer()->setLayerTreeHost(0);
+        m_layerTreeHost.clear();
+
         if (m_timeoutTask)
             m_timeoutTask->clearTest();
 
@@ -377,10 +379,11 @@ protected:
         m_client.clear();
         if (m_timedOut) {
             FAIL() << "Test timed out";
+            WebCompositor::shutdown();
             return;
         }
-        m_rootLayer->setLayerTreeHost(0);
         afterTest();
+        WebCompositor::shutdown();
     }
 
     CCSettings m_settings;
@@ -392,7 +395,6 @@ private:
     bool m_endWhenBeginReturns;
     bool m_timedOut;
 
-    RefPtr<LayerChromium> m_rootLayer;
     OwnPtr<WebThread> m_webThread;
     RefPtr<CCScopedThreadProxy> m_mainThreadProxy;
     TimeoutTask* m_timeoutTask;
@@ -403,10 +405,10 @@ void CCLayerTreeHostTest::doBeginTest()
     ASSERT(isMainThread());
     m_client = MockLayerTreeHostClient::create(this);
 
-    m_rootLayer = LayerChromium::create(0);
-    m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), m_rootLayer, m_settings);
+    RefPtr<LayerChromium> rootLayer = LayerChromium::create(0);
+    m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings);
     ASSERT_TRUE(m_layerTreeHost);
-    m_rootLayer->setLayerTreeHost(m_layerTreeHost.get());
+    rootLayer->setLayerTreeHost(m_layerTreeHost.get());
 
     m_beginning = true;
     beginTest();
@@ -445,6 +447,10 @@ public:
 
     virtual void beginTest()
     {
+        // Kill the layerTreeHost immediately.
+        m_layerTreeHost->rootLayer()->setLayerTreeHost(0);
+        m_layerTreeHost.clear();
+
         endTest();
     }
 
@@ -473,6 +479,11 @@ public:
     virtual void beginTest()
     {
         postSetNeedsCommitToMainThread();
+
+        // Kill the layerTreeHost immediately.
+        m_layerTreeHost->rootLayer()->setLayerTreeHost(0);
+        m_layerTreeHost.clear();
+
         endTest();
     }
 
@@ -491,6 +502,11 @@ public:
     virtual void beginTest()
     {
         postSetNeedsRedrawToMainThread();
+
+        // Kill the layerTreeHost immediately.
+        m_layerTreeHost->rootLayer()->setLayerTreeHost(0);
+        m_layerTreeHost.clear();
+
         endTest();
     }
 
@@ -501,8 +517,8 @@ public:
 
 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestShortlived3)
 
-// Constantly redrawing layerTreeHosts shouldn't die when they commit
-class CCLayerTreeHostTestCommitingWithContinuousRedraw : public CCLayerTreeHostTest {
+// Test interleaving of redraws and commits
+class CCLayerTreeHostTestCommitingWithContinuousRedraw : public CCLayerTreeHostTestThreadOnly {
 public:
     CCLayerTreeHostTestCommitingWithContinuousRedraw()
         : m_numCompleteCommits(0)
@@ -513,7 +529,6 @@ public:
     virtual void beginTest()
     {
         postSetNeedsCommitToMainThread();
-        endTest();
     }
 
     virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*)
@@ -540,7 +555,10 @@ private:
     int m_numDraws;
 };
 
-SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestCommitingWithContinuousRedraw)
+TEST_F(CCLayerTreeHostTestCommitingWithContinuousRedraw, runMultiThread)
+{
+    runTestThreaded();
+}
 
 // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1
 // draw with frame 0.
@@ -991,6 +1009,9 @@ public:
         // amout of times as paintContentsIfDirty().
         EXPECT_EQ(m_updateCheckLayer->paintContentsCount(),
                   m_updateCheckLayer->updateCount());
+
+        // clear m_updateCheckLayer so CCLayerTreeHost dies.
+        m_updateCheckLayer.clear();
     }
 
 private:
 
 #include "config.h"
 
-#include "WebCompositorImpl.h"
+#include "WebCompositorInputHandlerImpl.h"
 
+#include "WebCompositor.h"
 #include "cc/CCSingleThreadProxy.h"
 
 #include <gtest/gtest.h>
 #include <wtf/OwnPtr.h>
 
-using WebKit::WebCompositor;
-using WebKit::WebCompositorImpl;
+using WebKit::WebCompositorInputHandler;
+using WebKit::WebCompositorInputHandlerImpl;
 
 namespace {
 
-TEST(WebCompositorImpl, fromIdentifier)
+TEST(WebCompositorInputHandlerImpl, fromIdentifier)
 {
+    WebKit::WebCompositor::initialize(0);
 #ifndef NDEBUG
-    // WebCompositor APIs can only be called from the compositor thread.
+    // WebCompositorInputHandler APIs can only be called from the compositor thread.
     WebCore::DebugScopedSetImplThread alwaysImplThread;
 #endif
 
-    // Before creating any WebCompositors, lookups for any value should fail and not crash.
-    EXPECT_EQ(0, WebCompositor::fromIdentifier(2));
-    EXPECT_EQ(0, WebCompositor::fromIdentifier(0));
-    EXPECT_EQ(0, WebCompositor::fromIdentifier(-1));
+    // Before creating any WebCompositorInputHandlers, lookups for any value should fail and not crash.
+    EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(2));
+    EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(0));
+    EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(-1));
 
     int compositorIdentifier = -1;
     {
-        OwnPtr<WebCompositorImpl> comp = WebCompositorImpl::create(0);
+        OwnPtr<WebCompositorInputHandlerImpl> comp = WebCompositorInputHandlerImpl::create(0);
         compositorIdentifier = comp->identifier();
         // The compositor we just created should be locatable.
-        EXPECT_EQ(comp.get(), WebCompositor::fromIdentifier(compositorIdentifier));
+        EXPECT_EQ(comp.get(), WebCompositorInputHandler::fromIdentifier(compositorIdentifier));
 
         // But nothing else.
-        EXPECT_EQ(0, WebCompositor::fromIdentifier(comp->identifier() + 10));
+        EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(comp->identifier() + 10));
     }
 
     // After the compositor is destroyed, its entry should be removed from the map.
-    EXPECT_EQ(0, WebCompositor::fromIdentifier(compositorIdentifier));
+    EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(compositorIdentifier));
+
+    WebKit::WebCompositor::shutdown();
 }
 
 }
index 0d02b60..ab84cba 100644 (file)
@@ -1,3 +1,22 @@
+2011-11-30  nduca@chromium.org  <nduca@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
+
+        [chromium] Enable threaded compositing via CCThreadProxy::hasThread only
+        https://bugs.webkit.org/show_bug.cgi?id=70838
+
+        Reviewed by James Robinson.
+
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::resetWebSettings):
+        * DumpRenderTree/chromium/TestShell.h:
+        (TestShell::threadedCompositingEnabled):
+        * DumpRenderTree/chromium/WebPreferences.cpp:
+        (WebPreferences::reset):
+        (WebPreferences::applyTo):
+        * DumpRenderTree/chromium/WebPreferences.h:
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::WebViewHost):
+        (WebViewHost::~WebViewHost):
+
 2011-11-30  Chris Fleizach  <cfleizach@apple.com>
 
         AX: Nodes are reporting that focus can be set when they really can't
index 1e0a626..226405b 100644 (file)
@@ -35,6 +35,7 @@
 #include "DRTDevToolsClient.h"
 #include "LayoutTestController.h"
 #include "WebArrayBufferView.h"
+#include "WebCompositor.h"
 #include "WebDataSource.h"
 #include "WebDocument.h"
 #include "WebElement.h"
@@ -42,7 +43,9 @@
 #include "WebHistoryItem.h"
 #include "WebIDBFactory.h"
 #include "WebTestingSupport.h"
+#include "WebThread.h"
 #include "WebKit.h"
+#include "WebKitPlatformSupport.h"
 #include "WebPermissions.h"
 #include "WebPoint.h"
 #include "WebRuntimeFeatures.h"
@@ -137,6 +140,15 @@ TestShell::TestShell(bool testShellMode)
 #endif
     m_printer = m_testShellMode ? TestEventPrinter::createTestShellPrinter() : TestEventPrinter::createDRTPrinter();
 
+    WTF::initializeThreading();
+
+    if (m_threadedCompositingEnabled) {
+        m_webCompositorThread = adoptPtr(WebKit::webKitPlatformSupport()->createThread("Compositor"));
+        WebCompositor::initialize(m_webCompositorThread.get());
+    } else
+        WebCompositor::initialize(0);
+
+
     // 30 second is the same as the value in Mac DRT.
     // If we use a value smaller than the timeout value of
     // (new-)run-webkit-tests, (new-)run-webkit-tests misunderstands that a
@@ -161,6 +173,8 @@ TestShell::~TestShell()
 
     // Destroy the WebView before its WebViewHost.
     m_drtDevToolsAgent->setWebView(0);
+
+    WebCompositor::shutdown();
 }
 
 void TestShell::createDRTDevToolsClient(DRTDevToolsAgent* agent)
@@ -201,7 +215,6 @@ void TestShell::resetWebSettings(WebView& webView)
     m_prefs.reset();
     m_prefs.acceleratedCompositingEnabled = true;
     m_prefs.acceleratedCompositingForVideoEnabled = m_acceleratedCompositingForVideoEnabled;
-    m_prefs.threadedCompositingEnabled = m_threadedCompositingEnabled;
     m_prefs.compositeToTexture = m_compositeToTexture;
     m_prefs.forceCompositingMode = m_forceCompositingMode;
     m_prefs.accelerated2dCanvasEnabled = m_accelerated2dCanvasEnabled;
index 1f648b1..e7313df 100644 (file)
@@ -52,6 +52,7 @@ namespace WebKit {
 class WebDevToolsAgentClient;
 class WebFrame;
 class WebNotificationPresenter;
+class WebThread;
 class WebView;
 class WebURL;
 }
@@ -214,6 +215,7 @@ private:
     OwnPtr<TextInputController> m_textInputController;
     OwnPtr<NotificationPresenter> m_notificationPresenter;
     OwnPtr<WebViewHost> m_webViewHost;
+    OwnPtr<WebKit::WebThread> m_webCompositorThread;
 
     TestParams m_params;
     int m_timeout; // timeout value in millisecond
index 5cc8fab..75a0577 100644 (file)
@@ -109,7 +109,6 @@ void WebPreferences::reset()
     hyperlinkAuditingEnabled = false;
     acceleratedCompositingForVideoEnabled = false;
     acceleratedCompositingEnabled = false;
-    threadedCompositingEnabled = false;
     compositeToTexture = false;
     accelerated2dCanvasEnabled = false;
     legacyAccelerated2dCanvasEnabled = false;
@@ -213,7 +212,6 @@ void WebPreferences::applyTo(WebView* webView)
     settings->setCaretBrowsingEnabled(caretBrowsingEnabled);
     settings->setAcceleratedCompositingEnabled(acceleratedCompositingEnabled);
     settings->setAcceleratedCompositingForVideoEnabled(acceleratedCompositingForVideoEnabled);
-    settings->setUseThreadedCompositor(threadedCompositingEnabled);
     settings->setCompositeToTextureEnabled(compositeToTexture);
     settings->setForceCompositingMode(forceCompositingMode);
     settings->setAccelerated2dCanvasEnabled(accelerated2dCanvasEnabled);
index 2337a40..2164944 100644 (file)
@@ -102,7 +102,6 @@ struct WebPreferences {
     bool caretBrowsingEnabled;
     bool acceleratedCompositingForVideoEnabled;
     bool acceleratedCompositingEnabled;
-    bool threadedCompositingEnabled;
     bool compositeToTexture;
     bool forceCompositingMode;
     bool accelerated2dCanvasEnabled;
index 894ca60..bf75130 100644 (file)
@@ -37,7 +37,6 @@
 #include "TestWebPlugin.h"
 #include "TestWebWorker.h"
 #include "WebCString.h"
-#include "WebCompositor.h"
 #include "WebConsoleMessage.h"
 #include "WebContextMenuData.h"
 #include "WebDataSource.h"
@@ -48,7 +47,6 @@
 #include "WebGeolocationClientMock.h"
 #include "WebHistoryItem.h"
 #include "WebKit.h"
-#include "WebKitPlatformSupport.h"
 #include "WebNode.h"
 #include "WebPluginParams.h"
 #include "WebPopupMenu.h"
@@ -71,7 +69,6 @@
 
 #include <wtf/Assertions.h>
 #include <wtf/PassOwnPtr.h>
-#include <wtf/Threading.h>
 #include <wtf/Vector.h>
 
 using namespace WebCore;
@@ -1208,11 +1205,6 @@ WebViewHost::WebViewHost(TestShell* shell)
     , m_webWidget(0)
     , m_lastRequestedTextCheckingCompletion(0)
 {
-    WTF::initializeThreading();
-
-    m_compositorThread = adoptPtr(WebKit::webKitPlatformSupport()->createThread("Compositor"));
-    WebCompositor::setThread(m_compositorThread.get());
-
     reset();
 }
 
index be176da..922163a 100644 (file)
@@ -58,7 +58,6 @@ class WebGeolocationServiceMock;
 class WebSpeechInputController;
 class WebSpeechInputControllerMock;
 class WebSpeechInputListener;
-class WebThread;
 class WebURL;
 struct WebRect;
 struct WebURLError;
@@ -360,8 +359,6 @@ private:
     WebKit::WebString m_lastRequestedTextCheckString;
     WebKit::WebTextCheckingCompletion* m_lastRequestedTextCheckingCompletion;
 
-    OwnPtr<WebKit::WebThread> m_compositorThread;
-
     TaskList m_taskList;
     Vector<WebKit::WebWidget*> m_popupmenus;
 };