Changeset 96392 in webkit
- Timestamp:
- Sep 30, 2011 12:05:19 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 17 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r96385 r96392 1 2011-09-30 James Robinson <jamesr@chromium.org> 2 3 [chromium] Add WebKit API for sending input events to the compositor thread 4 https://bugs.webkit.org/show_bug.cgi?id=69117 5 6 Reviewed by Darin Fisher. 7 8 Convert to using an externally-provided thread instead of one managed by CCThreadProxy internally. Most changes 9 in these files are mechanically changing references from ccThread to s_ccThread to reflect the class-static 10 nature of this pointer, the rest are removing the old thread creation codepath. 11 12 These changes are covered by the CC* unit tests and by the gpu layout tests when run with the 13 use_threaded_compositing=1 gyp define. 14 15 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 16 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 17 * platform/graphics/chromium/cc/CCThreadProxy.cpp: 18 (WebCore::CCThreadProxy::setThread): 19 (WebCore::CCThreadProxy::CCThreadProxy): 20 (WebCore::CCThreadProxy::~CCThreadProxy): 21 (WebCore::CCThreadProxy::compositeAndReadback): 22 (WebCore::CCThreadProxy::finishAllRendering): 23 (WebCore::CCThreadProxy::initializeLayerRenderer): 24 (WebCore::CCThreadProxy::setNeedsCommit): 25 (WebCore::CCThreadProxy::setNeedsCommitAndRedraw): 26 (WebCore::CCThreadProxy::setNeedsRedraw): 27 (WebCore::CCThreadProxy::start): 28 (WebCore::CCThreadProxy::stop): 29 (WebCore::CCThreadProxy::beginFrameAndCommit): 30 (WebCore::CCThreadProxy::scheduleDrawTaskOnCCThread): 31 * platform/graphics/chromium/cc/CCThreadProxy.h: 32 1 33 2011-09-29 Fady Samuel <fsamuel@chromium.org> 2 34 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r96186 r96392 144 144 } 145 145 146 PassOwnPtr<CCThread> CCLayerTreeHost::createCompositorThread()147 {148 return m_client->createCompositorThread();149 }150 151 146 PassRefPtr<GraphicsContext3D> CCLayerTreeHost::createLayerTreeHostContext3D() 152 147 { -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r96283 r96392 42 42 43 43 class CCLayerTreeHostImpl; 44 class CCThread;45 44 class GraphicsContext3D; 46 45 class LayerChromium; … … 52 51 public: 53 52 virtual void animateAndLayout(double frameBeginTime) = 0; 54 virtual PassOwnPtr<CCThread> createCompositorThread() = 0;55 53 virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D() = 0; 56 54 virtual void didRecreateGraphicsContext(bool success) = 0; … … 100 98 void commitComplete(); 101 99 void commitToOnCCThread(CCLayerTreeHostImpl*); 102 PassOwnPtr<CCThread> createCompositorThread();103 100 PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D(); 104 101 virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl(); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r96186 r96392 39 39 namespace WebCore { 40 40 41 namespace { 42 CCThread* ccThread; 43 int numProxies = 0; 41 CCThread* CCThreadProxy::s_ccThread = 0; 42 43 void CCThreadProxy::setThread(CCThread* ccThread) 44 { 45 s_ccThread = ccThread; 46 #ifndef NDEBUG 47 CCProxy::setImplThread(s_ccThread->threadID()); 48 #endif 44 49 } 45 50 … … 61 66 TRACE_EVENT("CCThreadProxy::CCThreadProxy", this, 0); 62 67 ASSERT(isMainThread()); 63 numProxies++;64 if (!ccThread) {65 ccThread = m_layerTreeHost->createCompositorThread().leakPtr();66 #ifndef NDEBUG67 CCProxy::setImplThread(ccThread->threadID());68 #endif69 }70 68 } 71 69 … … 75 73 ASSERT(isMainThread()); 76 74 ASSERT(!m_started); 77 78 numProxies--;79 if (!numProxies) {80 delete ccThread;81 ccThread = 0;82 }83 75 } 84 76 … … 98 90 CCMainThread::Task* taskPtr = 0; 99 91 CCCompletionEvent completion; 100 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::obtainBeginFrameAndCommitTaskFromCCThread, AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&taskPtr)));92 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::obtainBeginFrameAndCommitTaskFromCCThread, AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&taskPtr))); 101 93 completion.wait(); 102 94 beginFrameAndCommitTask = adoptPtr(taskPtr); … … 109 101 bool success = false; 110 102 CCCompletionEvent completion; 111 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::drawLayersAndReadbackOnCCThread, AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&success), AllowCrossThreadAccess(pixels), rect));103 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::drawLayersAndReadbackOnCCThread, AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&success), AllowCrossThreadAccess(pixels), rect)); 112 104 completion.wait(); 113 105 return success; … … 139 131 // Make sure all GL drawing is finished on the impl thread. 140 132 CCCompletionEvent completion; 141 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::finishAllRenderingOnCCThread, AllowCrossThreadAccess(&completion)));133 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::finishAllRenderingOnCCThread, AllowCrossThreadAccess(&completion))); 142 134 completion.wait(); 143 135 } … … 165 157 bool initializeSucceeded = false; 166 158 LayerRendererCapabilities capabilities; 167 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeLayerRendererOnCCThread,159 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeLayerRendererOnCCThread, 168 160 AllowCrossThreadAccess(contextPtr), AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&initializeSucceeded), AllowCrossThreadAccess(&capabilities))); 169 161 completion.wait(); … … 192 184 TRACE_EVENT("CCThreadProxy::setNeedsCommit", this, 0); 193 185 m_commitRequested = true; 194 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::updateSchedulerStateOnCCThread, m_commitRequested, true));186 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::updateSchedulerStateOnCCThread, m_commitRequested, true)); 195 187 } 196 188 … … 203 195 204 196 TRACE_EVENT("CCThreadProxy::setNeedsCommitAndRedraw", this, 0); 205 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::updateSchedulerStateOnCCThread, m_commitRequested, true));197 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::updateSchedulerStateOnCCThread, m_commitRequested, true)); 206 198 } 207 199 … … 218 210 // compared to setNeedsCommitAndRedraw messages. 219 211 TRACE_EVENT("CCThreadProxy::setNeedsRedraw", this, 0); 220 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::updateSchedulerStateOnCCThread, false, true));212 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::updateSchedulerStateOnCCThread, false, true)); 221 213 } 222 214 … … 224 216 { 225 217 ASSERT(isMainThread()); 218 ASSERT(s_ccThread); 226 219 // Create LayerTreeHostImpl. 227 220 CCCompletionEvent completion; 228 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeImplOnCCThread, AllowCrossThreadAccess(&completion)));221 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeImplOnCCThread, AllowCrossThreadAccess(&completion))); 229 222 completion.wait(); 230 223 … … 240 233 // Synchronously deletes the impl. 241 234 CCCompletionEvent completion; 242 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnCCThread, AllowCrossThreadAccess(&completion)));235 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnCCThread, AllowCrossThreadAccess(&completion))); 243 236 completion.wait(); 244 237 … … 326 319 TRACE_EVENT("commit", this, 0); 327 320 CCCompletionEvent completion; 328 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::commitOnCCThread, AllowCrossThreadAccess(&completion)));321 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::commitOnCCThread, AllowCrossThreadAccess(&completion))); 329 322 completion.wait(); 330 323 } … … 363 356 ASSERT(m_layerTreeHostImpl); 364 357 m_drawTaskPostedOnCCThread = true; 365 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::drawLayersAndPresentOnCCThread));358 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::drawLayersAndPresentOnCCThread)); 366 359 } 367 360 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
r96066 r96392 35 35 36 36 class CCLayerTreeHost; 37 class CCThread; 37 38 38 39 class CCThreadProxy : public CCProxy { 39 40 public: 41 static void setThread(CCThread*); 42 40 43 static PassOwnPtr<CCProxy> create(CCLayerTreeHost*); 41 44 … … 90 93 bool m_drawTaskPostedOnCCThread; 91 94 bool m_redrawRequestedOnCCThread; 95 96 static CCThread* s_ccThread; 92 97 }; 93 98 -
trunk/Source/WebKit/chromium/ChangeLog
r96337 r96392 1 2011-09-30 James Robinson <jamesr@chromium.org> 2 3 [chromium] Add WebKit API for sending input events to the compositor thread 4 https://bugs.webkit.org/show_bug.cgi?id=69117 5 6 Reviewed by Darin Fisher. 7 8 Adds a new WebKit interface to allow the embedder to pass input events directly to the compositor thread. 9 Exposes the new WebCompositor interface and associated client. These interfaces are slightly different in that 10 they can only be interacted with from the compositor thread. 11 12 Changes the initialization path for the compositor thread to using an externally allocated and managed thread 13 instead of one internal to WebCore so that the embedder can interact with the thread more easily. This also 14 simplifies the startup and shutdown paths. The contract is that WebCompositor::setThread() must be called 15 before any compositor can be initialized and the passed-in thread must outlive all compositor instances. 16 17 Each WebCompositor instance is associated with a WebWidget. There isn't any way to get a WebCompositor for a 18 given WebWidget in this patch, that will be done in a follow-up. 19 20 * WebKit.gyp: 21 * public/WebCompositor.h: 22 (WebKit::WebCompositor::~WebCompositor): 23 * public/WebCompositorClient.h: 24 (WebKit::WebCompositorClient::~WebCompositorClient): 25 * src/CCThreadImpl.cpp: 26 (WebKit::CCThreadImpl::create): 27 (WebKit::CCThreadImpl::CCThreadImpl): 28 * src/CCThreadImpl.h: 29 * src/WebCompositorImpl.cpp: Added. 30 (WebKit::WebCompositor::setThread): 31 (WebKit::WebCompositorImpl::WebCompositorImpl): 32 (WebKit::WebCompositorImpl::~WebCompositorImpl): 33 (WebKit::WebCompositorImpl::setClient): 34 (WebKit::WebCompositorImpl::handleInputEvent): 35 * src/WebCompositorImpl.h: 36 (WebKit::WebCompositorImpl::create): 37 * src/WebViewImpl.cpp: 38 * src/WebViewImpl.h: 39 * tests/CCLayerTreeHostTest.cpp: 40 (WTF::CCLayerTreeHostTest::CCLayerTreeHostTest): 41 * tests/CCThreadTest.cpp: 42 (WebKit::TEST): 43 1 44 2011-09-29 Iain Merrick <husky@google.com> 2 45 -
trunk/Source/WebKit/chromium/WebKit.gyp
r96233 r96392 128 128 'public/WebCommonWorkerClient.h', 129 129 'public/WebCompositionUnderline.h', 130 'public/WebCompositorClient.h', 131 'public/WebCompositor.h', 130 132 'public/WebConsoleMessage.h', 131 133 'public/WebContextMenuData.h', … … 446 448 'src/WebColor.cpp', 447 449 'src/WebCommon.cpp', 450 'src/WebCompositorImpl.cpp', 451 'src/WebCompositorImpl.h', 448 452 'src/WebCrossOriginPreflightResultCache.cpp', 449 453 'src/WebCString.cpp', -
trunk/Source/WebKit/chromium/public/WebCompositor.h
r96391 r96392 5 5 * modification, are permitted provided that the following conditions 6 6 * are met: 7 * 7 8 * 1. Redistributions of source code must retain the above copyright 8 9 * notice, this list of conditions and the following disclaimer. … … 11 12 * documentation and/or other materials provided with the distribution. 12 13 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''AND ANY14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 14 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC.OR ITS CONTRIBUTORS BE LIABLE FOR ANY17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 24 */ 24 25 25 #include "cc/CCThread.h" 26 #include <wtf/OwnPtr.h> 27 #include <wtf/Threading.h> 26 #ifndef WebCompositor_h 27 #define WebCompositor_h 28 28 29 30 #ifndef CCThreadImpl_h 31 #define CCThreadImpl_h 29 #include "WebCommon.h" 32 30 33 31 namespace WebKit { 34 32 33 class WebCompositorClient; 34 class WebInputEvent; 35 35 class WebThread; 36 36 37 // Implements CCThread in terms of WebThread. 38 class CCThreadImpl : public WebCore::CCThread { 37 // This represents the compositor associated with a WebWidget. All calls to the WebCompositor must 38 // be made from the compositor thread. 39 class WebCompositor { 39 40 public: 40 static PassOwnPtr<WebCore::CCThread> create(); 41 virtual ~CCThreadImpl(); 42 void postTask(PassOwnPtr<WebCore::CCThread::Task>); 43 WTF::ThreadIdentifier threadID() const; 41 // This must be called once with a non-null WebThread before any compositors attempt to initialize. 42 WEBKIT_EXPORT static void setThread(WebThread*); 44 43 45 private: 46 CCThreadImpl();44 virtual void setClient(WebCompositorClient*) = 0; 45 virtual void handleInputEvent(const WebInputEvent&) = 0; 47 46 48 OwnPtr<WebThread> m_thread; 49 WTF::ThreadIdentifier m_threadID;47 protected: 48 virtual ~WebCompositor() { } 50 49 }; 51 50 -
trunk/Source/WebKit/chromium/public/WebCompositorClient.h
r96391 r96392 5 5 * modification, are permitted provided that the following conditions 6 6 * are met: 7 * 7 8 * 1. Redistributions of source code must retain the above copyright 8 9 * notice, this list of conditions and the following disclaimer. … … 11 12 * documentation and/or other materials provided with the distribution. 12 13 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''AND ANY14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 14 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC.OR ITS CONTRIBUTORS BE LIABLE FOR ANY17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 24 */ 24 25 25 #include "cc/CCThread.h" 26 #include <wtf/OwnPtr.h> 27 #include <wtf/Threading.h> 28 29 30 #ifndef CCThreadImpl_h 31 #define CCThreadImpl_h 26 #ifndef WebCompositorClient_h 27 #define WebCompositorClient_h 32 28 33 29 namespace WebKit { 34 30 35 class WebThread; 31 class WebCompositorClient { 32 public: 33 // Callbacks invoked from the compositor thread. 34 virtual void willShutdown() = 0; 35 virtual void didHandleInputEvent() = 0; 36 36 37 // Implements CCThread in terms of WebThread. 38 class CCThreadImpl : public WebCore::CCThread { 39 public: 40 static PassOwnPtr<WebCore::CCThread> create(); 41 virtual ~CCThreadImpl(); 42 void postTask(PassOwnPtr<WebCore::CCThread::Task>); 43 WTF::ThreadIdentifier threadID() const; 44 45 private: 46 CCThreadImpl(); 47 48 OwnPtr<WebThread> m_thread; 49 WTF::ThreadIdentifier m_threadID; 37 protected: 38 virtual ~WebCompositorClient() { } 50 39 }; 51 40 -
trunk/Source/WebKit/chromium/public/WebKit.h
r95901 r96392 33 33 34 34 #include "WebCommon.h" 35 36 #define HAVE_WEBCOMPOSITOR 35 37 36 38 namespace WebKit { -
trunk/Source/WebKit/chromium/src/CCThreadImpl.cpp
r95901 r96392 77 77 }; 78 78 79 PassOwnPtr<CCThread> CCThreadImpl::create( )79 PassOwnPtr<CCThread> CCThreadImpl::create(WebThread* thread) 80 80 { 81 return adoptPtr(new CCThreadImpl( ));81 return adoptPtr(new CCThreadImpl(thread)); 82 82 } 83 83 … … 96 96 } 97 97 98 CCThreadImpl::CCThreadImpl( )99 : m_thread( adoptPtr(webKitPlatformSupport()->createThread("CCThread")))98 CCThreadImpl::CCThreadImpl(WebThread* thread) 99 : m_thread(thread) 100 100 { 101 101 // Get the threadId for the newly-created thread by running a task -
trunk/Source/WebKit/chromium/src/CCThreadImpl.h
r95901 r96392 38 38 class CCThreadImpl : public WebCore::CCThread { 39 39 public: 40 static PassOwnPtr<WebCore::CCThread> create( );40 static PassOwnPtr<WebCore::CCThread> create(WebThread*); 41 41 virtual ~CCThreadImpl(); 42 42 void postTask(PassOwnPtr<WebCore::CCThread::Task>); … … 44 44 45 45 private: 46 CCThreadImpl();46 explicit CCThreadImpl(WebThread*); 47 47 48 OwnPtr<WebThread>m_thread;48 WebThread* m_thread; 49 49 WTF::ThreadIdentifier m_threadID; 50 50 }; -
trunk/Source/WebKit/chromium/src/WebCompositorImpl.h
r96391 r96392 5 5 * modification, are permitted provided that the following conditions 6 6 * are met: 7 * 7 8 * 1. Redistributions of source code must retain the above copyright 8 9 * notice, this list of conditions and the following disclaimer. … … 11 12 * documentation and/or other materials provided with the distribution. 12 13 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''AND ANY14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 14 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC.OR ITS CONTRIBUTORS BE LIABLE FOR ANY17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 24 */ 24 25 25 #include "cc/CCThread.h" 26 #include <wtf/OwnPtr.h> 27 #include <wtf/Threading.h> 26 #ifndef WebCompositorImpl_h 27 #define WebCompositorImpl_h 28 28 29 30 #i fndef CCThreadImpl_h31 # define CCThreadImpl_h29 #include "WebCompositor.h" 30 #include <wtf/Noncopyable.h> 31 #include <wtf/PassOwnPtr.h> 32 32 33 33 namespace WebKit { 34 34 35 class Web Thread;35 class WebCompositorClient; 36 36 37 // Implements CCThread in terms of WebThread. 38 class CCThreadImpl : public WebCore::CCThread { 37 class WebCompositorImpl : public WebCompositor { 38 WTF_MAKE_NONCOPYABLE(WebCompositorImpl); 39 39 public: 40 static PassOwnPtr<WebCore::CCThread> create(); 41 virtual ~CCThreadImpl(); 42 void postTask(PassOwnPtr<WebCore::CCThread::Task>); 43 WTF::ThreadIdentifier threadID() const; 40 static PassOwnPtr<WebCompositorImpl> create() 41 { 42 return adoptPtr(new WebCompositorImpl); 43 } 44 45 virtual ~WebCompositorImpl(); 46 47 virtual void setClient(WebCompositorClient*); 48 virtual void handleInputEvent(const WebInputEvent&); 44 49 45 50 private: 46 CCThreadImpl();51 WebCompositorImpl(); 47 52 48 OwnPtr<WebThread> m_thread; 49 WTF::ThreadIdentifier m_threadID; 53 WebCompositorClient* m_client; 50 54 }; 51 55 52 } // namespace WebKit56 } 53 57 54 #endif 58 #endif // WebCompositorImpl_h -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r96283 r96392 35 35 #include "AXObjectCache.h" 36 36 #include "BackForwardListChromium.h" 37 #include "CCThreadImpl.h"38 37 #include "CSSStyleSelector.h" 39 38 #include "CSSValueKeywords.h" … … 2687 2686 #endif 2688 2687 2689 PassOwnPtr<CCThread> WebViewImpl::createCompositorThread()2690 {2691 return CCThreadImpl::create();2692 }2693 2694 2688 PassRefPtr<GraphicsContext3D> WebViewImpl::createLayerTreeHostContext3D() 2695 2689 { -
trunk/Source/WebKit/chromium/src/WebViewImpl.h
r96283 r96392 220 220 // CCLayerTreeHostClient 221 221 virtual void animateAndLayout(double frameBeginTime); 222 virtual PassOwnPtr<WebCore::CCThread> createCompositorThread();223 222 virtual PassRefPtr<WebCore::GraphicsContext3D> createLayerTreeHostContext3D(); 224 223 virtual void didRecreateGraphicsContext(bool success); -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r96283 r96392 29 29 #include "cc/CCLayerTreeHost.h" 30 30 31 #include "cc/CCLayerTreeHostImpl.h" 32 #include "cc/CCMainThreadTask.h" 33 #include "cc/CCThreadTask.h" 31 34 #include "CCThreadImpl.h" 32 35 #include "GraphicsContext3DPrivate.h" 36 #include <gtest/gtest.h> 33 37 #include "LayerChromium.h" 34 38 #include "MockWebGraphicsContext3D.h" 35 39 #include "TextureManager.h" 36 #include " cc/CCLayerTreeHostImpl.h"37 #include " cc/CCMainThreadTask.h"38 #include " cc/CCThreadTask.h"39 #include <gtest/gtest.h>40 #include "WebCompositor.h" 41 #include "WebKit.h" 42 #include "WebKitPlatformSupport.h" 43 #include "WebThread.h" 40 44 #include <webkit/support/webkit_support.h> 41 45 #include <wtf/MainThread.h> … … 146 150 virtual void animateAndLayout(double frameBeginTime) 147 151 { 148 }149 150 virtual PassOwnPtr<CCThread> createCompositorThread()151 {152 return CCThreadImpl::create();153 152 } 154 153 … … 209 208 , m_timedOut(false) 210 209 { 210 m_webThread = adoptPtr(webKitPlatformSupport()->createThread("CCLayerTreeHostTest")); 211 WebCompositor::setThread(m_webThread.get()); 211 212 #if USE(THREADED_COMPOSITING) 212 213 m_settings.enableCompositorThread = true; … … 285 286 bool m_running; 286 287 bool m_timedOut; 288 289 OwnPtr<WebThread> m_webThread; 287 290 }; 288 291 -
trunk/Source/WebKit/chromium/tests/CCThreadTest.cpp
r95901 r96392 28 28 29 29 #include "CCThreadImpl.h" 30 #include "WebKit.h" 31 #include "WebKitPlatformSupport.h" 32 #include "WebThread.h" 30 33 #include "cc/CCCompletionEvent.h" 31 34 #include "cc/CCMainThreadTask.h" 32 35 #include "cc/CCThreadTask.h" 36 33 37 #include <gtest/gtest.h> 34 35 38 #include <webkit/support/webkit_support.h> 36 39 #include <wtf/MainThread.h> 37 40 38 41 using namespace WebCore; 42 using namespace WebKit; 39 43 40 44 namespace { … … 54 58 TEST(CCThreadTest, pingPongUsingCondition) 55 59 { 56 OwnPtr<CCThread> thread = WebKit::CCThreadImpl::create(); 60 OwnPtr<WebThread> webThread = adoptPtr(webKitPlatformSupport()->createThread("test")); 61 62 OwnPtr<CCThread> thread = WebKit::CCThreadImpl::create(webThread.get()); 57 63 PingPongUsingCondition target; 58 64 CCCompletionEvent completion; … … 81 87 }; 82 88 83 TEST(CCThreadTest, DISABLED_startPostAndWaitOnCondition)89 TEST(CCThreadTest, startPostAndWaitOnCondition) 84 90 { 85 OwnPtr<CCThread> thread = WebKit::CCThreadImpl::create(); 91 OwnPtr<WebThread> webThread = adoptPtr(webKitPlatformSupport()->createThread("test")); 92 93 OwnPtr<CCThread> thread = WebKit::CCThreadImpl::create(webThread.get()); 86 94 87 95 PingPongTestUsingTasks target; -
trunk/Tools/ChangeLog
r96390 r96392 1 2011-09-30 James Robinson <jamesr@chromium.org> 2 3 [chromium] Add WebKit API for sending input events to the compositor thread 4 https://bugs.webkit.org/show_bug.cgi?id=69117 5 6 Reviewed by Darin Fisher. 7 8 Adds support for creating and setting a compositor thread in DRT. 9 10 * DumpRenderTree/chromium/WebViewHost.cpp: 11 (WebViewHost::WebViewHost): 12 * DumpRenderTree/chromium/WebViewHost.h: 13 1 14 2011-09-29 David Levin <levin@chromium.org> 2 15 -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp
r96258 r96392 37 37 #include "TestWebWorker.h" 38 38 #include "WebCString.h" 39 #include "WebCompositor.h" 39 40 #include "WebConsoleMessage.h" 40 41 #include "WebContextMenuData.h" … … 46 47 #include "WebGeolocationClientMock.h" 47 48 #include "WebHistoryItem.h" 49 #include "WebKit.h" 50 #include "WebKitPlatformSupport.h" 48 51 #include "WebNode.h" 49 52 #include "WebPopupMenu.h" … … 57 60 #include "WebTextCheckingCompletion.h" 58 61 #include "WebTextCheckingResult.h" 62 #include "WebThread.h" 59 63 #include "WebURLRequest.h" 60 64 #include "WebURLResponse.h" … … 1168 1172 { 1169 1173 WTF::initializeThreading(); 1174 1175 m_compositorThread = adoptPtr(WebKit::webKitPlatformSupport()->createThread("Compositor")); 1176 WebCompositor::setThread(m_compositorThread.get()); 1177 1170 1178 reset(); 1171 1179 } -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.h
r96258 r96392 59 59 class WebSpeechInputControllerMock; 60 60 class WebSpeechInputListener; 61 class WebThread; 61 62 class WebURL; 62 63 struct WebRect; … … 349 350 WebKit::WebTextCheckingCompletion* m_lastRequestedTextCheckingCompletion; 350 351 352 OwnPtr<WebKit::WebThread> m_compositorThread; 353 351 354 TaskList m_taskList; 352 355 Vector<WebKit::WebWidget*> m_popupmenus;
Note: See TracChangeset
for help on using the changeset viewer.