Title: [148432] trunk/Source/WebCore
Revision
148432
Author
an...@apple.com
Date
2013-04-15 06:00:50 -0700 (Mon, 15 Apr 2013)

Log Message

Dynamically triggered subframe loads are causing tile churn
https://bugs.webkit.org/show_bug.cgi?id=114440
        
Reviewed by Andreas Kling.
        
In some cases we switch in and out of minimal tiles multiple times during page loading. This
creates tile churn where we create speculative tiles and then throw them out. This can be
caused by various reasons including dynamically created subframes.

* page/FrameView.cpp:
(WebCore::FrameView::setIsVisuallyNonEmpty):
        
    Stay in minimal tiles modes until there is some visual contents. This avoids switching out from minimal
    tiles while awaiting response for the initial requests.

* page/FrameView.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking):
(WebCore::computeTileCoverage):
* rendering/RenderLayerBacking.h:
(WebCore::RenderLayerBacking::didSwitchToFullTileCoverageDuringLoading):
(WebCore::RenderLayerBacking::setDidSwitchToFullTileCoverageDuringLoading):
        
    Only switch into minimal coverage mode once per page load.

(RenderLayerBacking):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (148431 => 148432)


--- trunk/Source/WebCore/ChangeLog	2013-04-15 12:02:19 UTC (rev 148431)
+++ trunk/Source/WebCore/ChangeLog	2013-04-15 13:00:50 UTC (rev 148432)
@@ -1,3 +1,32 @@
+2013-04-15  Antti Koivisto  <an...@apple.com>
+
+        Dynamically triggered subframe loads are causing tile churn
+        https://bugs.webkit.org/show_bug.cgi?id=114440
+        
+        Reviewed by Andreas Kling.
+        
+        In some cases we switch in and out of minimal tiles multiple times during page loading. This
+        creates tile churn where we create speculative tiles and then throw them out. This can be
+        caused by various reasons including dynamically created subframes.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::setIsVisuallyNonEmpty):
+        
+            Stay in minimal tiles modes until there is some visual contents. This avoids switching out from minimal
+            tiles while awaiting response for the initial requests.
+
+        * page/FrameView.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::RenderLayerBacking):
+        (WebCore::computeTileCoverage):
+        * rendering/RenderLayerBacking.h:
+        (WebCore::RenderLayerBacking::didSwitchToFullTileCoverageDuringLoading):
+        (WebCore::RenderLayerBacking::setDidSwitchToFullTileCoverageDuringLoading):
+        
+            Only switch into minimal coverage mode once per page load.
+
+        (RenderLayerBacking):
+
 2013-04-15  Rune Lillesveen  <r...@opera.com>
 
         color-index media feature not supported

Modified: trunk/Source/WebCore/page/FrameView.cpp (148431 => 148432)


--- trunk/Source/WebCore/page/FrameView.cpp	2013-04-15 12:02:19 UTC (rev 148431)
+++ trunk/Source/WebCore/page/FrameView.cpp	2013-04-15 13:00:50 UTC (rev 148432)
@@ -3672,6 +3672,12 @@
     ASSERT(!needsLayout());
 }
 
+void FrameView::setIsVisuallyNonEmpty()
+{
+    m_isVisuallyNonEmpty = true;
+    adjustTiledBackingCoverage();
+}
+
 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize)
 {
     ASSERT(!enable || !minSize.isEmpty());

Modified: trunk/Source/WebCore/page/FrameView.h (148431 => 148432)


--- trunk/Source/WebCore/page/FrameView.h	2013-04-15 12:02:19 UTC (rev 148431)
+++ trunk/Source/WebCore/page/FrameView.h	2013-04-15 13:00:50 UTC (rev 148432)
@@ -290,7 +290,7 @@
 
     void incrementVisuallyNonEmptyCharacterCount(unsigned);
     void incrementVisuallyNonEmptyPixelCount(const IntSize&);
-    void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; }
+    void setIsVisuallyNonEmpty();
     bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; }
     void enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize);
 

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (148431 => 148432)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-04-15 12:02:19 UTC (rev 148431)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-04-15 13:00:50 UTC (rev 148432)
@@ -120,6 +120,7 @@
     , m_canCompositeFilters(false)
 #endif
     , m_backgroundLayerPaintsFixedRootBackground(false)
+    , m_didSwitchToFullTileCoverageDuringLoading(false)
 {
     if (layer->isRootLayer()) {
         Frame* frame = toRenderView(renderer())->frameView()->frame();
@@ -209,7 +210,7 @@
     return m_graphicsLayer->tiledBacking();
 }
 
-static TiledBacking::TileCoverage computeTileCoverage(const RenderLayerBacking* backing)
+static TiledBacking::TileCoverage computeTileCoverage(RenderLayerBacking* backing)
 {
     // FIXME: When we use TiledBacking for overflow, this should look at RenderView scrollability.
     Frame* frame = backing->owningLayer()->renderer()->frame();
@@ -219,7 +220,13 @@
     TiledBacking::TileCoverage tileCoverage = TiledBacking::CoverageForVisibleArea;
     FrameView* frameView = frame->view();
     bool useMinimalTilesDuringLiveResize = frameView->inLiveResize();
-    bool useMinimalTilesDuringLoading = frame->page()->progress()->isLoadProgressing() && !frameView->wasScrolledByUser();
+    bool useMinimalTilesDuringLoading = false;
+    // Avoid churn.
+    if (!backing->didSwitchToFullTileCoverageDuringLoading()) {
+        useMinimalTilesDuringLoading = !frameView->isVisuallyNonEmpty() || (frame->page()->progress()->isLoadProgressing() && !frameView->wasScrolledByUser());
+        if (!useMinimalTilesDuringLoading)
+            backing->setDidSwitchToFullTileCoverageDuringLoading();
+    }
     if (!(useMinimalTilesDuringLoading || useMinimalTilesDuringLiveResize)) {
         bool clipsToExposedRect = backing->tiledBacking()->clipsToExposedRect();
         if (frameView->horizontalScrollbarMode() != ScrollbarAlwaysOff || clipsToExposedRect)

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (148431 => 148432)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2013-04-15 12:02:19 UTC (rev 148431)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2013-04-15 13:00:50 UTC (rev 148432)
@@ -192,6 +192,9 @@
     // Return an estimate of the backing store area (in pixels) allocated by this object's GraphicsLayers.
     double backingStoreMemoryEstimate() const;
 
+    bool didSwitchToFullTileCoverageDuringLoading() const { return m_didSwitchToFullTileCoverageDuringLoading; }
+    void setDidSwitchToFullTileCoverageDuringLoading() { m_didSwitchToFullTileCoverageDuringLoading = true; }
+
 #if ENABLE(CSS_COMPOSITING)
     void setBlendMode(BlendMode);
 #endif
@@ -306,6 +309,7 @@
     bool m_canCompositeFilters;
 #endif
     bool m_backgroundLayerPaintsFixedRootBackground;
+    bool m_didSwitchToFullTileCoverageDuringLoading;
 
     static bool m_creatingPrimaryGraphicsLayer;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to