Title: [124269] trunk/Source/WebCore
Revision
124269
Author
jam...@google.com
Date
2012-07-31 16:31:09 -0700 (Tue, 31 Jul 2012)

Log Message

[chromium] REGRESSION(r123644) Compositor HUD crashes immediately with --show-paint-rects
https://bugs.webkit.org/show_bug.cgi?id=92775

Reviewed by Adrienne Walker.

In r123644, the compositor HUD was turned into a normal layer. When the HUD is supposed to cover the entire
viewport - for instance if the showPlatformLayerTree or showDebugRects settings are true -
HeadsUpDisplayLayerChromium's constructor tries to size itself to its layerTreeHost()'s device viewport size.
Unfortunately, its layerTreeHost pointer is always nil in the constructor since the layer is not yet in the
tree. Additionally, this doesn't handle resize at all.

To fix this, this grabs the device viewport size and settings in a LayerChromium::update() OVERRIDE. Also
changes CCLayerTreeHost::willCommit to only reparent the HUD layer if needed instead of on every frame.

Tested manually, we don't have any layout tests for the debug HUD.

* platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp:
(WebCore::HeadsUpDisplayLayerChromium::create):
(WebCore::HeadsUpDisplayLayerChromium::HeadsUpDisplayLayerChromium):
* platform/graphics/chromium/HeadsUpDisplayLayerChromium.h:
(HeadsUpDisplayLayerChromium):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::willCommit):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124268 => 124269)


--- trunk/Source/WebCore/ChangeLog	2012-07-31 23:24:31 UTC (rev 124268)
+++ trunk/Source/WebCore/ChangeLog	2012-07-31 23:31:09 UTC (rev 124269)
@@ -1,3 +1,29 @@
+2012-07-31  James Robinson  <jam...@chromium.org>
+
+        [chromium] REGRESSION(r123644) Compositor HUD crashes immediately with --show-paint-rects
+        https://bugs.webkit.org/show_bug.cgi?id=92775
+
+        Reviewed by Adrienne Walker.
+
+        In r123644, the compositor HUD was turned into a normal layer. When the HUD is supposed to cover the entire
+        viewport - for instance if the showPlatformLayerTree or showDebugRects settings are true -
+        HeadsUpDisplayLayerChromium's constructor tries to size itself to its layerTreeHost()'s device viewport size.
+        Unfortunately, its layerTreeHost pointer is always nil in the constructor since the layer is not yet in the
+        tree. Additionally, this doesn't handle resize at all.
+
+        To fix this, this grabs the device viewport size and settings in a LayerChromium::update() OVERRIDE. Also
+        changes CCLayerTreeHost::willCommit to only reparent the HUD layer if needed instead of on every frame.
+
+        Tested manually, we don't have any layout tests for the debug HUD.
+
+        * platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp:
+        (WebCore::HeadsUpDisplayLayerChromium::create):
+        (WebCore::HeadsUpDisplayLayerChromium::HeadsUpDisplayLayerChromium):
+        * platform/graphics/chromium/HeadsUpDisplayLayerChromium.h:
+        (HeadsUpDisplayLayerChromium):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::willCommit):
+
 2012-07-31  Sam Weinig  <s...@webkit.org>
 
         Stop masking 8 bits off of the visited link hash. We need all the bits!

Modified: trunk/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp (124268 => 124269)


