Title: [135486] trunk/Source/WebKit2
Revision
135486
Author
[email protected]
Date
2012-11-22 00:06:22 -0800 (Thu, 22 Nov 2012)

Log Message

Coordinated Graphics: refactor LayerTreeRenderer.
https://bugs.webkit.org/show_bug.cgi?id=103004

Patch by Huang Dongsung <[email protected]> on 2012-11-22
Reviewed by Noam Rosenthal.

This patch changes two subjects.
1. Add ASSERT(isMainThread()) in all methods that are called in the main thread.
In addition, make dispatchOnMainThread() use callOnMainThread(const Function<void()>&
function) instead of its own implementation.

2. Remove setAccelerationMode() because we don't use m_accelerationMode member
except for the setter.

* UIProcess/API/efl/EwkViewImpl.cpp:
(EwkViewImpl::createGLSurface):
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
(WebKit):
(WebKit::LayerTreeRenderer::dispatchOnMainThread):
(WebKit::LayerTreeRenderer::LayerTreeRenderer):
(WebKit::LayerTreeRenderer::animationFrameReady):
(WebKit::LayerTreeRenderer::updateViewport):
(WebKit::LayerTreeRenderer::renderNextFrame):
(WebKit::LayerTreeRenderer::purgeGLResources):
(WebKit::LayerTreeRenderer::detach):
(WebKit::LayerTreeRenderer::setActive):
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
(LayerTreeRenderer):
* UIProcess/efl/PageClientBase.cpp:
(WebKit::PageClientBase::createDrawingAreaProxy):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (135485 => 135486)


--- trunk/Source/WebKit2/ChangeLog	2012-11-22 07:54:52 UTC (rev 135485)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-22 08:06:22 UTC (rev 135486)
@@ -1,3 +1,35 @@
+2012-11-22  Huang Dongsung  <[email protected]>
+
+        Coordinated Graphics: refactor LayerTreeRenderer.
+        https://bugs.webkit.org/show_bug.cgi?id=103004
+
+        Reviewed by Noam Rosenthal.
+
+        This patch changes two subjects.
+        1. Add ASSERT(isMainThread()) in all methods that are called in the main thread.
+        In addition, make dispatchOnMainThread() use callOnMainThread(const Function<void()>&
+        function) instead of its own implementation.
+
+        2. Remove setAccelerationMode() because we don't use m_accelerationMode member
+        except for the setter.
+
+        * UIProcess/API/efl/EwkViewImpl.cpp:
+        (EwkViewImpl::createGLSurface):
+        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
+        (WebKit):
+        (WebKit::LayerTreeRenderer::dispatchOnMainThread):
+        (WebKit::LayerTreeRenderer::LayerTreeRenderer):
+        (WebKit::LayerTreeRenderer::animationFrameReady):
+        (WebKit::LayerTreeRenderer::updateViewport):
+        (WebKit::LayerTreeRenderer::renderNextFrame):
+        (WebKit::LayerTreeRenderer::purgeGLResources):
+        (WebKit::LayerTreeRenderer::detach):
+        (WebKit::LayerTreeRenderer::setActive):
+        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
+        (LayerTreeRenderer):
+        * UIProcess/efl/PageClientBase.cpp:
+        (WebKit::PageClientBase::createDrawingAreaProxy):
+
 2012-11-21  Jinwoo Song  <[email protected]>
 
         [EFL][WK2] Use consistent class names in the clients

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp (135485 => 135486)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp	2012-11-22 07:54:52 UTC (rev 135485)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp	2012-11-22 08:06:22 UTC (rev 135486)
@@ -617,7 +617,6 @@
         if (!m_evasGL) {
             WARN("Failed to create Evas_GL, falling back to software mode.");
             m_isHardwareAccelerated = false;
-            layerTreeRenderer()->setAccelerationMode(TextureMapper::SoftwareMode);
 #if ENABLE(WEBGL)
             m_pageProxy->pageGroup()->preferences()->setWebGLEnabled(false);
 #endif

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp (135485 => 135486)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp	2012-11-22 07:54:52 UTC (rev 135485)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp	2012-11-22 08:06:22 UTC (rev 135486)
@@ -48,37 +48,12 @@
 
 using namespace WebCore;
 
-template<class T> class MainThreadGuardedInvoker {
-public:
-    static void call(PassRefPtr<T> objectToGuard, const Function<void()>& function)
-    {
-        MainThreadGuardedInvoker<T>* invoker = new MainThreadGuardedInvoker<T>(objectToGuard, function);
-        callOnMainThread(invoke, invoker);
-    }
-
-private:
-    MainThreadGuardedInvoker(PassRefPtr<T> object, const Function<void()>& newFunction)
-        : objectToGuard(object)
-        , function(newFunction)
-    {
-    }
-
-    RefPtr<T> objectToGuard;
-    Function<void()> function;
-    static void invoke(void* data)
-    {
-        MainThreadGuardedInvoker<T>* invoker = static_cast<MainThreadGuardedInvoker<T>*>(data);
-        invoker->function();
-        delete invoker;
-    }
-};
-
 void LayerTreeRenderer::dispatchOnMainThread(const Function<void()>& function)
 {
     if (isMainThread())
         function();
     else
-        MainThreadGuardedInvoker<LayerTreeRenderer>::call(this, function);
+        callOnMainThread(function);
 }
 
 static FloatPoint boundedScrollPosition(const FloatPoint& scrollPosition, const FloatRect& visibleContentRect, const FloatSize& contentSize)
@@ -99,10 +74,10 @@
 #if ENABLE(REQUEST_ANIMATION_FRAME)
     , m_animationFrameRequested(false)
 #endif
-    , m_accelerationMode(TextureMapper::OpenGLMode)
     , m_backgroundColor(Color::white)
     , m_setDrawsBackground(false)
 {
+    ASSERT(isMainThread());
 }
 
 LayerTreeRenderer::~LayerTreeRenderer()
@@ -171,6 +146,7 @@
 #if ENABLE(REQUEST_ANIMATION_FRAME)
 void LayerTreeRenderer::animationFrameReady()
 {
+    ASSERT(isMainThread());
     if (m_layerTreeCoordinatorProxy)
         m_layerTreeCoordinatorProxy->animationFrameReady();
 }
@@ -216,6 +192,7 @@
 
 void LayerTreeRenderer::updateViewport()
 {
+    ASSERT(isMainThread());
     if (m_layerTreeCoordinatorProxy)
         m_layerTreeCoordinatorProxy->updateViewport();
 }
@@ -573,6 +550,7 @@
 
 void LayerTreeRenderer::renderNextFrame()
 {
+    ASSERT(isMainThread());
     if (m_layerTreeCoordinatorProxy)
         m_layerTreeCoordinatorProxy->renderNextFrame();
 }
@@ -615,6 +593,7 @@
 
 void LayerTreeRenderer::purgeGLResources()
 {
+    ASSERT(isMainThread());
     TextureMapperLayer* layer = toTextureMapperLayer(rootLayer());
 
     if (layer)
@@ -634,8 +613,8 @@
     m_backingStoresWithPendingBuffers.clear();
 
     setActive(false);
-
-    dispatchOnMainThread(bind(&LayerTreeRenderer::purgeBackingStores, this));
+    if (m_layerTreeCoordinatorProxy)
+        m_layerTreeCoordinatorProxy->purgeBackingStores();
 }
 
 void LayerTreeRenderer::setLayerAnimations(WebLayerID id, const GraphicsLayerAnimations& animations)
@@ -662,14 +641,9 @@
     m_animationsLocked = locked;
 }
 
