Changeset 113241 in webkit
- Timestamp:
- Apr 4, 2012, 2:27:36 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r113238 r113241 1 2012-04-04 Daniel Sievers <sievers@chromium.org> 2 3 [Chromium] Always skip draw and readback if there is nothing 4 to draw. 5 https://bugs.webkit.org/show_bug.cgi?id=82680 6 7 This avoids corruption from pushing frames that have no valid 8 content drawn into them. 9 Also in addition to checking for non-existing root layers, check 10 for root layers with no content bounds. It's possible to see those 11 with kForceCompositing mode for empty documents. 12 13 Reviewed by James Robinson. 14 15 Added CCLayerTreeHostTestEmptyContentsShouldNotDraw. 16 17 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: 18 (WebCore::CCLayerTreeHostImpl::canDraw): 19 (WebCore::CCLayerTreeHostImpl::prepareToDraw): 20 * platform/graphics/chromium/cc/CCThreadProxy.cpp: 21 (WebCore::CCThreadProxy::scheduledActionDrawAndSwapInternal): 22 1 23 2012-03-15 Jer Noble <jer.noble@apple.com> 2 24 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
r112551 r113241 142 142 bool CCLayerTreeHostImpl::canDraw() 143 143 { 144 if (!rootLayer() )144 if (!rootLayer() || rootLayer()->bounds().isEmpty()) 145 145 return false; 146 146 if (viewportSize().isEmpty()) … … 377 377 frame.renderSurfaceLayerList.clear(); 378 378 379 if (!rootLayer())380 return false;381 382 379 if (!calculateRenderPasses(frame.renderPasses, frame.renderSurfaceLayerList)) 383 380 return false; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
r112446 r113241 89 89 virtual void commitComplete(); 90 90 virtual void animate(double monotonicTime, double wallClockTime); 91 // Returns false if problems occured preparing the frame, and we should try to avoid displaying the frame.91 // Returns false if we should try to avoid displaying the frame, because it has visible checkerboard during an animation. 92 92 virtual bool prepareToDraw(FrameData&); 93 93 virtual void drawLayers(const FrameData&); … … 103 103 104 104 // Implementation 105 106 // Returns false if there is no valid root layer and thus no content that can be drawn. 105 107 bool canDraw(); 106 108 GraphicsContext3D* context(); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r112729 r113241 579 579 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); 580 580 CCLayerTreeHostImpl::FrameData frame; 581 bool drawFrame = m_layerTreeHostImpl-> prepareToDraw(frame) || forcedDraw;581 bool drawFrame = m_layerTreeHostImpl->canDraw() && (m_layerTreeHostImpl->prepareToDraw(frame) || forcedDraw); 582 582 if (drawFrame) { 583 583 m_layerTreeHostImpl->drawLayers(frame); … … 587 587 // Check for a pending compositeAndReadback. 588 588 if (m_readbackRequestOnImplThread) { 589 ASSERT(drawFrame); // This should be a forcedDraw590 m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels, m_readbackRequestOnImplThread->rect);591 m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isContextLost() ;589 if (drawFrame) 590 m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels, m_readbackRequestOnImplThread->rect); 591 m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isContextLost() && drawFrame; 592 592 m_readbackRequestOnImplThread->completion.signal(); 593 593 m_readbackRequestOnImplThread = 0; … … 599 599 // Process any finish request 600 600 if (m_finishAllRenderingCompletionEventOnImplThread) { 601 ASSERT(drawFrame); // This should be a forcedDraw602 601 m_layerTreeHostImpl->finishAllRendering(); 603 602 m_finishAllRenderingCompletionEventOnImplThread->signal(); … … 611 610 } 612 611 613 ASSERT(drawFrame || (!drawFrame && !forcedDraw));614 612 return result; 615 613 } -
trunk/Source/WebKit/chromium/ChangeLog
r113227 r113241 1 2012-04-04 Daniel Sievers <sievers@chromium.org> 2 3 [Chromium] Always skip draw and readback if there is nothing 4 to draw. 5 https://bugs.webkit.org/show_bug.cgi?id=82680 6 7 This avoids corruption from pushing frames that have no valid 8 content drawn into them. 9 Also in addition to checking for non-existing root layers, check 10 for root layers with no content bounds. It's possible to see those 11 with kForceCompositing mode for empty documents. 12 13 Reviewed by James Robinson. 14 15 Added CCLayerTreeHostTestEmptyContentsShouldNotDraw. 16 17 * tests/CCLayerTreeHostImplTest.cpp: 18 (WebKitTests::TEST_F): 19 * tests/CCLayerTreeHostTest.cpp: 20 (WTF::CCLayerTreeHostTest::doBeginTest): 21 (WTF): 22 (CCLayerTreeHostTestEmptyContentsShouldNotDraw): 23 (WTF::CCLayerTreeHostTestEmptyContentsShouldNotDraw::CCLayerTreeHostTestEmptyContentsShouldNotDraw): 24 (WTF::CCLayerTreeHostTestEmptyContentsShouldNotDraw::beginTest): 25 (WTF::CCLayerTreeHostTestEmptyContentsShouldNotDraw::drawLayersOnCCThread): 26 (WTF::CCLayerTreeHostTestEmptyContentsShouldNotDraw::didCommitAndDrawFrame): 27 (WTF::CCLayerTreeHostTestEmptyContentsShouldNotDraw::afterTest): 28 (WTF::TEST_F): 29 1 30 2012-04-04 Mark Pilgrim <pilgrim@chromium.org> 2 31 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
r112127 r113241 249 249 250 250 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); 251 root->setBounds(IntSize(1, 1)); 251 252 root->setScrollable(true); 252 253 root->setScrollPosition(IntPoint(0, 0)); -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r112896 r113241 533 533 534 534 RefPtr<LayerChromium> rootLayer = LayerChromium::create(); 535 536 // Only non-empty root layers will cause drawing to happen. 537 rootLayer->setBounds(IntSize(1, 1)); 538 535 539 m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings); 536 540 ASSERT_TRUE(m_layerTreeHost); … … 818 822 819 823 TEST_F(CCLayerTreeHostTestSetNeedsRedraw, runMultiThread) 824 { 825 runTestThreaded(); 826 } 827 828 // If the root layer has no content bounds, we should see a commit, but should not be 829 // pushing any frames as the contents will be undefined. Regardless, forced draws need 830 // to always signal completion. 831 class CCLayerTreeHostTestEmptyContentsShouldNotDraw : public CCLayerTreeHostTestThreadOnly { 832 public: 833 CCLayerTreeHostTestEmptyContentsShouldNotDraw() 834 : m_numCommits(0) 835 { 836 } 837 838 virtual void beginTest() 839 { 840 } 841 842 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) 843 { 844 // Only the initial draw should bring us here. 845 EXPECT_FALSE(impl->rootLayer()->bounds().isEmpty()); 846 } 847 848 virtual void didCommitAndDrawFrame() 849 { 850 m_numCommits++; 851 if (m_numCommits == 1) { 852 // Put an empty root layer. 853 RefPtr<LayerChromium> rootLayer = LayerChromium::create(); 854 m_layerTreeHost->setRootLayer(rootLayer); 855 856 OwnArrayPtr<char> pixels(adoptArrayPtr(new char[4])); 857 m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), IntRect(0, 0, 1, 1)); 858 } else if (m_numCommits == 2) { 859 m_layerTreeHost->setNeedsCommit(); 860 m_layerTreeHost->finishAllRendering(); 861 endTest(); 862 } 863 } 864 865 virtual void afterTest() 866 { 867 } 868 869 private: 870 int m_numCommits; 871 }; 872 873 TEST_F(CCLayerTreeHostTestEmptyContentsShouldNotDraw, runMultiThread) 820 874 { 821 875 runTestThreaded();
Note:
See TracChangeset
for help on using the changeset viewer.