Changeset 95152 in webkit
- Timestamp:
- Sep 14, 2011 7:34:02 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r95151 r95152 1 2011-09-14 Antoine Labour <piman@chromium.org> 2 3 Remove the dependency on GraphicsLayer from CCLayerTreeHost. 4 Move root layer management into the NonCompositedContentHost. 5 Have WebViewImpl create a NonCompositedContentHost explicitly. 6 https://bugs.webkit.org/show_bug.cgi?id=67883 7 8 Reviewed by James Robinson. 9 10 Covered by compositing/ layout tests. 11 12 * platform/graphics/chromium/NonCompositedContentHost.cpp: 13 (WebCore::NonCompositedContentHost::setRootLayer): 14 (WebCore::NonCompositedContentHost::setViewport): 15 (WebCore::NonCompositedContentHost::setVisible): 16 (WebCore::NonCompositedContentHost::clearRenderSurfacesRecursive): 17 (WebCore::NonCompositedContentHost::invalidateRect): 18 * platform/graphics/chromium/NonCompositedContentHost.h: 19 (WebCore::NonCompositedContentHost::topLevelRootLayer): 20 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 21 (WebCore::CCLayerTreeHost::create): 22 (WebCore::CCLayerTreeHost::CCLayerTreeHost): 23 (WebCore::CCLayerTreeHost::initialize): 24 (WebCore::CCLayerTreeHost::commitTo): 25 (WebCore::CCLayerTreeHost::didRecreateGraphicsContext): 26 (WebCore::CCLayerTreeHost::setViewport): 27 (WebCore::CCLayerTreeHost::setVisible): 28 (WebCore::CCLayerTreeHost::updateLayers): 29 (WebCore::CCLayerTreeHost::paintLayerContents): 30 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 31 (WebCore::CCLayerTreeHost::rootLayer): 32 1 33 2011-09-14 Henrik Grunell <grunell@google.com> 2 34 -
trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp
r93360 r95152 50 50 } 51 51 52 void NonCompositedContentHost:: invalidateRect(const IntRect& rect)52 void NonCompositedContentHost::setRootLayer(GraphicsLayer* layer) 53 53 { 54 m_graphicsLayer->setNeedsDisplayInRect(FloatRect(rect)); 54 m_graphicsLayer->removeAllChildren(); 55 m_graphicsLayer->setNeedsDisplay(); 56 if (layer) 57 m_graphicsLayer->addChild(layer); 58 else 59 m_graphicsLayer->platformLayer()->setLayerTreeHost(0); 55 60 } 56 61 57 void NonCompositedContentHost:: invalidateEntireLayer()62 void NonCompositedContentHost::setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition) 58 63 { 59 m_graphicsLayer->setNeedsDisplay(); 60 } 64 bool visibleRectChanged = m_viewportSize != viewportSize; 61 65 62 void NonCompositedContentHost::setScrollPosition(const IntPoint& scrollPosition) 63 { 66 m_viewportSize = viewportSize; 64 67 m_graphicsLayer->platformLayer()->setScrollPosition(scrollPosition); 68 m_graphicsLayer->setSize(contentsSize); 69 70 if (visibleRectChanged) 71 m_graphicsLayer->setNeedsDisplay(); 65 72 } 66 73 … … 68 75 { 69 76 m_graphicsLayer->platformLayer()->protectVisibleTileTextures(); 77 } 78 79 void NonCompositedContentHost::invalidateRect(const IntRect& rect) 80 { 81 m_graphicsLayer->setNeedsDisplayInRect(FloatRect(rect)); 70 82 } 71 83 -
trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h
r93360 r95152 28 28 29 29 #include "GraphicsLayerClient.h" 30 #include "IntSize.h" 30 31 31 32 #include <wtf/Noncopyable.h> … … 37 38 class GraphicsLayer; 38 39 class GraphicsContext; 40 class IntPoint; 39 41 class IntRect; 40 42 class LayerPainterChromium; … … 50 52 51 53 void invalidateRect(const IntRect&); 52 void invalidateEntireLayer();53 void set ScrollPosition(const IntPoint&);54 void setRootLayer(GraphicsLayer*); 55 void setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition); 54 56 void protectVisibleTileTextures(); 55 56 GraphicsLayer* graphicsLayer() const { return m_graphicsLayer.get(); } 57 GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); } 57 58 58 59 private: … … 68 69 OwnPtr<GraphicsLayer> m_graphicsLayer; 69 70 OwnPtr<LayerPainterChromium> m_contentPaint; 71 IntSize m_viewportSize; 70 72 }; 71 73 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r95100 r95152 30 30 #include "LayerPainterChromium.h" 31 31 #include "LayerRendererChromium.h" 32 #include "NonCompositedContentHost.h"33 32 #include "TraceEvent.h" 34 33 #include "TreeSynchronizer.h" … … 41 40 namespace WebCore { 42 41 43 PassRefPtr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, const CCSettings& settings)44 { 45 RefPtr<CCLayerTreeHost> layerTreeHost = adoptRef(new CCLayerTreeHost(client, settings));42 PassRefPtr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings) 43 { 44 RefPtr<CCLayerTreeHost> layerTreeHost = adoptRef(new CCLayerTreeHost(client, rootLayer, settings)); 46 45 if (!layerTreeHost->initialize()) 47 46 return 0; … … 49 48 } 50 49 51 CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCSettings& settings)50 CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings) 52 51 : m_animating(false) 53 52 , m_client(client) 54 53 , m_frameNumber(0) 55 , m_ nonCompositedContentHost(NonCompositedContentHost::create(m_client->createRootLayerPainter()))54 , m_rootLayer(rootLayer) 56 55 , m_settings(settings) 57 56 , m_zoomAnimatorScale(1) … … 76 75 m_settings.acceleratePainting = m_proxy->layerRendererCapabilities().usingAcceleratedPainting; 77 76 78 m_rootLayer = GraphicsLayer::create(0);79 #ifndef NDEBUG80 m_rootLayer->setName("root layer");81 #endif82 m_rootLayer->setDrawsContent(false);83 84 m_rootLayer->addChild(m_nonCompositedContentHost->graphicsLayer());85 86 77 // We changed the root layer. Tell the proxy a commit is needed. 87 78 m_proxy->setNeedsCommitAndRedraw(); … … 97 88 m_proxy->stop(); 98 89 m_proxy.clear(); 99 m_updateList.clear();90 clearPendingUpdate(); 100 91 ASSERT(!m_contentsTextureManager || !m_contentsTextureManager->currentMemoryUseBytes()); 101 92 m_contentsTextureManager.clear(); … … 126 117 127 118 updateCompositorResources(m_updateList, hostImpl->context()); 128 m_updateList.clear();119 clearPendingUpdate(); 129 120 130 121 hostImpl->setVisible(m_visible); … … 137 128 // Synchronize trees, if one exists at all... 138 129 if (rootLayer()) 139 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer() ->platformLayer(), hostImpl->rootLayer()));130 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->rootLayer())); 140 131 else 141 132 hostImpl->setRootLayer(0); … … 164 155 165 156 if (rootLayer()) 166 rootLayer()-> platformLayer()->cleanupResourcesRecursive();157 rootLayer()->cleanupResourcesRecursive(); 167 158 m_client->didRecreateGraphicsContext(success); 168 159 } … … 190 181 { 191 182 m_proxy->finishAllRendering(); 192 }193 194 void CCLayerTreeHost::invalidateRootLayerRect(const IntRect& dirtyRect)195 {196 m_nonCompositedContentHost->invalidateRect(dirtyRect);197 183 } 198 184 … … 232 218 } 233 219 234 void CCLayerTreeHost::clearRenderSurfacesRecursive(LayerChromium* layer) 235 { 236 for (size_t i = 0; i < layer->children().size(); ++i) 237 clearRenderSurfacesRecursive(layer->children()[i].get()); 238 239 if (layer->replicaLayer()) 240 clearRenderSurfacesRecursive(layer->replicaLayer()); 241 242 if (layer->maskLayer()) 243 clearRenderSurfacesRecursive(layer->maskLayer()); 244 245 layer->clearRenderSurface(); 246 } 247 248 249 void CCLayerTreeHost::setRootLayer(GraphicsLayer* layer) 250 { 251 m_nonCompositedContentHost->graphicsLayer()->removeAllChildren(); 252 m_nonCompositedContentHost->invalidateEntireLayer(); 253 if (layer) 254 m_nonCompositedContentHost->graphicsLayer()->addChild(layer); 255 else { 256 clearRenderSurfacesRecursive(rootLayer()->platformLayer()); 257 m_nonCompositedContentHost->graphicsLayer()->platformLayer()->setLayerTreeHost(0); 258 m_rootLayer->platformLayer()->setLayerTreeHost(0); 259 } 260 } 261 262 void CCLayerTreeHost::setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition) 263 { 264 bool visibleRectChanged = m_viewportSize != viewportSize; 265 220 void CCLayerTreeHost::setViewport(const IntSize& viewportSize) 221 { 266 222 m_viewportSize = viewportSize; 267 m_nonCompositedContentHost->setScrollPosition(scrollPosition);268 m_nonCompositedContentHost->graphicsLayer()->setSize(contentsSize);269 270 if (visibleRectChanged)271 m_nonCompositedContentHost->invalidateEntireLayer();272 273 223 setNeedsCommitAndRedraw(); 274 224 } … … 280 230 m_proxy->setNeedsCommitAndRedraw(); 281 231 else { 282 m_nonCompositedContentHost->protectVisibleTileTextures();283 232 m_contentsTextureManager->reduceMemoryToLimit(TextureManager::lowLimitBytes()); 284 233 m_contentsTextureManager->unprotectAllTextures(); … … 313 262 return; 314 263 315 updateLayers(rootLayer() ->platformLayer());264 updateLayers(rootLayer()); 316 265 } 317 266 … … 396 345 continue; 397 346 398 IntRect defaultContentRect = IntRect(rootLayer()-> platformLayer()->scrollPosition(), viewportSize());347 IntRect defaultContentRect = IntRect(rootLayer()->scrollPosition(), viewportSize()); 399 348 400 349 IntRect targetSurfaceRect = layer->targetRenderSurface() ? layer->targetRenderSurface()->contentRect() : defaultContentRect; … … 458 407 } 459 408 460 } 409 void CCLayerTreeHost::clearPendingUpdate() 410 { 411 for (size_t surfaceIndex = 0; surfaceIndex < m_updateList.size(); ++surfaceIndex) { 412 LayerChromium* layer = m_updateList[surfaceIndex].get(); 413 ASSERT(layer->renderSurface()); 414 layer->clearRenderSurface(); 415 } 416 m_updateList.clear(); 417 } 418 419 } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r95135 r95152 45 45 class LayerChromium; 46 46 class LayerPainterChromium; 47 class GraphicsLayer;48 class NonCompositedContentHost;49 47 class TextureManager; 50 48 … … 94 92 class CCLayerTreeHost : public RefCounted<CCLayerTreeHost> { 95 93 public: 96 static PassRefPtr<CCLayerTreeHost> create(CCLayerTreeHostClient*, const CCSettings&);94 static PassRefPtr<CCLayerTreeHost> create(CCLayerTreeHostClient*, PassRefPtr<LayerChromium> rootLayer, const CCSettings&); 97 95 virtual ~CCLayerTreeHost(); 98 96 … … 129 127 int frameNumber() const { return m_frameNumber; } 130 128 131 void invalidateRootLayerRect(const IntRect& dirtyRect);132 129 void setZoomAnimatorScale(double); 133 130 … … 140 137 void setNeedsRedraw(); 141 138 142 void setRootLayer(GraphicsLayer*); 143 GraphicsLayer* rootLayer() { return m_rootLayer.get(); } 144 const GraphicsLayer* rootLayer() const { return m_rootLayer.get(); } 139 LayerChromium* rootLayer() { return m_rootLayer.get(); } 140 const LayerChromium* rootLayer() const { return m_rootLayer.get(); } 145 141 146 142 const CCSettings& settings() const { return m_settings; } 147 143 148 void setViewport(const IntSize& viewportSize , const IntSize& contentsSize, const IntPoint& scrollPosition);144 void setViewport(const IntSize& viewportSize); 149 145 150 146 const IntSize& viewportSize() const { return m_viewportSize; } … … 153 149 void setVisible(bool); 154 150 155 NonCompositedContentHost* nonCompositedContentHost() const { return m_nonCompositedContentHost.get(); }156 157 151 void updateLayers(); 158 152 … … 160 154 161 155 protected: 162 CCLayerTreeHost(CCLayerTreeHostClient*, const CCSettings&);156 CCLayerTreeHost(CCLayerTreeHostClient*, PassRefPtr<LayerChromium> rootLayer, const CCSettings&); 163 157 164 158 private: … … 169 163 void updateCompositorResources(const LayerList&, GraphicsContext3D*); 170 164 void updateCompositorResources(LayerChromium*, GraphicsContext3D*); 171 172 void clearRenderSurfacesRecursive(LayerChromium*); 165 void clearPendingUpdate(); 173 166 174 167 bool initialize(); … … 182 175 OwnPtr<CCProxy> m_proxy; 183 176 184 OwnPtr<GraphicsLayer> m_rootLayer; 185 OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost; 177 RefPtr<LayerChromium> m_rootLayer; 186 178 OwnPtr<TextureManager> m_contentsTextureManager; 187 179 -
trunk/Source/WebKit/chromium/ChangeLog
r95132 r95152 1 2011-09-14 Antoine Labour <piman@chromium.org> 2 3 Remove the dependency on GraphicsLayer from CCLayerTreeHost. 4 Move root layer management into the NonCompositedContentHost. 5 Have WebViewImpl create a NonCompositedContentHost explicitly. 6 https://bugs.webkit.org/show_bug.cgi?id=67883 7 8 Reviewed by James Robinson. 9 10 * src/WebViewImpl.cpp: 11 (WebKit::WebViewImpl::setRootGraphicsLayer): 12 (WebKit::WebViewImpl::invalidateRootLayerRect): 13 (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): 14 (WebKit::WebViewImpl::updateLayerTreeViewport): 15 (WebKit::WebViewImpl::setVisibilityState): 16 * src/WebViewImpl.h: 17 1 18 2011-09-14 Nebojsa Ciric <cira@chromium.org> 2 19 -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r94971 r95152 75 75 #include "KeyboardCodes.h" 76 76 #include "KeyboardEvent.h" 77 #include "LayerChromium.h" 77 78 #include "LayerPainterChromium.h" 78 79 #include "MIMETypeRegistry.h" 79 80 #include "NodeRenderStyle.h" 81 #include "NonCompositedContentHost.h" 80 82 #include "Page.h" 81 83 #include "PageGroup.h" … … 2550 2552 2551 2553 setIsAcceleratedCompositingActive(layer); 2552 if (m_ layerTreeHost)2553 m_ layerTreeHost->setRootLayer(layer);2554 if (m_nonCompositedContentHost) 2555 m_nonCompositedContentHost->setRootLayer(layer); 2554 2556 2555 2557 IntRect damagedRect(0, 0, m_size.width, m_size.height); … … 2586 2588 IntRect dirtyRect = view->windowToContents(rect); 2587 2589 updateLayerTreeViewport(); 2588 m_ layerTreeHost->invalidateRootLayerRect(dirtyRect);2590 m_nonCompositedContentHost->invalidateRect(dirtyRect); 2589 2591 setRootLayerNeedsDisplay(); 2590 2592 } … … 2655 2657 ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree(); 2656 2658 2657 m_layerTreeHost = CCLayerTreeHost::create(this, ccSettings); 2659 m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this)); 2660 m_layerTreeHost = CCLayerTreeHost::create(this, m_nonCompositedContentHost->topLevelRootLayer()->platformLayer(), ccSettings); 2658 2661 if (m_layerTreeHost) { 2659 2662 updateLayerTreeViewport(); … … 2739 2742 IntPoint scroll(view->scrollX(), view->scrollY()); 2740 2743 2741 m_layerTreeHost->setViewport(visibleRect.size(), view->contentsSize(), scroll); 2744 m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll); 2745 m_layerTreeHost->setViewport(visibleRect.size()); 2742 2746 } 2743 2747 … … 2781 2785 2782 2786 #if USE(ACCELERATED_COMPOSITING) 2783 if (isAcceleratedCompositingActive()) 2784 m_layerTreeHost->setVisible(visibilityState == WebPageVisibilityStateVisible); 2787 if (isAcceleratedCompositingActive()) { 2788 bool visible = visibilityState == WebPageVisibilityStateVisible; 2789 if (!visible) 2790 m_nonCompositedContentHost->protectVisibleTileTextures(); 2791 m_layerTreeHost->setVisible(visible); 2792 } 2785 2793 #endif 2786 2794 } -
trunk/Source/WebKit/chromium/src/WebViewImpl.h
r94459 r95152 61 61 class HitTestResult; 62 62 class KeyboardEvent; 63 class NonCompositedContentHost; 63 64 class Page; 64 65 class PlatformKeyboardEvent; … … 573 574 #if USE(ACCELERATED_COMPOSITING) 574 575 WebCore::IntRect m_rootLayerScrollDamage; 576 OwnPtr<WebCore::NonCompositedContentHost> m_nonCompositedContentHost; 575 577 RefPtr<WebCore::CCLayerTreeHost> m_layerTreeHost; 576 578 WebCore::GraphicsLayer* m_rootGraphicsLayer;
Note: See TracChangeset
for help on using the changeset viewer.