-void LayerTreeRenderer::purgeBackingStores()
-{
-    if (m_layerTreeCoordinatorProxy)
-        m_layerTreeCoordinatorProxy->purgeBackingStores();
-}
-
 void LayerTreeRenderer::detach()
 {
+    ASSERT(isMainThread());
     m_layerTreeCoordinatorProxy = 0;
 }
 
@@ -685,6 +659,7 @@
 
 void LayerTreeRenderer::setActive(bool active)
 {
+    ASSERT(isMainThread());
     if (m_isActive == active)
         return;
 

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h (135485 => 135486)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h	2012-11-22 07:54:52 UTC (rev 135485)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h	2012-11-22 08:06:22 UTC (rev 135486)
@@ -114,12 +114,6 @@
     void animationFrameReady();
 #endif
 
-    void setAccelerationMode(WebCore::TextureMapper::AccelerationMode mode)
-    {
-        // The acceleration mode is set only before TextureMapper was created.
-        ASSERT(!m_textureMapper);
-        m_accelerationMode = mode;
-    }
 private:
     PassOwnPtr<WebCore::GraphicsLayer> createLayer(WebLayerID);
 
@@ -131,7 +125,8 @@
     // Reimplementations from WebCore::GraphicsLayerClient.
     virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double) { }
     virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) { }
-    void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) { }
+    virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) OVERRIDE { }
+
     void updateViewport();
     void dispatchOnMainThread(const Function<void()>&);
     void adjustPositionForFixedLayers();
@@ -142,7 +137,6 @@
     void ensureLayer(WebLayerID);
     void commitTileOperations();
     void renderNextFrame();
-    void purgeBackingStores();
 
     PassRefPtr<CoordinatedBackingStore> getBackingStore(WebCore::GraphicsLayer*);
     void removeBackingStoreIfNeeded(WebCore::GraphicsLayer*);
@@ -182,7 +176,6 @@
 #if ENABLE(REQUEST_ANIMATION_FRAME)
     bool m_animationFrameRequested;
 #endif
-    WebCore::TextureMapper::AccelerationMode m_accelerationMode;
     WebCore::Color m_backgroundColor;
     bool m_setDrawsBackground;
 

Modified: trunk/Source/WebKit2/UIProcess/efl/PageClientBase.cpp (135485 => 135486)


--- trunk/Source/WebKit2/UIProcess/efl/PageClientBase.cpp	2012-11-22 07:54:52 UTC (rev 135485)
+++ trunk/Source/WebKit2/UIProcess/efl/PageClientBase.cpp	2012-11-22 08:06:22 UTC (rev 135486)
@@ -70,10 +70,6 @@
 PassOwnPtr<DrawingAreaProxy> PageClientBase::createDrawingAreaProxy()
 {
     OwnPtr<DrawingAreaProxy> drawingArea = DrawingAreaProxyImpl::create(m_viewImpl->page());
-#if USE(ACCELERATED_COMPOSITING)
-    if (!m_viewImpl->isHardwareAccelerated())
-        drawingArea->layerTreeCoordinatorProxy()->layerTreeRenderer()->setAccelerationMode(TextureMapper::SoftwareMode);
-#endif
     return drawingArea.release();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to