--- trunk/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp	2012-07-31 23:24:31 UTC (rev 124268)
+++ trunk/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp	2012-07-31 23:31:09 UTC (rev 124269)
@@ -33,25 +33,16 @@
 
 namespace WebCore {
 
-PassRefPtr<HeadsUpDisplayLayerChromium> HeadsUpDisplayLayerChromium::create(const CCLayerTreeSettings& settings, int maxTextureSize)
+PassRefPtr<HeadsUpDisplayLayerChromium> HeadsUpDisplayLayerChromium::create(const CCLayerTreeSettings& settings)
 {
-    return adoptRef(new HeadsUpDisplayLayerChromium(settings, maxTextureSize));
+    return adoptRef(new HeadsUpDisplayLayerChromium(settings));
 }
 
-HeadsUpDisplayLayerChromium::HeadsUpDisplayLayerChromium(const CCLayerTreeSettings& settings, int maxTextureSize)
+HeadsUpDisplayLayerChromium::HeadsUpDisplayLayerChromium(const CCLayerTreeSettings& settings)
     : LayerChromium()
 {
-    OwnPtr<CCFontAtlas> fontAtlas;
 
-    IntSize bounds;
-    if (settings.showPlatformLayerTree || settings.showDebugRects()) {
-        bounds.setWidth(std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().width()));
-        bounds.setHeight(std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().height()));
-    } else {
-        bounds.setWidth(512);
-        bounds.setHeight(128);
-    }
-    setBounds(bounds);
+    setBounds(IntSize(512, 128));
 
     // Only allocate the font atlas if we have reason to use the heads-up display.
     if (settings.showFPSCounter || settings.showPlatformLayerTree) {
@@ -65,6 +56,23 @@
 {
 }
 
+void HeadsUpDisplayLayerChromium::update(CCTextureUpdater&, const CCOcclusionTracker*, CCRenderingStats&)
+{
+    const CCLayerTreeSettings& settings = layerTreeHost()->settings();
+    int maxTextureSize = layerTreeHost()->layerRendererCapabilities().maxTextureSize;
+
+    IntSize bounds;
+    if (settings.showPlatformLayerTree || settings.showDebugRects()) {
+        bounds.setWidth(std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().width()));
+        bounds.setHeight(std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().height()));
+    } else {
+        bounds.setWidth(512);
+        bounds.setHeight(128);
+    }
+
+    setBounds(bounds);
+}
+
 PassOwnPtr<CCLayerImpl> HeadsUpDisplayLayerChromium::createCCLayerImpl()
 {
     return CCHeadsUpDisplayLayerImpl::create(m_layerId, m_fontAtlas.release());

Modified: trunk/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.h (124268 => 124269)


--- trunk/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.h	2012-07-31 23:24:31 UTC (rev 124268)
+++ trunk/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.h	2012-07-31 23:31:09 UTC (rev 124269)
@@ -27,6 +27,7 @@
 #ifndef HeadsUpDisplayLayerChromium_h
 #define HeadsUpDisplayLayerChromium_h
 
+#include "IntSize.h"
 #include "LayerChromium.h"
 #include "cc/CCFontAtlas.h"
 
@@ -36,15 +37,16 @@
 
 class HeadsUpDisplayLayerChromium : public LayerChromium {
 public:
-    static PassRefPtr<HeadsUpDisplayLayerChromium> create(const CCLayerTreeSettings&, int maxTextureSize);
+    static PassRefPtr<HeadsUpDisplayLayerChromium> create(const CCLayerTreeSettings&);
     virtual ~HeadsUpDisplayLayerChromium();
 
+    virtual void update(CCTextureUpdater&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
     virtual bool drawsContent() const OVERRIDE { return true; }
 
     virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
 
 protected:
-    HeadsUpDisplayLayerChromium(const CCLayerTreeSettings&, int maxTextureSize);
+    explicit HeadsUpDisplayLayerChromium(const CCLayerTreeSettings&);
 
 private:
     OwnPtr<CCFontAtlas> m_fontAtlas;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (124268 => 124269)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-07-31 23:24:31 UTC (rev 124268)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-07-31 23:31:09 UTC (rev 124269)
@@ -256,15 +256,16 @@
     m_client->willCommit();
     if (m_rootLayer && m_settings.showDebugInfo()) {
         if (!m_hudLayer)
-            m_hudLayer = HeadsUpDisplayLayerChromium::create(m_settings, layerRendererCapabilities().maxTextureSize);
-        m_rootLayer->addChild(m_hudLayer);
+            m_hudLayer = HeadsUpDisplayLayerChromium::create(m_settings);
+        if (m_hudLayer->parent() != m_rootLayer.get()) {
+            m_hudLayer->removeFromParent();
+            m_rootLayer->addChild(m_hudLayer);
+        }
     }
 }
 
 void CCLayerTreeHost::commitComplete()
 {
-    if (m_hudLayer)
-        m_hudLayer->removeFromParent();
     m_deleteTextureAfterCommitList.clear();
     m_client->didCommit();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to