Changeset 93680 in webkit
- Timestamp:
- Aug 23, 2011 6:22:22 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 12 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r93679 r93680 1 2011-08-23 Nat Duca <nduca@chromium.org> 2 3 [chromium] Implement CCThread in terms of WebThread 4 https://bugs.webkit.org/show_bug.cgi?id=66610 5 6 Reviewed by Darin Fisher. 7 8 * WebCore.gypi: 9 * platform/graphics/chromium/cc/CCCompletionEvent.h: 10 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 11 (WebCore::CCLayerTreeHost::client): 12 * platform/graphics/chromium/cc/CCLayerTreeHostImplProxy.cpp: 13 (WebCore::CCLayerTreeHostImplProxy::CCLayerTreeHostImplProxy): 14 * platform/graphics/chromium/cc/CCThread.h: 15 (WebCore::CCThread::~CCThread): 16 1 17 2011-08-23 Iain Merrick <husky@google.com> 2 18 -
trunk/Source/WebCore/WebCore.gypi
r93594 r93680 3543 3543 'platform/graphics/chromium/cc/CCRenderSurface.cpp', 3544 3544 'platform/graphics/chromium/cc/CCRenderSurface.h', 3545 'platform/graphics/chromium/cc/CCThread.cpp',3546 3545 'platform/graphics/chromium/cc/CCThread.h', 3547 3546 'platform/graphics/chromium/cc/CCThreadTask.h', -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCCompletionEvent.h
r85165 r93680 1 2 1 /* 3 2 * Copyright (C) 2011 Google Inc. All rights reserved. … … 31 30 namespace WebCore { 32 31 32 // Used for making blocking calls from one thread to another. Use only when 33 // absolutely certain that doing-so will not lead to a livelock. 34 // 35 // It is safe to destroy this object as soon as wait() returns. 33 36 class CCCompletionEvent { 34 37 public: -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r93615 r93680 39 39 class CCLayerTreeHostImpl; 40 40 class CCLayerTreeHostImplClient; 41 class CCThread; 41 42 class GraphicsContext3D; 42 43 class LayerChromium; … … 49 50 public: 50 51 virtual void animateAndLayout(double frameBeginTime) = 0; 52 virtual PassOwnPtr<CCThread> createCompositorThread() = 0; 51 53 virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D() = 0; 52 54 virtual PassOwnPtr<LayerPainterChromium> createRootLayerPainter() = 0; … … 86 88 bool animating() const { return m_animating; } 87 89 void setAnimating(bool animating) { m_animating = animating; } // Can be removed when non-threaded scheduling moves inside. 90 91 CCLayerTreeHostClient* client() { return m_client; } 88 92 89 93 GraphicsContext3D* context(); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImplProxy.cpp
r93346 r93680 50 50 numProxies++; 51 51 if (!ccThread) 52 ccThread = CCThread::create().leakPtr();52 ccThread = layerTreeHost->client()->createCompositorThread().leakPtr(); 53 53 } 54 54 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThread.h
r83249 r93680 26 26 #define CCThread_h 27 27 28 #include <wtf/MessageQueue.h>29 28 #include <wtf/PassOwnPtr.h> 30 #include <wtf/RefCounted.h>31 29 #include <wtf/Threading.h> 32 30 33 31 namespace WebCore { 34 32 35 // The CCThread singleton owns the compositor thread and provides36 // basic infrastructure for messaging between the two threads.33 // CCThread provides basic infrastructure for messaging with the compositor in a 34 // platform-neutral way. 37 35 class CCThread { 38 36 public: 39 static PassOwnPtr<CCThread> create() 40 { 41 return adoptPtr(new CCThread()); 42 } 43 44 virtual ~CCThread(); 37 virtual ~CCThread() { } 45 38 46 39 class Task { … … 55 48 }; 56 49 57 v oid postTask(PassOwnPtr<Task>); // Executes the task on context's thread asynchronously.50 virtual void postTask(PassOwnPtr<Task>) = 0; // Executes the task on context's thread asynchronously. 58 51 59 WTF::ThreadIdentifier threadID() const { return m_threadID; } 60 61 protected: 62 explicit CCThread(); 63 64 static void* compositorThreadStart(void*); 65 void* runLoop(); 66 67 WTF::ThreadIdentifier m_threadID; 68 MessageQueue<Task> m_queue; 69 70 Mutex m_threadCreationMutex; 52 virtual WTF::ThreadIdentifier threadID() const = 0; 71 53 }; 72 54 -
trunk/Source/WebKit/chromium/ChangeLog
r93679 r93680 1 2011-08-23 Nat Duca <nduca@chromium.org> 2 3 [chromium] Implement CCThread in terms of WebThread 4 https://bugs.webkit.org/show_bug.cgi?id=66610 5 6 Reviewed by Darin Fisher. 7 8 * WebKit.gyp: 9 * public/WebThread.h: 10 (WebKit::WebThread::~WebThread): 11 * src/CCThreadImpl.cpp: Added. 12 (WebKit::GetThreadIDTask::GetThreadIDTask): 13 (WebKit::GetThreadIDTask::~GetThreadIDTask): 14 (WebKit::GetThreadIDTask::run): 15 (WebKit::CCThreadTaskAdapter::CCThreadTaskAdapter): 16 (WebKit::CCThreadTaskAdapter::~CCThreadTaskAdapter): 17 (WebKit::CCThreadTaskAdapter::run): 18 (WebKit::CCThreadImpl::create): 19 (WebKit::CCThreadImpl::~CCThreadImpl): 20 (WebKit::CCThreadImpl::postTask): 21 (WebKit::CCThreadImpl::threadID): 22 (WebKit::CCThreadImpl::CCThreadImpl): 23 * src/CCThreadImpl.h: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCThread.cpp. 24 * src/WebViewImpl.cpp: 25 (WebKit::WebViewImpl::createCompositorThread): 26 * src/WebViewImpl.h: 27 * tests/CCThreadTest.cpp: 28 1 29 2011-08-23 Iain Merrick <husky@google.com> 2 30 -
trunk/Source/WebKit/chromium/WebKit.gyp
r93618 r93680 327 327 'src/BoundObject.cpp', 328 328 'src/BoundObject.h', 329 'src/CCThreadImpl.cpp', 330 'src/CCThreadImpl.h', 329 331 'src/ChromeClientImpl.cpp', 330 332 'src/ChromeClientImpl.h', -
trunk/Source/WebKit/chromium/public/WebThread.h
r92965 r93680 30 30 namespace WebKit { 31 31 32 #define WEBTHREAD_HAS_LONGLONG_CHANGE 33 32 34 // Provides an interface to an embedder-defined thread implementation. 33 35 // … … 43 45 44 46 virtual void postTask(Task*) = 0; 45 virtual void postDelayedTask(Task*, int64delayMs) = 0;47 virtual void postDelayedTask(Task*, long long delayMs) = 0; 46 48 47 protected: 48 ~WebThread() { } 49 virtual ~WebThread() { } 49 50 }; 50 51 -
trunk/Source/WebKit/chromium/src/CCThreadImpl.h
r93679 r93680 23 23 */ 24 24 25 #include "config.h" 25 #include "cc/CCThread.h" 26 #include <wtf/OwnPtr.h> 27 #include <wtf/Threading.h> 26 28 27 #include "CCThread.h"28 29 29 #include "LayerRendererChromium.h" 30 #include "TraceEvent.h" 31 #include <wtf/CurrentTime.h> 32 #include <wtf/PassOwnPtr.h> 33 #include <wtf/ThreadingPrimitives.h> 30 #ifndef CCThreadImpl_h 31 #define CCThreadImpl_h 34 32 35 namespace Web Core{33 namespace WebKit { 36 34 37 using namespace WTF;35 class WebThread; 38 36 39 CCThread::CCThread() 40 { 41 MutexLocker lock(m_threadCreationMutex); 42 m_threadID = createThread(CCThread::compositorThreadStart, this, "Chromium Compositor"); 43 } 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 44 45 CCThread::~CCThread() 46 { 47 m_queue.kill(); 45 private: 46 CCThreadImpl(); 48 47 49 // Stop thread. 50 void* exitCode; 51 waitForThreadCompletion(m_threadID, &exitCode); 52 m_threadID = 0; 53 } 48 OwnPtr<WebThread> m_thread; 49 WTF::ThreadIdentifier m_threadID; 50 }; 54 51 55 void CCThread::postTask(PassOwnPtr<Task> task) 56 { 57 m_queue.append(task); 58 } 52 } // namespace WebKit 59 53 60 void* CCThread::compositorThreadStart(void* userdata) 61 { 62 CCThread* ccThread = static_cast<CCThread*>(userdata); 63 return ccThread->runLoop(); 64 } 65 66 void* CCThread::runLoop() 67 { 68 TRACE_EVENT("CCThread::runLoop", this, 0); 69 { 70 // Wait for CCThread::start() to complete to have m_threadID 71 // established before starting the main loop. 72 MutexLocker lock(m_threadCreationMutex); 73 } 74 75 while (OwnPtr<Task> task = m_queue.waitForMessage()) 76 task->performTask(); 77 78 return 0; 79 } 80 81 } 54 #endif -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r93679 r93680 35 35 #include "AXObjectCache.h" 36 36 #include "BackForwardListChromium.h" 37 #include "CCThreadImpl.h" 37 38 #include "CSSStyleSelector.h" 38 39 #include "CSSValueKeywords.h" … … 2640 2641 #endif 2641 2642 2643 PassOwnPtr<CCThread> WebViewImpl::createCompositorThread() 2644 { 2645 return CCThreadImpl::create(); 2646 } 2647 2642 2648 PassRefPtr<GraphicsContext3D> WebViewImpl::createLayerTreeHostContext3D() 2643 2649 { -
trunk/Source/WebKit/chromium/src/WebViewImpl.h
r93434 r93680 217 217 // CCLayerTreeHostClient 218 218 virtual void animateAndLayout(double frameBeginTime); 219 virtual PassOwnPtr<WebCore::CCThread> createCompositorThread(); 219 220 virtual PassRefPtr<WebCore::GraphicsContext3D> createLayerTreeHostContext3D(); 220 221 virtual PassOwnPtr<WebCore::LayerPainterChromium> createRootLayerPainter(); -
trunk/Source/WebKit/chromium/tests/CCThreadTest.cpp
r92068 r93680 27 27 #include "cc/CCThread.h" 28 28 29 #include "CCThreadImpl.h" 29 30 #include "cc/CCCompletionEvent.h" 30 31 #include "cc/CCMainThreadTask.h" 31 32 #include "cc/CCThreadTask.h" 32 33 #include <gtest/gtest.h> 34 33 35 #include <webkit/support/webkit_support.h> 34 36 #include <wtf/MainThread.h> … … 52 54 TEST(CCThreadTest, pingPongUsingCondition) 53 55 { 54 OwnPtr<CCThread> thread = CCThread::create();56 OwnPtr<CCThread> thread = WebKit::CCThreadImpl::create(); 55 57 PingPongUsingCondition target; 56 58 CCCompletionEvent completion; … … 81 83 TEST(CCThreadTest, DISABLED_startPostAndWaitOnCondition) 82 84 { 83 OwnPtr<CCThread> thread = CCThread::create();85 OwnPtr<CCThread> thread = WebKit::CCThreadImpl::create(); 84 86 85 87 PingPongTestUsingTasks target;
Note: See TracChangeset
for help on using the changeset viewer.