Changeset 102435 in webkit
- Timestamp:
- Dec 8, 2011 10:54:09 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 3 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102433 r102435 1 2011-12-08 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com> 2 3 [Qt] [WK2] Webkit should release TextureMapper GL objects if page paint node is deallocated. 4 https://bugs.webkit.org/show_bug.cgi?id=73591 5 6 Reviewed by Noam Rosenthal. 7 8 Implementation of helper function to remove all GL allocated tiles 9 when QQuickWebView gets removed from canvas. 10 11 Tested by new API test in WK2 (tst_QQuickWebView::removeFromCanvas). 12 13 * platform/graphics/texmap/TextureMapperNode.cpp: 14 (WebCore::TextureMapperNode::purgeNodeTexturesRecursive): 15 * platform/graphics/texmap/TextureMapperNode.h: 16 1 17 2011-12-08 Leo Yang <leo.yang@torchmobile.com.cn> 2 18 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp
r102113 r102435 615 615 { 616 616 m_externallyManagedTiles.remove(id); 617 } 618 619 void TextureMapperNode::purgeNodeTexturesRecursive() 620 { 621 m_externallyManagedTiles.clear(); 622 623 for (int i = m_children.size() - 1; i >= 0; --i) 624 m_children[i]->purgeNodeTexturesRecursive(); 617 625 } 618 626 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h
r100922 r102435 159 159 void clearAllDirectlyCompositedImageTiles(); 160 160 bool collectVisibleContentsRects(NodeRectMap&, const FloatRect&); 161 void purgeNodeTexturesRecursive(); 161 162 #endif 162 163 void setID(int id) { m_id = id; } -
trunk/Source/WebKit2/ChangeLog
r102407 r102435 1 2011-12-08 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com> 2 3 [Qt] [WK2] Webkit should release TextureMapper GL objects if page paint node is deallocated. 4 https://bugs.webkit.org/show_bug.cgi?id=73591 5 6 Reviewed by Noam Rosenthal. 7 8 Implement deallocation of TextureMapper GL objects when QQuickWebPage paint node deallocated. 9 Also adds purging GraphicsLayer backing stores on WebProcess side in order to force repainting 10 when page becomes visible and painting resumes and fixes incorrect initialization of view 11 visibility state. 12 13 * UIProcess/API/qt/qquickwebpage.cpp: 14 (QQuickWebPagePrivate::resetPaintNode): 15 * UIProcess/API/qt/qquickwebview.cpp: 16 (QQuickWebViewPrivate::QQuickWebViewPrivate): 17 * UIProcess/API/qt/tests/html/direct-image-compositing.html: Added. 18 * UIProcess/API/qt/tests/html/resources/simple_image.png: Added. 19 * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp: 20 (tst_QQuickWebView::showWebView): 21 (tst_QQuickWebView::removeFromCanvas): 22 * UIProcess/DrawingAreaProxy.h: 23 (WebKit::DrawingAreaProxy::layerTreeHostProxy): 24 * UIProcess/LayerTreeHostProxy.h: 25 * UIProcess/qt/LayerTreeHostProxyQt.cpp: 26 (WebKit::LayerTreeHostProxy::purgeGLResources): 27 * UIProcess/qt/QtWebPageProxy.cpp: 28 (QtWebPageProxy::purgeGLResources): 29 * UIProcess/qt/QtWebPageProxy.h: 30 * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp: 31 (WebCore::WebGraphicsLayer::setNeedsDisplayInRect): 32 (WebCore::WebGraphicsLayer::purgeBackingStores): 33 (WebCore::WebGraphicsLayer::recreateBackingStoreIfNeeded): 34 * WebProcess/WebCoreSupport/WebGraphicsLayer.h: 35 * WebProcess/WebPage/LayerTreeHost.h: 36 (WebKit::LayerTreeHost::purgeBackingStores): 37 * WebProcess/WebPage/LayerTreeHost.messages.in: 38 * WebProcess/WebPage/qt/LayerTreeHostQt.cpp: 39 (WebKit::LayerTreeHostQt::LayerTreeHostQt): 40 (WebKit::LayerTreeHostQt::flushPendingLayerChanges): 41 (WebKit::LayerTreeHostQt::purgeBackingStores): 42 (WebKit::LayerTreeHostQt::recreateBackingStoreIfNeeded): 43 * WebProcess/WebPage/qt/LayerTreeHostQt.h: 44 1 45 2011-12-08 Simon Fraser <simon.fraser@apple.com> 2 46 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
r102337 r102435 315 315 { 316 316 m_paintNode = 0; 317 pageProxy->purgeGLResources(); 317 318 } 318 319 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
r102340 r102435 72 72 // Creates a page with the page creation parameters. 73 73 pageProxy->init(eventHandler.data()); 74 75 // Trigger setting of correct visibility flags after everything was allocated and initialized. 76 _q_onVisibleChanged(); 74 77 } 75 78 -
trunk/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp
r102035 r102435 51 51 void show(); 52 52 void showWebView(); 53 void removeFromCanvas(); 53 54 54 55 private: … … 245 246 webView()->setSize(QSizeF(300, 400)); 246 247 247 webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/ scroll.html")));248 webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/direct-image-compositing.html"))); 248 249 QVERIFY(waitForSignal(webView(), SIGNAL(loadSucceeded()))); 249 250 … … 256 257 } 257 258 259 void tst_QQuickWebView::removeFromCanvas() 260 { 261 showWebView(); 262 263 // This should not crash. 264 QQuickItem* parent = webView()->parentItem(); 265 QQuickItem noCanvasItem; 266 webView()->setParentItem(&noCanvasItem); 267 QTest::qWait(200); 268 webView()->setParentItem(parent); 269 webView()->setVisible(true); 270 QTest::qWait(200); 271 } 272 258 273 void tst_QQuickWebView::scrollRequest() 259 274 { -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h
r102407 r102435 89 89 virtual bool isBackingStoreReady() const { return true; } 90 90 virtual void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float opacity) { } 91 LayerTreeHostProxy* layerTreeHostProxy() const { return m_layerTreeHostProxy.get(); } 91 92 92 93 #if USE(TILED_BACKING_STORE) -
trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.h
r100922 r102435 56 56 void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); 57 57 void paintToCurrentGLContext(const TransformationMatrix&, float); 58 void purgeGLResources(); 58 59 void setVisibleContentsRectAndScale(const IntRect&, float); 59 60 void setVisibleContentRectTrajectoryVector(const FloatPoint&); -
trunk/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp
r102336 r102435 620 620 } 621 621 622 void LayerTreeHostProxy::purgeGLResources() 623 { 624 TextureMapperNode* node = toTextureMapperNode(rootLayer()); 625 626 node->purgeNodeTexturesRecursive(); 627 m_directlyCompositedImages.clear(); 628 629 m_textureMapper.clear(); 630 631 m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::PurgeBackingStores(), m_drawingAreaProxy->page()->pageID()); 632 } 633 622 634 } 623 635 #endif -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
r102035 r102435 34 34 #include "DownloadProxy.h" 35 35 #include "DrawingAreaProxyImpl.h" 36 #include "LayerTreeHostProxy.h" 36 37 #include "qwkhistory.h" 37 38 #include "qwkhistory_p.h" … … 427 428 } 428 429 430 void QtWebPageProxy::purgeGLResources() 431 { 432 DrawingAreaProxy* drawingArea = m_webPageProxy->drawingArea(); 433 if (drawingArea && drawingArea->layerTreeHostProxy()) 434 drawingArea->layerTreeHostProxy()->purgeGLResources(); 435 } 436 429 437 void QtWebPageProxy::setVisibleContentRectAndScale(const QRectF& visibleContentRect, float scale) 430 438 { -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h
r102035 r102435 138 138 void setVisibleContentRectTrajectoryVector(const QPointF&); 139 139 void renderToCurrentGLContext(const WebCore::TransformationMatrix&, float); 140 void purgeGLResources(); 140 141 141 142 QWKHistory* history() const; -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp
r102342 r102435 369 369 void WebGraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect) 370 370 { 371 recreateBackingStoreIfNeeded(); 371 372 m_mainBackingStore->invalidate(IntRect(rect)); 372 373 notifyChange(); … … 575 576 } 576 577 578 void WebGraphicsLayer::purgeBackingStores() 579 { 580 for (size_t i = 0; i < children().size(); ++i) { 581 WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]); 582 layer->purgeBackingStores(); 583 } 584 585 if (m_mainBackingStore) 586 m_mainBackingStore.clear(); 587 588 if (!m_layerInfo.imageBackingStoreID) 589 return; 590 591 layerTreeTileClient()->releaseImageBackingStore(m_layerInfo.imageBackingStoreID); 592 m_layerInfo.imageBackingStoreID = 0; 593 } 594 595 void WebGraphicsLayer::recreateBackingStoreIfNeeded() 596 { 597 for (size_t i = 0; i < children().size(); ++i) { 598 WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]); 599 layer->recreateBackingStoreIfNeeded(); 600 } 601 602 if (!m_mainBackingStore) { 603 m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this))); 604 m_mainBackingStore->setContentsScale(m_contentsScale); 605 } 606 607 if (m_image) 608 setContentsNeedsDisplay(); 609 } 577 610 #endif 578 611 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h
r97639 r102435 132 132 void setContentsScale(float); 133 133 void updateContentBuffers(); 134 void purgeBackingStores(); 135 void recreateBackingStoreIfNeeded(); 134 136 #endif 135 137 -
trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
r97639 r102435 85 85 virtual void setVisibleContentRectForLayer(int layerID, const WebCore::IntRect&) { } 86 86 virtual void renderNextFrame() { } 87 virtual void purgeBackingStores() { } 87 88 virtual void didReceiveLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); 88 89 #endif -
trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.messages.in
r97639 r102435 25 25 SetVisibleContentRectAndScale(WebCore::IntRect contentRect, float scale) 26 26 RenderNextFrame() 27 PurgeBackingStores() 27 28 } 28 29 #endif -
trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp
r102156 r102435 67 67 , m_layerFlushTimer(this, &LayerTreeHostQt::layerFlushTimerFired) 68 68 , m_layerFlushSchedulingEnabled(true) 69 , m_shouldRecreateBackingStore(false) 69 70 { 70 71 // Create a root layer. … … 213 214 bool LayerTreeHostQt::flushPendingLayerChanges() 214 215 { 216 recreateBackingStoreIfNeeded(); 217 215 218 bool didSync = m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes(); 216 219 m_nonCompositedContentLayer->syncCompositingStateForThisLayerOnly(); … … 428 431 } 429 432 433 void LayerTreeHostQt::purgeBackingStores() 434 { 435 m_shouldRecreateBackingStore = true; 436 WebGraphicsLayer* webRootLayer = toWebGraphicsLayer(m_rootLayer.get()); 437 webRootLayer->purgeBackingStores(); 438 439 ASSERT(!m_directlyCompositedImageRefCounts.size()); 440 } 441 442 void LayerTreeHostQt::recreateBackingStoreIfNeeded() 443 { 444 if (!m_shouldRecreateBackingStore) 445 return; 446 447 m_shouldRecreateBackingStore = false; 448 WebGraphicsLayer* webRootLayer = toWebGraphicsLayer(m_rootLayer.get()); 449 webRootLayer->recreateBackingStoreIfNeeded(); 450 } 430 451 #endif 431 452 -
trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h
r97639 r102435 72 72 virtual void setVisibleContentRectForLayer(int layerID, const WebCore::IntRect&); 73 73 virtual void renderNextFrame(); 74 virtual void purgeBackingStores(); 74 75 virtual bool layerTreeTileUpdatesAllowed() const; 75 76 virtual void setVisibleContentRectAndScale(const IntRect&, float scale); … … 97 98 void performScheduledLayerFlush(); 98 99 void sendLayersToUI(); 100 void recreateBackingStoreIfNeeded(); 99 101 100 102 OwnPtr<WebCore::GraphicsLayer> m_rootLayer; … … 120 122 WebCore::Timer<LayerTreeHostQt> m_layerFlushTimer; 121 123 bool m_layerFlushSchedulingEnabled; 124 bool m_shouldRecreateBackingStore; 122 125 }; 123 126
Note: See TracChangeset
for help on using the changeset viewer.