2011-01-14 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jan 2011 23:45:17 +0000 (23:45 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jan 2011 23:45:17 +0000 (23:45 +0000)
        Reviewed by Adam Roben.

        Layer syncing should go through the compositor
        https://bugs.webkit.org/show_bug.cgi?id=52486

        Rather than have FrameView go directly to GraphicsLayer to
        sync pending changes, route the call through RenderLayerCompositor.

        Add a FIXME about an existing issue with flushing and subframes.

        No behavior change, so no tests.

        * page/FrameView.cpp:
        (WebCore::FrameView::syncCompositingStateForThisFrame):
        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::notifySyncRequired):
        * rendering/RenderLayerCompositor.cpp:
        (WebCore::RenderLayerCompositor::scheduleLayerFlush):
        (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
        * rendering/RenderLayerCompositor.h:
        (WebCore::RenderLayerCompositor::notifySyncRequired):

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

Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderLayerCompositor.h

index f861555..cad8d21 100644 (file)
@@ -1,3 +1,27 @@
+2011-01-14  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Adam Roben.
+
+        Layer syncing should go through the compositor
+        https://bugs.webkit.org/show_bug.cgi?id=52486
+
+        Rather than have FrameView go directly to GraphicsLayer to
+        sync pending changes, route the call through RenderLayerCompositor.
+        
+        Add a FIXME about an existing issue with flushing and subframes.
+        
+        No behavior change, so no tests.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::syncCompositingStateForThisFrame):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::notifySyncRequired):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::scheduleLayerFlush):
+        (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
+        * rendering/RenderLayerCompositor.h:
+        (WebCore::RenderLayerCompositor::notifySyncRequired):
+
 2011-01-14  Abhishek Arya  <inferno@chromium.org>
 
         Reviewed by David Hyatt.
index 2c42ab4..1187318 100644 (file)
@@ -556,12 +556,8 @@ void FrameView::updateCompositingLayers()
 
 void FrameView::syncCompositingStateForThisFrame()
 {
-    RenderView* view = m_frame->contentRenderer();
-    GraphicsLayer* rootLayer = view ? view->compositor()->rootPlatformLayer() : 0;
-    if (!rootLayer)
-        return;
-
-    rootLayer->syncCompositingState();
+    if (RenderView* view = m_frame->contentRenderer())
+        view->compositor()->flushPendingLayerChanges();
 
 #if ENABLE(FULLSCREEN_API)
     // The fullScreenRenderer's graphicsLayer  has been re-parented, and the above recursive syncCompositingState
index e4b2f45..a6ed20f 100644 (file)
@@ -1264,7 +1264,7 @@ void RenderLayerBacking::notifyAnimationStarted(const GraphicsLayer*, double tim
 void RenderLayerBacking::notifySyncRequired(const GraphicsLayer*)
 {
     if (!renderer()->documentBeingDestroyed())
-        compositor()->scheduleSync();
+        compositor()->scheduleLayerFlush();
 }
 
 // This is used for the 'freeze' API, for testing only.
index 931008d..2155b35 100644 (file)
@@ -170,7 +170,7 @@ void RenderLayerCompositor::setCompositingLayersNeedRebuild(bool needRebuild)
         m_compositingLayersNeedRebuild = needRebuild;
 }
 
-void RenderLayerCompositor::scheduleSync()
+void RenderLayerCompositor::scheduleLayerFlush()
 {
     Frame* frame = m_renderView->frameView()->frame();
     Page* page = frame ? frame->page() : 0;
@@ -180,6 +180,16 @@ void RenderLayerCompositor::scheduleSync()
     page->chrome()->client()->scheduleCompositingLayerSync();
 }
 
+void RenderLayerCompositor::flushPendingLayerChanges()
+{
+    // FIXME: FrameView::syncCompositingStateRecursive() calls this for each
+    // frame, so when compositing layers are connected between frames, we'll
+    // end up syncing subframe's layers multiple times.
+    // https://bugs.webkit.org/show_bug.cgi?id=52489
+    if (GraphicsLayer* rootLayer = rootPlatformLayer())
+        rootLayer->syncCompositingState();
+}
+
 void RenderLayerCompositor::scheduleCompositingLayerUpdate()
 {
     if (!m_updateCompositingLayersTimer.isActive())
index 49759b5..fc36dca 100644 (file)
@@ -84,7 +84,10 @@ public:
     void setCompositingConsultsOverlap(bool b) { m_compositingConsultsOverlap = b; }
     bool compositingConsultsOverlap() const { return m_compositingConsultsOverlap; }
     
-    void scheduleSync();
+    // GraphicsLayers buffer state, which gets pushed to the underlying platform layers
+    // at specific times.
+    void scheduleLayerFlush();
+    void flushPendingLayerChanges();
     
     // Rebuild the tree of compositing layers
     void updateCompositingLayers(CompositingUpdateType = CompositingUpdateAfterLayoutOrStyleChange, RenderLayer* updateRoot = 0);
@@ -179,7 +182,7 @@ public:
 private:
     // GraphicsLayerClient Implementation
     virtual void notifyAnimationStarted(const GraphicsLayer*, double) { }
-    virtual void notifySyncRequired(const GraphicsLayer*) { scheduleSync(); }
+    virtual void notifySyncRequired(const GraphicsLayer*) { scheduleLayerFlush(); }
     virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&) { }
 
     // These calls return false always. They are saying that the layers associated with this client