Changeset 101488 in webkit
- Timestamp:
- Nov 30, 2011 4:31:02 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 deleted
- 31 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r101486 r101488 1 2011-11-30 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r101440 and r101442. 4 http://trac.webkit.org/changeset/101440 5 http://trac.webkit.org/changeset/101442 6 https://bugs.webkit.org/show_bug.cgi?id=73429 7 8 multiple crashes on layout tests (Requested by hayato on 9 #webkit). 10 11 * platform/graphics/chromium/LayerRendererChromium.cpp: 12 (WebCore::LayerRendererChromium::initialize): 13 * platform/graphics/chromium/WebGLLayerChromium.cpp: 14 (WebCore::WebGLLayerChromium::layerRendererContext): 15 * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: 16 (WebCore::CCHeadsUpDisplay::enabled): 17 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 18 (WebCore::CCLayerTreeHost::CCLayerTreeHost): 19 (WebCore::CCLayerTreeHost::initialize): 20 (WebCore::CCLayerTreeHost::~CCLayerTreeHost): 21 (WebCore::CCLayerTreeHost::context): 22 (WebCore::CCLayerTreeHost::setNeedsAnimate): 23 (WebCore::CCLayerTreeHost::setNeedsCommit): 24 (WebCore::CCLayerTreeHost::setNeedsRedraw): 25 (WebCore::CCLayerTreeHost::composite): 26 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 27 (WebCore::CCSettings::CCSettings): 28 * platform/graphics/chromium/cc/CCProxy.cpp: 29 (WebCore::CCProxy::isMainThread): 30 (WebCore::CCProxy::isImplThread): 31 (WebCore::CCProxy::setImplThread): 32 * platform/graphics/chromium/cc/CCProxy.h: 33 * platform/graphics/chromium/cc/CCSingleThreadProxy.h: 34 (WebCore::DebugScopedSetImplThread::DebugScopedSetImplThread): 35 (WebCore::DebugScopedSetImplThread::~DebugScopedSetImplThread): 36 1 37 2011-11-30 Alexey Proskuryakov <ap@apple.com> 2 38 -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r101440 r101488 201 201 202 202 // Use the swapBuffers callback only with the threaded proxy. 203 if ( CCProxy::hasImplThread())203 if (settings().enableCompositorThread) 204 204 m_capabilities.usingSwapCompleteCallback = extensions->supports("GL_CHROMIUM_swapbuffers_complete_callback"); 205 205 if (m_capabilities.usingSwapCompleteCallback) { -
trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
r101440 r101488 163 163 // FIXME: In the threaded case, paintRenderedResultsToCanvas must be 164 164 // refactored to be asynchronous. Currently this is unimplemented. 165 if (!layerTreeHost() || CCProxy::hasImplThread())165 if (!layerTreeHost() || layerTreeHost()->settings().enableCompositorThread) 166 166 return 0; 167 167 return layerTreeHost()->context(); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
r101440 r101488 91 91 { 92 92 // FIXME: HUD does not work in compositor thread mode. 93 if ( CCProxy::hasImplThread())93 if (settings().enableCompositorThread) 94 94 return false; 95 95 return settings().showPlatformLayerTree || settings().showFPSCounter; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r101440 r101488 38 38 #include "cc/CCThreadProxy.h" 39 39 40 namespace {41 static int numLayerTreeInstances;42 }43 44 40 namespace WebCore { 45 46 bool CCLayerTreeHost::anyLayerTreeHostInstanceExists()47 {48 return numLayerTreeInstances > 0;49 }50 41 51 42 PassRefPtr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, const CCSettings& settings) … … 70 61 { 71 62 ASSERT(CCProxy::isMainThread()); 72 numLayerTreeInstances++;73 63 } 74 64 … … 76 66 { 77 67 TRACE_EVENT("CCLayerTreeHost::initialize", this, 0); 78 if ( CCProxy::hasImplThread()) {68 if (m_settings.enableCompositorThread) { 79 69 // The HUD does not work in threaded mode. Turn it off. 80 70 m_settings.showFPSCounter = false; … … 106 96 m_proxy.clear(); 107 97 clearPendingUpdate(); 108 numLayerTreeInstances--;109 98 } 110 99 … … 181 170 GraphicsContext3D* CCLayerTreeHost::context() 182 171 { 183 ASSERT(! CCProxy::hasImplThread());172 ASSERT(!m_settings.enableCompositorThread); 184 173 return m_proxy->context(); 185 174 } … … 212 201 void CCLayerTreeHost::setNeedsAnimate() 213 202 { 214 ASSERT( CCProxy::hasImplThread());203 ASSERT(m_settings.enableCompositorThread); 215 204 m_proxy->setNeedsAnimate(); 216 205 } … … 218 207 void CCLayerTreeHost::setNeedsCommit() 219 208 { 220 if ( CCThreadProxy::implThread()) {209 if (m_settings.enableCompositorThread) { 221 210 TRACE_EVENT("CCLayerTreeHost::setNeedsCommit", this, 0); 222 211 m_proxy->setNeedsCommit(); … … 227 216 void CCLayerTreeHost::setNeedsRedraw() 228 217 { 229 if ( CCThreadProxy::implThread())218 if (m_settings.enableCompositorThread) 230 219 m_proxy->setNeedsRedraw(); 231 220 else … … 307 296 void CCLayerTreeHost::composite() 308 297 { 309 ASSERT(! CCThreadProxy::implThread());298 ASSERT(!m_settings.enableCompositorThread); 310 299 static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately(); 311 300 } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r101440 r101488 73 73 , compositeOffscreen(false) 74 74 , discardAllTextures(false) 75 , enableCompositorThread(false) 75 76 , showFPSCounter(false) 76 77 , showPlatformLayerTree(false) … … 81 82 bool compositeOffscreen; 82 83 bool discardAllTextures; 84 bool enableCompositorThread; 83 85 bool showFPSCounter; 84 86 bool showPlatformLayerTree; … … 113 115 static PassRefPtr<CCLayerTreeHost> create(CCLayerTreeHostClient*, const CCSettings&); 114 116 virtual ~CCLayerTreeHost(); 115 116 // Returns true if any CCLayerTreeHost is alive.117 static bool anyLayerTreeHostInstanceExists();118 117 119 118 // CCLayerTreeHost interface to CCProxy. -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.cpp
r101440 r101488 38 38 namespace { 39 39 #ifndef NDEBUG 40 bool implThreadIsOverridden = false; 41 ThreadIdentifier threadIDOverridenToBeImplThread; 40 bool fakeImplThread = false; 42 41 #endif 43 42 CCThread* s_mainThread = 0; … … 53 52 { 54 53 return s_mainThread; 55 }56 57 bool CCProxy::hasImplThread()58 {59 return s_implThread;60 54 } 61 55 … … 74 68 { 75 69 ASSERT(s_mainThread); 76 if (implThreadIsOverridden && currentThread() == threadIDOverridenToBeImplThread) 77 return false; 78 return currentThread() == s_mainThread->threadID(); 70 return !fakeImplThread && currentThread() == s_mainThread->threadID(); 79 71 } 80 72 … … 82 74 { 83 75 WTF::ThreadIdentifier implThreadID = s_implThread ? s_implThread->threadID() : 0; 84 if (implThreadIsOverridden && currentThread() == threadIDOverridenToBeImplThread) 85 return true; 86 return currentThread() == implThreadID; 76 return fakeImplThread || currentThread() == implThreadID; 87 77 } 88 78 89 void CCProxy::set CurrentThreadIsImplThread(bool isImplThread)79 void CCProxy::setImplThread(bool isImplThread) 90 80 { 91 implThreadIsOverridden = isImplThread; 92 if (isImplThread) 93 threadIDOverridenToBeImplThread = currentThread(); 81 fakeImplThread = isImplThread; 94 82 } 95 83 #endif -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h
r101440 r101488 54 54 static CCThread* mainThread(); 55 55 56 static bool hasImplThread();57 56 static void setImplThread(CCThread*); 58 57 static CCThread* implThread(); … … 93 92 94 93 #ifndef NDEBUG 95 static void set CurrentThreadIsImplThread(bool);94 static void setImplThread(bool); 96 95 #endif 97 96 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h
r101440 r101488 92 92 { 93 93 #if !ASSERT_DISABLED 94 CCProxy::set CurrentThreadIsImplThread(true);94 CCProxy::setImplThread(true); 95 95 #endif 96 96 } … … 98 98 { 99 99 #if !ASSERT_DISABLED 100 CCProxy::set CurrentThreadIsImplThread(false);100 CCProxy::setImplThread(false); 101 101 #endif 102 102 } -
trunk/Source/WebKit/chromium/ChangeLog
r101472 r101488 1 2011-11-30 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r101440 and r101442. 4 http://trac.webkit.org/changeset/101440 5 http://trac.webkit.org/changeset/101442 6 https://bugs.webkit.org/show_bug.cgi?id=73429 7 8 multiple crashes on layout tests (Requested by hayato on 9 #webkit). 10 11 * WebKit.gyp: 12 * WebKit.gypi: 13 * public/WebCompositor.h: 14 * public/WebCompositorClient.h: 15 * public/WebCompositorInputHandler.h: Removed. 16 * public/WebCompositorInputHandlerClient.h: Removed. 17 * public/WebLayerTreeView.h: 18 (WebKit::WebLayerTreeView::Settings::Settings): 19 * public/WebSettings.h: 20 * src/WebCompositorImpl.cpp: 21 (WebCore::CCInputHandler::create): 22 (WebKit::WebCompositor::setThread): 23 (WebKit::WebCompositor::fromIdentifier): 24 (WebKit::WebCompositorImpl::fromIdentifier): 25 (WebKit::WebCompositorImpl::WebCompositorImpl): 26 (WebKit::WebCompositorImpl::~WebCompositorImpl): 27 (WebKit::WebCompositorImpl::setClient): 28 (WebKit::WebCompositorImpl::handleInputEvent): 29 (WebKit::WebCompositorImpl::identifier): 30 (WebKit::WebCompositorImpl::willDraw): 31 * src/WebCompositorImpl.h: 32 (WebKit::WebCompositorImpl::create): 33 * src/WebCompositorInputHandlerImpl.cpp: Removed. 34 * src/WebCompositorInputHandlerImpl.h: Removed. 35 * src/WebKit.cpp: 36 (WebKit::initializeWithoutV8): 37 (WebKit::shutdown): 38 * src/WebLayerTreeView.cpp: 39 (WebKit::WebLayerTreeView::Settings::operator CCSettings): 40 (WebKit::WebLayerTreeView::composite): 41 * src/WebLayerTreeViewImpl.cpp: 42 (WebKit::WebLayerTreeViewImpl::createLayerTreeHostContext3D): 43 * src/WebSettingsImpl.cpp: 44 (WebKit::WebSettingsImpl::WebSettingsImpl): 45 (WebKit::WebSettingsImpl::setUseThreadedCompositor): 46 * src/WebSettingsImpl.h: 47 (WebKit::WebSettingsImpl::useThreadedCompositor): 48 * src/WebViewImpl.cpp: 49 (WebKit::WebViewImpl::animate): 50 (WebKit::WebViewImpl::composite): 51 (WebKit::WebViewImpl::scheduleAnimation): 52 (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): 53 (WebKit::WebViewImpl::createLayerTreeHostContext3D): 54 (WebKit::WebViewImpl::scheduleComposite): 55 (WebKit::WebViewImpl::graphicsContext3D): 56 * tests/CCLayerTreeHostTest.cpp: 57 (WTF::CCLayerTreeHostTest::CCLayerTreeHostTest): 58 (WTF::CCLayerTreeHostTest::onEndTest): 59 (WTF::CCLayerTreeHostTest::runTest): 60 (WTF::CCLayerTreeHostTest::doBeginTest): 61 (WTF::CCLayerTreeHostTestShortlived1::beginTest): 62 (WTF::CCLayerTreeHostTestShortlived2::beginTest): 63 (WTF::CCLayerTreeHostTestShortlived3::beginTest): 64 (WTF::CCLayerTreeHostTestCommitingWithContinuousRedraw::beginTest): 65 (WTF::CCLayerTreeHostTestOpacityChange::afterTest): 66 * tests/WebCompositorImplTest.cpp: Renamed from Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp. 67 1 68 2011-11-30 Daniel Sievers <sievers@chromium.org> 2 69 -
trunk/Source/WebKit/chromium/WebKit.gyp
r101464 r101488 137 137 'public/WebCompositorClient.h', 138 138 'public/WebCompositor.h', 139 'public/WebCompositorInputHandlerClient.h',140 'public/WebCompositorInputHandler.h',141 139 'public/WebConsoleMessage.h', 142 140 'public/WebContentLayer.h', … … 476 474 'src/WebCompositorImpl.cpp', 477 475 'src/WebCompositorImpl.h', 478 'src/WebCompositorInputHandlerImpl.cpp',479 'src/WebCompositorInputHandlerImpl.h',480 476 'src/WebContentLayer.cpp', 481 477 'src/WebContentLayerImpl.cpp', -
trunk/Source/WebKit/chromium/WebKit.gypi
r101440 r101488 90 90 'tests/TreeTestHelpers.cpp', 91 91 'tests/TreeTestHelpers.h', 92 'tests/WebCompositorI nputHandlerImplTest.cpp',92 'tests/WebCompositorImplTest.cpp', 93 93 'tests/WebFrameTest.cpp', 94 94 'tests/WebLayerTest.cpp', -
trunk/Source/WebKit/chromium/public/WebCompositor.h
r101440 r101488 28 28 29 29 #include "platform/WebCommon.h" 30 #include "WebCompositorInputHandler.h"31 30 32 31 namespace WebKit { 33 32 33 class WebCompositorClient; 34 34 class WebInputEvent; 35 35 class WebThread; 36 36 37 #define WEBCOMPOSITOR_HAS_INITIALIZE 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 { 40 public: 41 // This must be called once with a non-null WebThread before any compositors attempt to initialize. 42 WEBKIT_EXPORT static void setThread(WebThread*); 43 WEBKIT_EXPORT static WebCompositor* fromIdentifier(int); 38 44 39 // This class contains global routines for interacting with the 40 // compositor. 41 // 42 // All calls to the WebCompositor must be made from the main thread. 43 // 44 // This class currently temporarily inherits from WebCompositorInputHandler 45 // while we migrate downstream code to use WebCompositorInputHandler directly. 46 class WebCompositor : public WebCompositorInputHandler { 47 public: 48 // Initializes the compositor. Threaded compositing is enabled by passing in 49 // a non-null WebThread. No compositor classes or methods should be used 50 // prior to calling initialize. 51 WEBKIT_EXPORT static void initialize(WebThread*); 52 53 // Shuts down the compositor. This must be called when all compositor data 54 // types have been deleted. No compositor classes or methods should be used 55 // after shutdown. 56 WEBKIT_EXPORT static void shutdown(); 45 virtual void setClient(WebCompositorClient*) = 0; 46 virtual void handleInputEvent(const WebInputEvent&) = 0; 57 47 58 48 protected: -
trunk/Source/WebKit/chromium/public/WebCompositorClient.h
r101440 r101488 27 27 #define WebCompositorClient_h 28 28 29 #include "WebCompositorInputHandlerClient.h"30 31 29 namespace WebKit { 32 30 33 // This class will go away once downstream code has transitioned 34 // to WebCompositorInputHandlerClient. 35 class WebCompositorClient : public WebCompositorInputHandlerClient { 31 class WebCompositorClient { 36 32 public: 33 // Callbacks invoked from the compositor thread. 34 virtual void willShutdown() = 0; 35 36 // Exactly one of the following two callbacks will be invoked after every call to WebCompositor::handleInputEvent(): 37 38 // Called when the WebCompositor handled the input event and no further processing is required. 39 virtual void didHandleInputEvent() = 0; 40 41 // Called when the WebCompositor did not handle the input event. If sendToWidget is true, the input event 42 // should be forwarded to the WebWidget associated with this compositor for further processing. 43 virtual void didNotHandleInputEvent(bool sendToWidget) = 0; 44 37 45 protected: 38 46 virtual ~WebCompositorClient() { } -
trunk/Source/WebKit/chromium/public/WebLayerTreeView.h
r101440 r101488 47 47 : acceleratePainting(false) 48 48 , compositeOffscreen(false) 49 , enableCompositorThread(false) 49 50 , showFPSCounter(false) 50 51 , showPlatformLayerTree(false) { } … … 52 53 bool acceleratePainting; 53 54 bool compositeOffscreen; 55 bool enableCompositorThread; 54 56 bool showFPSCounter; 55 57 bool showPlatformLayerTree; … … 73 75 WEBKIT_EXPORT bool equals(const WebLayerTreeView&) const; 74 76 75 // Triggers a compositing pass. If the compositor thread was not76 // enabled via WebCompositor::initialize, the compositing pass happens77 // Triggers a compositing pass. If the compositor thread is disabled 78 // (enableCompositorThread == false), the compositing pass happens 77 79 // immediately. If it is enabled, the compositing pass will happen at a 78 80 // later time. Before the compositing pass happens (i.e. before composite() -
trunk/Source/WebKit/chromium/public/WebSettings.h
r101440 r101488 118 118 virtual void setMinimumAccelerated2dCanvasSize(int) = 0; 119 119 virtual void setAcceleratedDrawingEnabled(bool) = 0; 120 virtual void setUseThreadedCompositor(bool) = 0; 121 virtual bool useThreadedCompositor() const = 0; 120 122 virtual void setMemoryInfoEnabled(bool) = 0; 121 123 virtual void setHyperlinkAuditingEnabled(bool) = 0; -
trunk/Source/WebKit/chromium/src/WebCompositorImpl.cpp
r101442 r101488 29 29 30 30 #include "CCThreadImpl.h" 31 #include "WebKit.h"32 #include "WebKitPlatformSupport.h"33 31 #include "WebCompositorClient.h" 34 32 #include "WebInputEvent.h" 35 #include "cc/CC Proxy.h"36 #include "cc/CC LayerTreeHost.h"33 #include "cc/CCInputHandler.h" 34 #include "cc/CCThreadProxy.h" 37 35 #include <wtf/ThreadingPrimitives.h> 38 36 39 37 using namespace WebCore; 40 38 41 namespace Web Kit{39 namespace WebCore { 42 40 43 bool WebCompositorImpl::s_initialized = false; 44 CCThread* WebCompositorImpl::s_mainThread = 0; 45 CCThread* WebCompositorImpl::s_implThread = 0; 46 47 void WebCompositor::initialize(WebThread* implThread) 41 PassOwnPtr<CCInputHandler> CCInputHandler::create(CCInputHandlerClient* inputHandlerClient) 48 42 { 49 WebCompositorImpl::initialize(implThread); 50 } 51 void WebCompositor::shutdown() 52 { 53 WebCompositorImpl::shutdown(); 54 } 55 56 void WebCompositorImpl::initialize(WebThread* implThread) 57 { 58 ASSERT(!s_initialized); 59 s_initialized = true; 60 61 s_mainThread = CCThreadImpl::create(webKitPlatformSupport()->currentThread()).leakPtr(); 62 CCProxy::setMainThread(s_mainThread); 63 if (implThread) { 64 s_implThread = CCThreadImpl::create(implThread).leakPtr(); 65 CCProxy::setImplThread(s_implThread); 66 } else 67 CCProxy::setImplThread(0); 68 } 69 70 bool WebCompositorImpl::initialized() 71 { 72 return s_initialized; 73 } 74 75 void WebCompositorImpl::shutdown() 76 { 77 ASSERT(s_initialized); 78 ASSERT(!CCLayerTreeHost::anyLayerTreeHostInstanceExists()); 79 80 if (s_implThread) { 81 delete s_implThread; 82 s_implThread = 0; 83 } 84 delete s_mainThread; 85 s_mainThread = 0; 86 CCProxy::setImplThread(0); 87 CCProxy::setMainThread(0); 88 s_initialized = false; 43 return WebKit::WebCompositorImpl::create(inputHandlerClient); 89 44 } 90 45 91 46 } 47 48 namespace WebKit { 49 50 void WebCompositor::setThread(WebThread* compositorThread) 51 { 52 ASSERT(compositorThread); 53 CCThreadProxy::setImplThread(CCThreadImpl::create(compositorThread).leakPtr()); 54 } 55 56 57 // These statics may only be accessed from the compositor thread. 58 int WebCompositorImpl::s_nextAvailableIdentifier = 1; 59 HashSet<WebCompositorImpl*>* WebCompositorImpl::s_compositors = 0; 60 61 WebCompositor* WebCompositor::fromIdentifier(int identifier) 62 { 63 ASSERT(CCProxy::isImplThread()); 64 return WebCompositorImpl::fromIdentifier(identifier); 65 } 66 67 WebCompositor* WebCompositorImpl::fromIdentifier(int identifier) 68 { 69 ASSERT(CCProxy::isImplThread()); 70 71 if (!s_compositors) 72 return 0; 73 74 for (HashSet<WebCompositorImpl*>::iterator it = s_compositors->begin(); it != s_compositors->end(); ++it) { 75 if ((*it)->identifier() == identifier) 76 return *it; 77 } 78 return 0; 79 } 80 81 WebCompositorImpl::WebCompositorImpl(CCInputHandlerClient* inputHandlerClient) 82 : m_client(0) 83 , m_identifier(s_nextAvailableIdentifier++) 84 , m_inputHandlerClient(inputHandlerClient) 85 { 86 ASSERT(CCProxy::isImplThread()); 87 88 if (!s_compositors) 89 s_compositors = new HashSet<WebCompositorImpl*>; 90 s_compositors->add(this); 91 } 92 93 WebCompositorImpl::~WebCompositorImpl() 94 { 95 ASSERT(CCProxy::isImplThread()); 96 if (m_client) 97 m_client->willShutdown(); 98 99 ASSERT(s_compositors); 100 s_compositors->remove(this); 101 if (!s_compositors->size()) { 102 delete s_compositors; 103 s_compositors = 0; 104 } 105 } 106 107 void WebCompositorImpl::setClient(WebCompositorClient* client) 108 { 109 ASSERT(CCProxy::isImplThread()); 110 // 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. 111 ASSERT(!m_client || !client); 112 m_client = client; 113 } 114 115 void WebCompositorImpl::handleInputEvent(const WebInputEvent& event) 116 { 117 ASSERT(CCProxy::isImplThread()); 118 ASSERT(m_client); 119 120 if (event.type == WebInputEvent::MouseWheel && !m_inputHandlerClient->haveWheelEventHandlers()) { 121 const WebMouseWheelEvent& wheelEvent = *static_cast<const WebMouseWheelEvent*>(&event); 122 m_inputHandlerClient->scrollRootLayer(IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY)); 123 m_client->didHandleInputEvent(); 124 return; 125 } 126 m_client->didNotHandleInputEvent(true /* sendToWidget */); 127 } 128 129 int WebCompositorImpl::identifier() const 130 { 131 ASSERT(CCProxy::isImplThread()); 132 return m_identifier; 133 } 134 135 void WebCompositorImpl::willDraw(double frameBeginTimeMs) 136 { 137 } 138 139 } -
trunk/Source/WebKit/chromium/src/WebCompositorImpl.h
r101442 r101488 29 29 #include "WebCompositor.h" 30 30 31 #include "cc/CCInputHandler.h" 31 32 #include <wtf/HashSet.h> 32 33 #include <wtf/Noncopyable.h> 33 #include <wtf/ OwnPtr.h>34 #include <wtf/PassOwnPtr.h> 34 35 35 namespace W ebCore{36 class CCThread;36 namespace WTF { 37 class Mutex; 37 38 } 38 39 39 40 namespace WebKit { 40 41 41 class Web Thread;42 class WebCompositorClient; 42 43 43 class WebCompositorImpl : public WebCompositor {44 class WebCompositorImpl : public WebCompositor, public WebCore::CCInputHandler { 44 45 WTF_MAKE_NONCOPYABLE(WebCompositorImpl); 45 46 public: 46 static bool initialized(); 47 static WebCompositor* fromIdentifier(int identifier); 48 49 static PassOwnPtr<WebCompositorImpl> create(WebCore::CCInputHandlerClient* client) 50 { 51 return adoptPtr(new WebCompositorImpl(client)); 52 } 53 54 virtual ~WebCompositorImpl(); 55 56 // WebCompositor implementation 57 virtual void setClient(WebCompositorClient*); 58 virtual void handleInputEvent(const WebInputEvent&); 59 60 // WebCore::CCInputHandler implementation 61 virtual int identifier() const; 62 virtual void willDraw(double frameBeginTime); 47 63 48 64 private: 65 explicit WebCompositorImpl(WebCore::CCInputHandlerClient*); 49 66 50 friend class WebCompositor;51 static void initialize(WebThread* implThread);52 static void shutdown();67 WebCompositorClient* m_client; 68 int m_identifier; 69 WebCore::CCInputHandlerClient* m_inputHandlerClient; 53 70 54 static bool s_initialized; 55 static WebCore::CCThread* s_mainThread; 56 static WebCore::CCThread* s_implThread; 71 static int s_nextAvailableIdentifier; 72 static HashSet<WebCompositorImpl*>* s_compositors; 57 73 }; 58 74 -
trunk/Source/WebKit/chromium/src/WebKit.cpp
r101440 r101488 32 32 #include "WebKit.h" 33 33 34 #include "CCThreadImpl.h" 35 #include "cc/CCProxy.h" 34 36 #include "Logging.h" 35 37 #include "Page.h" … … 97 99 // this, initializing this lazily probably doesn't buy us much. 98 100 WebCore::UTF8Encoding(); 101 102 WebCore::CCProxy::setMainThread(CCThreadImpl::create(webKitPlatformSupport->currentThread()).leakPtr()); 99 103 } 100 104 … … 102 106 void shutdown() 103 107 { 108 delete WebCore::CCProxy::mainThread(); 109 WebCore::CCProxy::setMainThread(0); 104 110 s_webKitPlatformSupport = 0; 105 111 } -
trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp
r101440 r101488 40 40 settings.acceleratePainting = acceleratePainting; 41 41 settings.compositeOffscreen = compositeOffscreen; 42 settings.enableCompositorThread = enableCompositorThread; 42 43 settings.showFPSCounter = showFPSCounter; 43 44 settings.showPlatformLayerTree = showPlatformLayerTree; 44 45 // FIXME: showFPSCounter / showPlatformLayerTree aren't supported currently.46 settings.showFPSCounter = false;47 settings.showPlatformLayerTree = false;48 45 return settings; 49 46 } … … 71 68 void WebLayerTreeView::composite() 72 69 { 73 if ( CCProxy::hasImplThread())70 if (m_private->settings().enableCompositorThread) 74 71 m_private->setNeedsCommit(); 75 72 else -
trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
r101440 r101488 36 36 #include "WebSize.h" 37 37 #include "WebThread.h" 38 #include "cc/CCThreadProxy.h"39 38 40 39 using namespace WebCore; … … 94 93 95 94 GraphicsContext3D::RenderStyle style = GraphicsContext3D::RenderDirectlyToHostWindow; 96 GraphicsContext3DPrivate::ThreadUsage usage = CCProxy::hasImplThread()? GraphicsContext3DPrivate::ForUseOnAnotherThread : GraphicsContext3DPrivate::ForUseOnThisThread;95 GraphicsContext3DPrivate::ThreadUsage usage = settings().enableCompositorThread ? GraphicsContext3DPrivate::ForUseOnAnotherThread : GraphicsContext3DPrivate::ForUseOnThisThread; 97 96 return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), attributes, 0, style, usage); 98 97 } -
trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp
r101440 r101488 51 51 , m_showFPSCounter(false) 52 52 , m_showPlatformLayerTree(false) 53 , m_useThreadedCompositor(false) 53 54 { 54 55 ASSERT(settings); … … 379 380 } 380 381 382 void WebSettingsImpl::setUseThreadedCompositor(bool useThreadedCompositor) 383 { 384 m_useThreadedCompositor = useThreadedCompositor; 385 } 386 381 387 void WebSettingsImpl::setMemoryInfoEnabled(bool enabled) 382 388 { -
trunk/Source/WebKit/chromium/src/WebSettingsImpl.h
r101440 r101488 110 110 virtual void setMinimumAccelerated2dCanvasSize(int); 111 111 virtual void setAcceleratedDrawingEnabled(bool); 112 virtual void setUseThreadedCompositor(bool); 113 virtual bool useThreadedCompositor() const { return m_useThreadedCompositor; } 112 114 virtual void setMemoryInfoEnabled(bool); 113 115 virtual void setHyperlinkAuditingEnabled(bool); … … 131 133 bool m_showFPSCounter; 132 134 bool m_showPlatformLayerTree; 135 bool m_useThreadedCompositor; 133 136 }; 134 137 -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r101440 r101488 135 135 #include "WebVector.h" 136 136 #include "WebViewClient.h" 137 #include "cc/CC Proxy.h"137 #include "cc/CCHeadsUpDisplay.h" 138 138 #include <wtf/ByteArray.h> 139 139 #include <wtf/CurrentTime.h> … … 1143 1143 FrameView* view = webframe->frameView(); 1144 1144 if (view) { 1145 if (! CCProxy::hasImplThread() && m_layerTreeHost)1145 if (!settings()->useThreadedCompositor() && m_layerTreeHost) 1146 1146 m_layerTreeHost->setAnimating(true); 1147 1147 1148 1148 view->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(frameBeginTime)); 1149 1149 1150 if (! CCProxy::hasImplThread() && m_layerTreeHost)1150 if (!settings()->useThreadedCompositor() && m_layerTreeHost) 1151 1151 m_layerTreeHost->setAnimating(false); 1152 1152 } … … 1250 1250 { 1251 1251 #if USE(ACCELERATED_COMPOSITING) 1252 if ( CCProxy::hasImplThread())1252 if (settings()->useThreadedCompositor()) 1253 1253 m_layerTreeHost->setNeedsRedraw(); 1254 1254 else { … … 2776 2776 { 2777 2777 if (isAcceleratedCompositingActive()) { 2778 if ( CCProxy::hasImplThread()) {2778 if (settings()->useThreadedCompositor()) { 2779 2779 ASSERT(m_layerTreeHost); 2780 2780 m_layerTreeHost->setNeedsAnimate(); … … 2847 2847 ccSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled(); 2848 2848 ccSettings.compositeOffscreen = settings()->compositeToTextureEnabled(); 2849 ccSettings.enableCompositorThread = settings()->useThreadedCompositor(); 2849 2850 ccSettings.showFPSCounter = settings()->showFPSCounter(); 2850 2851 ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree(); … … 2883 2884 RefPtr<GraphicsContext3D> context = m_temporaryOnscreenGraphicsContext3D.release(); 2884 2885 if (!context) { 2885 if ( CCProxy::hasImplThread())2886 if (settings()->useThreadedCompositor()) 2886 2887 context = GraphicsContext3DPrivate::createGraphicsContextForAnotherThread(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow); 2887 2888 else … … 2951 2952 void WebViewImpl::scheduleComposite() 2952 2953 { 2953 ASSERT(! CCProxy::hasImplThread());2954 ASSERT(!settings()->useThreadedCompositor()); 2954 2955 m_client->scheduleComposite(); 2955 2956 } … … 2983 2984 return webContext; 2984 2985 } 2985 if ( CCProxy::hasImplThread())2986 if (settings()->useThreadedCompositor()) 2986 2987 m_temporaryOnscreenGraphicsContext3D = GraphicsContext3DPrivate::createGraphicsContextForAnotherThread(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow); 2987 2988 else … … 2993 2994 return 0; 2994 2995 } 2996 2995 2997 2996 2998 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r101440 r101488 250 250 : m_beginning(false) 251 251 , m_endWhenBeginReturns(false) 252 , m_timedOut(false) { } 252 , m_timedOut(false) 253 { 254 m_webThread = adoptPtr(webKitPlatformSupport()->createThread("CCLayerTreeHostTest")); 255 ASSERT(CCProxy::mainThread()); 256 257 WebCompositor::setThread(m_webThread.get()); 258 ASSERT(CCProxy::isMainThread()); 259 m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread()); 260 } 253 261 254 262 void doBeginTest(); … … 264 272 webkit_support::QuitMessageLoop(); 265 273 webkit_support::RunAllPendingMessages(); 274 CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); 275 ASSERT_TRUE(test); 276 test->m_layerTreeHost.clear(); 266 277 } 267 278 … … 352 363 virtual void runTest(bool threaded) 353 364 { 365 m_settings.enableCompositorThread = threaded; 354 366 m_settings.refreshRate = 100.0; 355 356 if (threaded) {357 m_webThread = adoptPtr(webKitPlatformSupport()->createThread("CCLayerTreeHostTest"));358 WebCompositor::initialize(m_webThread.get());359 } else360 WebCompositor::initialize(0);361 362 ASSERT(CCProxy::isMainThread());363 m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread());364 365 367 webkit_support::PostDelayedTask(CCLayerTreeHostTest::onBeginTest, static_cast<void*>(this), 0); 366 368 m_timeoutTask = new TimeoutTask(this); … … 369 371 webkit_support::RunAllPendingMessages(); 370 372 371 if (m_layerTreeHost && m_layerTreeHost->rootLayer())372 m_layerTreeHost->rootLayer()->setLayerTreeHost(0);373 m_layerTreeHost.clear();374 375 373 if (m_timeoutTask) 376 374 m_timeoutTask->clearTest(); … … 380 378 if (m_timedOut) { 381 379 FAIL() << "Test timed out"; 382 WebCompositor::shutdown();383 380 return; 384 381 } 382 m_rootLayer->setLayerTreeHost(0); 385 383 afterTest(); 386 WebCompositor::shutdown();387 384 } 388 385 … … 396 393 bool m_timedOut; 397 394 395 RefPtr<LayerChromium> m_rootLayer; 398 396 OwnPtr<WebThread> m_webThread; 399 397 RefPtr<CCScopedThreadProxy> m_mainThreadProxy; … … 406 404 m_client = MockLayerTreeHostClient::create(this); 407 405 408 RefPtr<LayerChromium>rootLayer = LayerChromium::create(0);409 m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings);406 m_rootLayer = LayerChromium::create(0); 407 m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), m_rootLayer, m_settings); 410 408 ASSERT_TRUE(m_layerTreeHost); 411 rootLayer->setLayerTreeHost(m_layerTreeHost.get());409 m_rootLayer->setLayerTreeHost(m_layerTreeHost.get()); 412 410 413 411 m_beginning = true; … … 448 446 virtual void beginTest() 449 447 { 450 // Kill the layerTreeHost immediately.451 m_layerTreeHost->rootLayer()->setLayerTreeHost(0);452 m_layerTreeHost.clear();453 454 448 endTest(); 455 449 } … … 480 474 { 481 475 postSetNeedsCommitToMainThread(); 482 483 // Kill the layerTreeHost immediately.484 m_layerTreeHost->rootLayer()->setLayerTreeHost(0);485 m_layerTreeHost.clear();486 487 476 endTest(); 488 477 } … … 503 492 { 504 493 postSetNeedsRedrawToMainThread(); 505 506 // Kill the layerTreeHost immediately.507 m_layerTreeHost->rootLayer()->setLayerTreeHost(0);508 m_layerTreeHost.clear();509 510 494 endTest(); 511 495 } … … 518 502 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestShortlived3) 519 503 520 // Test interleaving of redraws and commits521 class CCLayerTreeHostTestCommitingWithContinuousRedraw : public CCLayerTreeHostTest ThreadOnly{504 // Constantly redrawing layerTreeHosts shouldn't die when they commit 505 class CCLayerTreeHostTestCommitingWithContinuousRedraw : public CCLayerTreeHostTest { 522 506 public: 523 507 CCLayerTreeHostTestCommitingWithContinuousRedraw() … … 530 514 { 531 515 postSetNeedsCommitToMainThread(); 516 endTest(); 532 517 } 533 518 … … 556 541 }; 557 542 558 TEST_F(CCLayerTreeHostTestCommitingWithContinuousRedraw, runMultiThread) 559 { 560 runTestThreaded(); 561 } 543 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestCommitingWithContinuousRedraw) 562 544 563 545 // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1 … … 1010 992 EXPECT_EQ(m_updateCheckLayer->paintContentsCount(), 1011 993 m_updateCheckLayer->updateCount()); 1012 1013 // clear m_updateCheckLayer so CCLayerTreeHost dies.1014 m_updateCheckLayer.clear();1015 994 } 1016 995 -
trunk/Source/WebKit/chromium/tests/WebCompositorImplTest.cpp
r101487 r101488 26 26 #include "config.h" 27 27 28 #include "WebCompositorI nputHandlerImpl.h"28 #include "WebCompositorImpl.h" 29 29 30 #include "WebCompositor.h"31 30 #include "cc/CCSingleThreadProxy.h" 32 31 … … 34 33 #include <wtf/OwnPtr.h> 35 34 36 using WebKit::WebCompositor InputHandler;37 using WebKit::WebCompositorI nputHandlerImpl;35 using WebKit::WebCompositor; 36 using WebKit::WebCompositorImpl; 38 37 39 38 namespace { 40 39 41 TEST(WebCompositorI nputHandlerImpl, fromIdentifier)40 TEST(WebCompositorImpl, fromIdentifier) 42 41 { 43 WebKit::WebCompositor::initialize(0);44 42 #ifndef NDEBUG 45 // WebCompositor InputHandlerAPIs can only be called from the compositor thread.43 // WebCompositor APIs can only be called from the compositor thread. 46 44 WebCore::DebugScopedSetImplThread alwaysImplThread; 47 45 #endif 48 46 49 // Before creating any WebCompositor InputHandlers, lookups for any value should fail and not crash.50 EXPECT_EQ(0, WebCompositor InputHandler::fromIdentifier(2));51 EXPECT_EQ(0, WebCompositor InputHandler::fromIdentifier(0));52 EXPECT_EQ(0, WebCompositor InputHandler::fromIdentifier(-1));47 // Before creating any WebCompositors, lookups for any value should fail and not crash. 48 EXPECT_EQ(0, WebCompositor::fromIdentifier(2)); 49 EXPECT_EQ(0, WebCompositor::fromIdentifier(0)); 50 EXPECT_EQ(0, WebCompositor::fromIdentifier(-1)); 53 51 54 52 int compositorIdentifier = -1; 55 53 { 56 OwnPtr<WebCompositorI nputHandlerImpl> comp = WebCompositorInputHandlerImpl::create(0);54 OwnPtr<WebCompositorImpl> comp = WebCompositorImpl::create(0); 57 55 compositorIdentifier = comp->identifier(); 58 56 // The compositor we just created should be locatable. 59 EXPECT_EQ(comp.get(), WebCompositor InputHandler::fromIdentifier(compositorIdentifier));57 EXPECT_EQ(comp.get(), WebCompositor::fromIdentifier(compositorIdentifier)); 60 58 61 59 // But nothing else. 62 EXPECT_EQ(0, WebCompositor InputHandler::fromIdentifier(comp->identifier() + 10));60 EXPECT_EQ(0, WebCompositor::fromIdentifier(comp->identifier() + 10)); 63 61 } 64 62 65 63 // After the compositor is destroyed, its entry should be removed from the map. 66 EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(compositorIdentifier)); 67 68 WebKit::WebCompositor::shutdown(); 64 EXPECT_EQ(0, WebCompositor::fromIdentifier(compositorIdentifier)); 69 65 } 70 66 -
trunk/Tools/ChangeLog
r101464 r101488 1 2011-11-30 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r101440 and r101442. 4 http://trac.webkit.org/changeset/101440 5 http://trac.webkit.org/changeset/101442 6 https://bugs.webkit.org/show_bug.cgi?id=73429 7 8 multiple crashes on layout tests (Requested by hayato on 9 #webkit). 10 11 * DumpRenderTree/chromium/TestShell.cpp: 12 (TestShell::resetWebSettings): 13 * DumpRenderTree/chromium/TestShell.h: 14 * DumpRenderTree/chromium/WebPreferences.cpp: 15 (WebPreferences::reset): 16 (WebPreferences::applyTo): 17 * DumpRenderTree/chromium/WebPreferences.h: 18 * DumpRenderTree/chromium/WebViewHost.cpp: 19 (WebViewHost::WebViewHost): 20 (WebViewHost::~WebViewHost): 21 1 22 2011-11-30 Fady Samuel <fsamuel@chromium.org> 2 23 -
trunk/Tools/DumpRenderTree/chromium/TestShell.cpp
r101440 r101488 202 202 m_prefs.acceleratedCompositingEnabled = true; 203 203 m_prefs.acceleratedCompositingForVideoEnabled = m_acceleratedCompositingForVideoEnabled; 204 m_prefs.threadedCompositingEnabled = m_threadedCompositingEnabled; 204 205 m_prefs.compositeToTexture = m_compositeToTexture; 205 206 m_prefs.forceCompositingMode = m_forceCompositingMode; -
trunk/Tools/DumpRenderTree/chromium/TestShell.h
r101440 r101488 133 133 void setAcceleratedCompositingForVideoEnabled(bool enabled) { m_acceleratedCompositingForVideoEnabled = enabled; } 134 134 void setThreadedCompositingEnabled(bool enabled) { m_threadedCompositingEnabled = enabled; } 135 bool threadedCompositingEnabled() const { return m_threadedCompositingEnabled; }136 135 void setCompositeToTexture(bool enabled) { m_compositeToTexture = enabled; } 137 136 void setForceCompositingMode(bool enabled) { m_forceCompositingMode = enabled; } -
trunk/Tools/DumpRenderTree/chromium/WebPreferences.cpp
r101440 r101488 110 110 acceleratedCompositingForVideoEnabled = false; 111 111 acceleratedCompositingEnabled = false; 112 threadedCompositingEnabled = false; 112 113 compositeToTexture = false; 113 114 accelerated2dCanvasEnabled = false; … … 213 214 settings->setAcceleratedCompositingEnabled(acceleratedCompositingEnabled); 214 215 settings->setAcceleratedCompositingForVideoEnabled(acceleratedCompositingForVideoEnabled); 216 settings->setUseThreadedCompositor(threadedCompositingEnabled); 215 217 settings->setCompositeToTextureEnabled(compositeToTexture); 216 218 settings->setForceCompositingMode(forceCompositingMode); -
trunk/Tools/DumpRenderTree/chromium/WebPreferences.h
r101440 r101488 103 103 bool acceleratedCompositingForVideoEnabled; 104 104 bool acceleratedCompositingEnabled; 105 bool threadedCompositingEnabled; 105 106 bool compositeToTexture; 106 107 bool forceCompositingMode; -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp
r101440 r101488 1212 1212 WTF::initializeThreading(); 1213 1213 1214 if (shell->threadedCompositingEnabled()) { 1215 m_compositorThread = adoptPtr(WebKit::webKitPlatformSupport()->createThread("Compositor")); 1216 WebCompositor::initialize(m_compositorThread.get()); 1217 } else 1218 WebCompositor::initialize(0); 1214 m_compositorThread = adoptPtr(WebKit::webKitPlatformSupport()->createThread("Compositor")); 1215 WebCompositor::setThread(m_compositorThread.get()); 1219 1216 1220 1217 reset(); … … 1238 1235 if (m_inModalLoop) 1239 1236 webkit_support::QuitMessageLoop(); 1240 1241 WebCompositor::shutdown();1242 1237 } 1243 1238
Note: See TracChangeset
for help on using the changeset viewer.