WebKit Bugzilla
Attachment 349506 Details for
Bug 189521
: Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189521-20180911194602.patch (text/plain), 104.37 KB, created by
Simon Fraser (smfr)
on 2018-09-11 19:46:03 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2018-09-11 19:46:03 PDT
Size:
104.37 KB
patch
obsolete
>Subversion Revision: 235863 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 73ca8f58121ec5d7e748cb2a16207e6ba662d163..02d06ff774ce7b66ed46741dbb948b7670ad6c54 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,135 @@ >+2018-09-11 Simon Fraser <simon.fraser@apple.com> >+ >+ Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings >+ https://bugs.webkit.org/show_bug.cgi?id=189521 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>. >+ >+ RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>. >+ >+ All the other changes are just to adapt to the new ownership patterns. >+ >+ I verified that no GraphicsLayers were leaked or abandoned after this change. >+ >+ No behavior change. >+ >+ * page/PageOverlayController.cpp: >+ (WebCore::PageOverlayController::layerWithDocumentOverlays): >+ (WebCore::PageOverlayController::layerWithViewOverlays): >+ (WebCore::PageOverlayController::installPageOverlay): >+ (WebCore::PageOverlayController::uninstallPageOverlay): >+ (WebCore::PageOverlayController::setPageOverlayNeedsDisplay): >+ (WebCore::PageOverlayController::didChangeViewSize): >+ (WebCore::PageOverlayController::didChangeDocumentSize): >+ (WebCore::PageOverlayController::didChangeSettings): >+ (WebCore::PageOverlayController::paintContents): >+ (WebCore::PageOverlayController::didChangeOverlayFrame): >+ (WebCore::PageOverlayController::didChangeOverlayBackgroundColor): >+ * page/PageOverlayController.h: >+ * page/mac/ServicesOverlayController.h: >+ (WebCore::ServicesOverlayController::Highlight::layer const): >+ * page/mac/ServicesOverlayController.mm: >+ (WebCore::ServicesOverlayController::Highlight::Highlight): >+ (WebCore::ServicesOverlayController::Highlight::invalidate): >+ (WebCore::ServicesOverlayController::Highlight::fadeIn): >+ (WebCore::ServicesOverlayController::Highlight::fadeOut): >+ (WebCore::ServicesOverlayController::Highlight::didFinishFadeOutAnimation): >+ (WebCore::ServicesOverlayController::determineActiveHighlight): >+ * platform/graphics/GraphicsLayer.cpp: >+ (WebCore::GraphicsLayer::GraphicsLayer): >+ (WebCore::GraphicsLayer::willBeDestroyed): >+ (WebCore::GraphicsLayer::setChildren): >+ (WebCore::GraphicsLayer::addChild): >+ (WebCore::GraphicsLayer::addChildAtIndex): >+ (WebCore::GraphicsLayer::addChildBelow): >+ (WebCore::GraphicsLayer::addChildAbove): >+ (WebCore::GraphicsLayer::replaceChild): >+ (WebCore::GraphicsLayer::removeAllChildren): >+ (WebCore::GraphicsLayer::removeFromParent): >+ (WebCore::GraphicsLayer::setMaskLayer): >+ (WebCore::GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants): >+ (WebCore::GraphicsLayer::distributeOpacity): >+ (WebCore::GraphicsLayer::traverse): >+ (WebCore::dumpChildren): >+ * platform/graphics/GraphicsLayer.h: >+ (WebCore::GraphicsLayer::children const): >+ (WebCore::GraphicsLayer::children): >+ (WebCore::GraphicsLayer::maskLayer const): >+ (WebCore::GraphicsLayer::replicaLayer const): >+ (WebCore::GraphicsLayer::beingDestroyed const): >+ (WebCore::GraphicsLayer:: const): Deleted. >+ * platform/graphics/GraphicsLayerFactory.h: >+ * platform/graphics/ca/GraphicsLayerCA.cpp: >+ (WebCore::GraphicsLayer::create): >+ (WebCore::GraphicsLayerCA::setChildren): >+ (WebCore::GraphicsLayerCA::addChild): >+ (WebCore::GraphicsLayerCA::addChildAtIndex): >+ (WebCore::GraphicsLayerCA::addChildBelow): >+ (WebCore::GraphicsLayerCA::addChildAbove): >+ (WebCore::GraphicsLayerCA::replaceChild): >+ (WebCore::GraphicsLayerCA::setMaskLayer): >+ (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const): >+ (WebCore::GraphicsLayerCA::recursiveCommitChanges): >+ (WebCore::GraphicsLayerCA::updateSublayerList): >+ (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): >+ * platform/graphics/ca/GraphicsLayerCA.h: >+ * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: >+ (WebCore::GraphicsLayer::create): >+ (WebCore::GraphicsLayerTextureMapper::setChildren): >+ (WebCore::GraphicsLayerTextureMapper::addChild): >+ (WebCore::GraphicsLayerTextureMapper::addChildAtIndex): >+ (WebCore::GraphicsLayerTextureMapper::addChildAbove): >+ (WebCore::GraphicsLayerTextureMapper::addChildBelow): >+ (WebCore::GraphicsLayerTextureMapper::replaceChild): >+ (WebCore::GraphicsLayerTextureMapper::setMaskLayer): >+ (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers): >+ * platform/graphics/texmap/GraphicsLayerTextureMapper.h: >+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: >+ (WebCore::GraphicsLayer::create): >+ (WebCore::CoordinatedGraphicsLayer::setShouldUpdateVisibleRect): >+ (WebCore::CoordinatedGraphicsLayer::addChild): >+ (WebCore::CoordinatedGraphicsLayer::addChildAtIndex): >+ (WebCore::CoordinatedGraphicsLayer::addChildAbove): >+ (WebCore::CoordinatedGraphicsLayer::addChildBelow): >+ (WebCore::CoordinatedGraphicsLayer::replaceChild): >+ (WebCore::CoordinatedGraphicsLayer::setMaskLayer): >+ (WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers): >+ (WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers): >+ (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded): >+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: >+ * platform/graphics/win/GraphicsLayerDirect2D.cpp: >+ (WebCore::GraphicsLayer::create): >+ (WebCore::GraphicsLayerDirect2D::GraphicsLayerDirect2D): Deleted. >+ (WebCore::GraphicsLayerDirect2D::initialize): Deleted. >+ (WebCore::GraphicsLayerDirect2D::~GraphicsLayerDirect2D): Deleted. >+ (WebCore::GraphicsLayerDirect2D::setNeedsDisplay): Deleted. >+ (WebCore::GraphicsLayerDirect2D::setNeedsDisplayInRect): Deleted. >+ * rendering/RenderLayerBacking.cpp: >+ (WebCore::RenderLayerBacking::createGraphicsLayer): >+ (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): >+ (WebCore::RenderLayerBacking::updateConfiguration): >+ (WebCore::RenderLayerBacking::updateInternalHierarchy): >+ (WebCore::RenderLayerBacking::updateMaskingLayer): >+ (WebCore::RenderLayerBacking::updateChildClippingStrategy): >+ (WebCore::RenderLayerBacking::updateScrollingLayers): >+ * rendering/RenderLayerBacking.h: >+ * rendering/RenderLayerCompositor.cpp: >+ (WebCore::RenderLayerCompositor::updateCompositingLayers): >+ (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): >+ (WebCore::RenderLayerCompositor::setCompositingParent): >+ (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): >+ (WebCore::RenderLayerCompositor::parentFrameContentLayers): >+ (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea): >+ (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea): >+ (WebCore::RenderLayerCompositor::updateLayerForHeader): >+ (WebCore::RenderLayerCompositor::updateLayerForFooter): >+ (WebCore::RenderLayerCompositor::updateOverflowControlsLayers): >+ (WebCore::RenderLayerCompositor::ensureRootLayer): >+ (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): >+ * rendering/RenderLayerCompositor.h: >+ > 2018-09-10 Simon Fraser <simon.fraser@apple.com> > > Many textarea tests leak documents because Document::removeFocusNavigationNodeOfSubtree() can trigger a Document retain cycle >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 90577d93183fd5ce2e249bbcb375ee359100b0d2..96aa8617bde3e63bff59c8ec7f156e90cfabeb0a 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,31 @@ >+2018-09-11 Simon Fraser <simon.fraser@apple.com> >+ >+ Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings >+ https://bugs.webkit.org/show_bug.cgi?id=189521 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>. >+ >+ RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>. >+ >+ All the other changes are just to adapt to the new ownership patterns. >+ >+ I verified that no GraphicsLayers were leaked or abandoned after this change. >+ >+ * WebProcess/WebCoreSupport/WebInspectorClient.cpp: >+ (WebKit::WebInspectorClient::~WebInspectorClient): >+ (WebKit::WebInspectorClient::showPaintRect): >+ (WebKit::WebInspectorClient::animationEndedForLayer): >+ * WebProcess/WebCoreSupport/WebInspectorClient.h: >+ * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: >+ * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: >+ (WebKit::RemoteLayerTreeContext::createGraphicsLayer): >+ * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: >+ * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: >+ (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): >+ (WebKit::RemoteLayerTreeDrawingArea::flushLayers): >+ > 2018-09-10 Daniel Bates <dabates@apple.com> > > [iOS] Arrow keys do not dispatch DOM events to non-editable elements >diff --git a/Source/WebCore/page/PageOverlayController.cpp b/Source/WebCore/page/PageOverlayController.cpp >index 4856ff6e744ddc496d1130143e0a66481d34fabb..04f9a6ca2952d3057c5641be3827fa0a59b16132 100644 >--- a/Source/WebCore/page/PageOverlayController.cpp >+++ b/Source/WebCore/page/PageOverlayController.cpp >@@ -98,14 +98,14 @@ GraphicsLayer& PageOverlayController::layerWithDocumentOverlays() > if (overlay.overlayType() != PageOverlay::OverlayType::Document) > continue; > >- GraphicsLayer& layer = *overlayAndLayer.value; >- GraphicsLayer::traverse(layer, [inWindow](GraphicsLayer& layer) { >+ auto& layer = overlayAndLayer.value; >+ GraphicsLayer::traverse(layer.get(), [inWindow](GraphicsLayer& layer) { > layer.setIsInWindow(inWindow); > }); >- updateOverlayGeometry(overlay, layer); >+ updateOverlayGeometry(overlay, layer.get()); > >- if (!layer.parent()) >- m_documentOverlayRootLayer->addChild(&layer); >+ if (!layer->parent()) >+ m_documentOverlayRootLayer->addChild(layer.copyRef()); > } > > return *m_documentOverlayRootLayer; >@@ -122,14 +122,14 @@ GraphicsLayer& PageOverlayController::layerWithViewOverlays() > if (overlay.overlayType() != PageOverlay::OverlayType::View) > continue; > >- GraphicsLayer& layer = *overlayAndLayer.value; >- GraphicsLayer::traverse(layer, [inWindow](GraphicsLayer& layer) { >+ auto& layer = overlayAndLayer.value; >+ GraphicsLayer::traverse(layer.get(), [inWindow](GraphicsLayer& layer) { > layer.setIsInWindow(inWindow); > }); >- updateOverlayGeometry(overlay, layer); >+ updateOverlayGeometry(overlay, layer.get()); > >- if (!layer.parent()) >- m_viewOverlayRootLayer->addChild(&layer); >+ if (!layer->parent()) >+ m_viewOverlayRootLayer->addChild(layer.copyRef()); > } > > return *m_viewOverlayRootLayer; >@@ -144,12 +144,12 @@ void PageOverlayController::installPageOverlay(PageOverlay& overlay, PageOverlay > > m_pageOverlays.append(&overlay); > >- std::unique_ptr<GraphicsLayer> layer = GraphicsLayer::create(m_page.chrome().client().graphicsLayerFactory(), *this); >+ auto layer = GraphicsLayer::create(m_page.chrome().client().graphicsLayerFactory(), *this); > layer->setAnchorPoint(FloatPoint3D()); > layer->setBackgroundColor(overlay.backgroundColor()); > layer->setName("Overlay content"); > >- updateSettingsForLayer(*layer); >+ updateSettingsForLayer(layer.get()); > > switch (overlay.overlayType()) { > case PageOverlay::OverlayType::View: >@@ -160,7 +160,7 @@ void PageOverlayController::installPageOverlay(PageOverlay& overlay, PageOverlay > break; > } > >- GraphicsLayer& rawLayer = *layer; >+ auto& rawLayer = layer.get(); > m_overlayGraphicsLayers.set(&overlay, WTFMove(layer)); > > updateForceSynchronousScrollLayerPositionUpdates(); >@@ -185,7 +185,8 @@ void PageOverlayController::uninstallPageOverlay(PageOverlay& overlay, PageOverl > > overlay.setPage(nullptr); > >- m_overlayGraphicsLayers.take(&overlay)->removeFromParent(); >+ if (auto optionalLayer = m_overlayGraphicsLayers.take(&overlay)) >+ optionalLayer.value()->removeFromParent(); > > bool removed = m_pageOverlays.removeFirst(&overlay); > ASSERT_UNUSED(removed, removed); >@@ -211,14 +212,14 @@ void PageOverlayController::updateForceSynchronousScrollLayerPositionUpdates() > void PageOverlayController::setPageOverlayNeedsDisplay(PageOverlay& overlay, const WebCore::IntRect& dirtyRect) > { > ASSERT(m_pageOverlays.contains(&overlay)); >- GraphicsLayer& graphicsLayer = *m_overlayGraphicsLayers.get(&overlay); >+ auto* graphicsLayer = m_overlayGraphicsLayers.get(&overlay); > >- if (!graphicsLayer.drawsContent()) { >- graphicsLayer.setDrawsContent(true); >- updateOverlayGeometry(overlay, graphicsLayer); >+ if (!graphicsLayer->drawsContent()) { >+ graphicsLayer->setDrawsContent(true); >+ updateOverlayGeometry(overlay, *graphicsLayer); > } > >- graphicsLayer.setNeedsDisplayInRect(dirtyRect); >+ graphicsLayer->setNeedsDisplayInRect(dirtyRect); > } > > void PageOverlayController::setPageOverlayOpacity(PageOverlay& overlay, float opacity) >@@ -250,7 +251,7 @@ void PageOverlayController::didChangeViewSize() > { > for (auto& overlayAndLayer : m_overlayGraphicsLayers) { > if (overlayAndLayer.key->overlayType() == PageOverlay::OverlayType::View) >- updateOverlayGeometry(*overlayAndLayer.key, *overlayAndLayer.value); >+ updateOverlayGeometry(*overlayAndLayer.key, overlayAndLayer.value.get()); > } > } > >@@ -258,7 +259,7 @@ void PageOverlayController::didChangeDocumentSize() > { > for (auto& overlayAndLayer : m_overlayGraphicsLayers) { > if (overlayAndLayer.key->overlayType() == PageOverlay::OverlayType::Document) >- updateOverlayGeometry(*overlayAndLayer.key, *overlayAndLayer.value); >+ updateOverlayGeometry(*overlayAndLayer.key, overlayAndLayer.value.get()); > } > } > >@@ -266,7 +267,7 @@ void PageOverlayController::didChangeSettings() > { > // FIXME: We should apply these settings to all overlay sublayers recursively. > for (auto& graphicsLayer : m_overlayGraphicsLayers.values()) >- updateSettingsForLayer(*graphicsLayer); >+ updateSettingsForLayer(graphicsLayer.get()); > } > > void PageOverlayController::didChangeDeviceScaleFactor() >@@ -359,7 +360,7 @@ Vector<String> PageOverlayController::copyAccessibilityAttributesNames(bool para > void PageOverlayController::paintContents(const WebCore::GraphicsLayer* graphicsLayer, WebCore::GraphicsContext& graphicsContext, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& clipRect, GraphicsLayerPaintBehavior) > { > for (auto& overlayAndGraphicsLayer : m_overlayGraphicsLayers) { >- if (overlayAndGraphicsLayer.value.get() != graphicsLayer) >+ if (overlayAndGraphicsLayer.value.ptr() != graphicsLayer) > continue; > > GraphicsContextStateSaver stateSaver(graphicsContext); >@@ -383,13 +384,15 @@ void PageOverlayController::notifyFlushRequired(const WebCore::GraphicsLayer*) > void PageOverlayController::didChangeOverlayFrame(PageOverlay& overlay) > { > ASSERT(m_pageOverlays.contains(&overlay)); >- updateOverlayGeometry(overlay, *m_overlayGraphicsLayers.get(&overlay)); >+ if (auto* layer = m_overlayGraphicsLayers.get(&overlay)) >+ updateOverlayGeometry(overlay, *layer); > } > > void PageOverlayController::didChangeOverlayBackgroundColor(PageOverlay& overlay) > { > ASSERT(m_pageOverlays.contains(&overlay)); >- m_overlayGraphicsLayers.get(&overlay)->setBackgroundColor(overlay.backgroundColor()); >+ if (auto* layer = m_overlayGraphicsLayers.get(&overlay)) >+ layer->setBackgroundColor(overlay.backgroundColor()); > } > > bool PageOverlayController::shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior behavior) const >diff --git a/Source/WebCore/page/PageOverlayController.h b/Source/WebCore/page/PageOverlayController.h >index 763a7e2166b1fffe2e4f0ff01d09bec51781a213..76b4545b6dec3c08aaee4170df67837baf2de3b9 100644 >--- a/Source/WebCore/page/PageOverlayController.h >+++ b/Source/WebCore/page/PageOverlayController.h >@@ -92,11 +92,11 @@ private: > bool shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior) const override; > void tiledBackingUsageChanged(const GraphicsLayer*, bool) override; > >- std::unique_ptr<GraphicsLayer> m_documentOverlayRootLayer; >- std::unique_ptr<GraphicsLayer> m_viewOverlayRootLayer; >+ RefPtr<GraphicsLayer> m_documentOverlayRootLayer; >+ RefPtr<GraphicsLayer> m_viewOverlayRootLayer; > bool m_initialized; > >- HashMap<PageOverlay*, std::unique_ptr<GraphicsLayer>> m_overlayGraphicsLayers; >+ HashMap<PageOverlay*, Ref<GraphicsLayer>> m_overlayGraphicsLayers; > Vector<RefPtr<PageOverlay>> m_pageOverlays; > Page& m_page; > }; >diff --git a/Source/WebCore/page/ResourceUsageOverlay.h b/Source/WebCore/page/ResourceUsageOverlay.h >index 16aea601d14e2628745b60404bf79fdbb6d3991c..780b6aa0f869e8aa400a30576f61c10c3da494b8 100644 >--- a/Source/WebCore/page/ResourceUsageOverlay.h >+++ b/Source/WebCore/page/ResourceUsageOverlay.h >@@ -83,7 +83,7 @@ private: > #endif > > #if OS(LINUX) >- std::unique_ptr<GraphicsLayer> m_paintLayer; >+ RefPtr<GraphicsLayer> m_paintLayer; > std::unique_ptr<GraphicsLayerClient> m_overlayPainter; > #endif > }; >diff --git a/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp b/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp >index 13d9ca2dedd4970e997ba26f89e2de051e3db655..c3c87fd66414b205b1b53a389644186a4b2cf012 100644 >--- a/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp >+++ b/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp >@@ -137,7 +137,7 @@ void ResourceUsageOverlay::platformInitialize() > m_paintLayer->setSize({ normalWidth, normalHeight }); > m_paintLayer->setBackgroundColor(Color(0.0f, 0.0f, 0.0f, 0.8f)); > m_paintLayer->setDrawsContent(true); >- overlay().layer().addChild(m_paintLayer.get()); >+ overlay().layer().addChild(*m_paintLayer); > > ResourceUsageThread::addObserver(this, [this] (const ResourceUsageData& data) { > gData = data; >diff --git a/Source/WebCore/page/mac/ServicesOverlayController.h b/Source/WebCore/page/mac/ServicesOverlayController.h >index fad43a85f524549862af9a0e716369c44ad3fbd1..8f8a5fb443eb23e4a3c7f9a8abe7a2a0f45f1893 100644 >--- a/Source/WebCore/page/mac/ServicesOverlayController.h >+++ b/Source/WebCore/page/mac/ServicesOverlayController.h >@@ -63,7 +63,7 @@ private: > > DDHighlightRef ddHighlight() const { return m_ddHighlight.get(); } > Range& range() const { return m_range.get(); } >- GraphicsLayer* layer() const { return m_graphicsLayer.get(); } >+ GraphicsLayer& layer() const { return m_graphicsLayer.get(); } > > enum { > TelephoneNumberType = 1 << 0, >@@ -87,11 +87,11 @@ private: > > void didFinishFadeOutAnimation(); > >+ ServicesOverlayController* m_controller; > RetainPtr<DDHighlightRef> m_ddHighlight; > Ref<Range> m_range; >- std::unique_ptr<GraphicsLayer> m_graphicsLayer; >+ Ref<GraphicsLayer> m_graphicsLayer; > Type m_type; >- ServicesOverlayController* m_controller; > }; > > // PageOverlay::Client >diff --git a/Source/WebCore/page/mac/ServicesOverlayController.mm b/Source/WebCore/page/mac/ServicesOverlayController.mm >index 52db99e0f9e57f3ba358df85f071db785284bc0f..c399df7d0c3fe7b638f03047131967741a3998cb 100644 >--- a/Source/WebCore/page/mac/ServicesOverlayController.mm >+++ b/Source/WebCore/page/mac/ServicesOverlayController.mm >@@ -66,21 +66,20 @@ Ref<ServicesOverlayController::Highlight> ServicesOverlayController::Highlight:: > } > > ServicesOverlayController::Highlight::Highlight(ServicesOverlayController& controller, Type type, RetainPtr<DDHighlightRef> ddHighlight, Ref<WebCore::Range>&& range) >- : m_range(WTFMove(range)) >+ : m_controller(&controller) >+ , m_range(WTFMove(range)) >+ , m_graphicsLayer(GraphicsLayer::create(controller.page().chrome().client().graphicsLayerFactory(), *this)) > , m_type(type) >- , m_controller(&controller) > { > ASSERT(ddHighlight); > >- auto& page = controller.page(); >- m_graphicsLayer = GraphicsLayer::create(page.chrome().client().graphicsLayerFactory(), *this); > m_graphicsLayer->setDrawsContent(true); > > setDDHighlight(ddHighlight.get()); > > // Set directly on the PlatformCALayer so that when we leave the 'from' value implicit > // in our animations, we get the right initial value regardless of flush timing. >- downcast<GraphicsLayerCA>(*layer()).platformCALayer()->setOpacity(0); >+ downcast<GraphicsLayerCA>(layer()).platformCALayer()->setOpacity(0); > > controller.didCreateHighlight(this); > } >@@ -113,7 +112,7 @@ void ServicesOverlayController::Highlight::setDDHighlight(DDHighlightRef highlig > > void ServicesOverlayController::Highlight::invalidate() > { >- layer()->removeFromParent(); >+ layer().removeFromParent(); > m_controller = nullptr; > } > >@@ -159,7 +158,7 @@ void ServicesOverlayController::Highlight::fadeIn() > [animation setToValue:@1]; > > RefPtr<PlatformCAAnimation> platformAnimation = PlatformCAAnimationCocoa::create(animation.get()); >- downcast<GraphicsLayerCA>(*layer()).platformCALayer()->addAnimationForKey("FadeHighlightIn", *platformAnimation); >+ downcast<GraphicsLayerCA>(layer()).platformCALayer()->addAnimationForKey("FadeHighlightIn", *platformAnimation); > } > > void ServicesOverlayController::Highlight::fadeOut() >@@ -177,7 +176,7 @@ void ServicesOverlayController::Highlight::fadeOut() > }]; > > RefPtr<PlatformCAAnimation> platformAnimation = PlatformCAAnimationCocoa::create(animation.get()); >- downcast<GraphicsLayerCA>(*layer()).platformCALayer()->addAnimationForKey("FadeHighlightOut", *platformAnimation); >+ downcast<GraphicsLayerCA>(layer()).platformCALayer()->addAnimationForKey("FadeHighlightOut", *platformAnimation); > [CATransaction commit]; > } > >@@ -189,7 +188,7 @@ void ServicesOverlayController::Highlight::didFinishFadeOutAnimation() > if (m_controller->activeHighlight() == this) > return; > >- layer()->removeFromParent(); >+ layer().removeFromParent(); > } > > static IntRect textQuadsToBoundingRectForRange(Range& range) >@@ -715,7 +714,8 @@ void ServicesOverlayController::determineActiveHighlight(bool& mouseIsOverActive > m_activeHighlight = WTFMove(m_nextActiveHighlight); > > if (m_activeHighlight) { >- m_servicesOverlay->layer().addChild(m_activeHighlight->layer()); >+ Ref<GraphicsLayer> highlightLayer = m_activeHighlight->layer(); >+ m_servicesOverlay->layer().addChild(WTFMove(highlightLayer)); > m_activeHighlight->fadeIn(); > } > } >diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.cpp b/Source/WebCore/platform/graphics/GraphicsLayer.cpp >index 4ed3609f2f65e3adf5242de8bd252d25dc1a7288..62acc8b34049599e2659fe4b3cde72d6dbb154c9 100644 >--- a/Source/WebCore/platform/graphics/GraphicsLayer.cpp >+++ b/Source/WebCore/platform/graphics/GraphicsLayer.cpp >@@ -113,6 +113,7 @@ bool GraphicsLayer::supportsContentsTiling() > GraphicsLayer::GraphicsLayer(Type type, GraphicsLayerClient& client) > : m_client(client) > , m_type(type) >+ , m_beingDestroyed(false) > , m_contentsOpaque(false) > , m_supportsSubpixelAntialiasedText(false) > , m_preserves3D(false) >@@ -143,6 +144,7 @@ GraphicsLayer::~GraphicsLayer() > > void GraphicsLayer::willBeDestroyed() > { >+ m_beingDestroyed = true; > #ifndef NDEBUG > m_client.verifyNotPainting(); > #endif >@@ -177,99 +179,96 @@ bool GraphicsLayer::hasAncestor(GraphicsLayer* ancestor) const > return false; > } > >-bool GraphicsLayer::setChildren(const Vector<GraphicsLayer*>& newChildren) >+bool GraphicsLayer::setChildren(Vector<Ref<GraphicsLayer>>&& newChildren) > { > // If the contents of the arrays are the same, nothing to do. > if (newChildren == m_children) > return false; > > removeAllChildren(); >- >+ > size_t listSize = newChildren.size(); > for (size_t i = 0; i < listSize; ++i) >- addChild(newChildren[i]); >+ addChild(WTFMove(newChildren[i])); > > return true; > } > >-void GraphicsLayer::addChild(GraphicsLayer* childLayer) >+void GraphicsLayer::addChild(Ref<GraphicsLayer>&& childLayer) > { >- ASSERT(childLayer != this); >+ ASSERT(childLayer.ptr() != this); > > if (childLayer->parent()) > childLayer->removeFromParent(); > > childLayer->setParent(this); >- m_children.append(childLayer); >+ m_children.append(WTFMove(childLayer)); > } > >-void GraphicsLayer::addChildAtIndex(GraphicsLayer* childLayer, int index) >+void GraphicsLayer::addChildAtIndex(Ref<GraphicsLayer>&& childLayer, int index) > { >- ASSERT(childLayer != this); >+ ASSERT(childLayer.ptr() != this); > > if (childLayer->parent()) > childLayer->removeFromParent(); > > childLayer->setParent(this); >- m_children.insert(index, childLayer); >+ m_children.insert(index, WTFMove(childLayer)); > } > >-void GraphicsLayer::addChildBelow(GraphicsLayer* childLayer, GraphicsLayer* sibling) >+void GraphicsLayer::addChildBelow(Ref<GraphicsLayer>&& childLayer, GraphicsLayer* sibling) > { >- ASSERT(childLayer != this); >+ ASSERT(childLayer.ptr() != this); > childLayer->removeFromParent(); > >- bool found = false; >+ childLayer->setParent(this); >+ > for (unsigned i = 0; i < m_children.size(); i++) { >- if (sibling == m_children[i]) { >- m_children.insert(i, childLayer); >- found = true; >- break; >+ if (sibling == m_children[i].ptr()) { >+ m_children.insert(i, WTFMove(childLayer)); >+ return; > } > } > >- childLayer->setParent(this); >- >- if (!found) >- m_children.append(childLayer); >+ m_children.append(WTFMove(childLayer)); > } > >-void GraphicsLayer::addChildAbove(GraphicsLayer* childLayer, GraphicsLayer* sibling) >+void GraphicsLayer::addChildAbove(Ref<GraphicsLayer>&& childLayer, GraphicsLayer* sibling) > { > childLayer->removeFromParent(); >- ASSERT(childLayer != this); >+ ASSERT(childLayer.ptr() != this); >+ >+ childLayer->setParent(this); > >- bool found = false; > for (unsigned i = 0; i < m_children.size(); i++) { >- if (sibling == m_children[i]) { >- m_children.insert(i+1, childLayer); >- found = true; >- break; >+ if (sibling == m_children[i].ptr()) { >+ m_children.insert(i + 1, WTFMove(childLayer)); >+ return; > } > } > >- childLayer->setParent(this); >- >- if (!found) >- m_children.append(childLayer); >+ m_children.append(WTFMove(childLayer)); > } > >-bool GraphicsLayer::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild) >+bool GraphicsLayer::replaceChild(GraphicsLayer* oldChild, Ref<GraphicsLayer>&& newChild) > { > ASSERT(!newChild->parent()); >+ >+ GraphicsLayer* rawNewChild = newChild.ptr(); >+ > bool found = false; > for (unsigned i = 0; i < m_children.size(); i++) { >- if (oldChild == m_children[i]) { >- m_children[i] = newChild; >+ if (oldChild == m_children[i].ptr()) { >+ m_children[i] = WTFMove(newChild); > found = true; > break; > } > } > if (found) { >- oldChild->setParent(0); >+ oldChild->setParent(nullptr); > >- newChild->removeFromParent(); >- newChild->setParent(this); >+ rawNewChild->removeFromParent(); >+ rawNewChild->setParent(this); > return true; > } > return false; >@@ -278,17 +277,22 @@ bool GraphicsLayer::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChil > void GraphicsLayer::removeAllChildren() > { > while (m_children.size()) { >- GraphicsLayer* curLayer = m_children[0]; >+ GraphicsLayer* curLayer = m_children[0].ptr(); > ASSERT(curLayer->parent()); > curLayer->removeFromParent(); >+ // curLayer may be destroyed here. > } > } > > void GraphicsLayer::removeFromParent() > { > if (m_parent) { >- m_parent->m_children.removeFirst(this); >+ GraphicsLayer* parent = m_parent; > setParent(nullptr); >+ parent->m_children.removeFirstMatching([this](auto& layer) { >+ return layer.ptr() == this; >+ }); >+ // |this| may be destroyed here. > } > } > >@@ -318,7 +322,7 @@ void GraphicsLayer::setChildrenTransform(const TransformationMatrix& matrix) > m_childrenTransform = std::make_unique<TransformationMatrix>(matrix); > } > >-void GraphicsLayer::setMaskLayer(GraphicsLayer* layer) >+void GraphicsLayer::setMaskLayer(RefPtr<GraphicsLayer>&& layer) > { > if (layer == m_maskLayer) > return; >@@ -332,7 +336,7 @@ void GraphicsLayer::setMaskLayer(GraphicsLayer* layer) > m_maskLayer->setIsMaskLayer(false); > } > >- m_maskLayer = layer; >+ m_maskLayer = WTFMove(layer); > } > > Path GraphicsLayer::shapeLayerPath() const >@@ -381,10 +385,8 @@ void GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants() > if (m_replicaLayer) > m_replicaLayer->noteDeviceOrPageScaleFactorChangedIncludingDescendants(); > >- const Vector<GraphicsLayer*>& childLayers = children(); >- size_t numChildren = childLayers.size(); >- for (size_t i = 0; i < numChildren; ++i) >- childLayers[i]->noteDeviceOrPageScaleFactorChangedIncludingDescendants(); >+ for (auto& layer : children()) >+ layer->noteDeviceOrPageScaleFactorChangedIncludingDescendants(); > } > > void GraphicsLayer::setIsInWindow(bool inWindow) >@@ -534,9 +536,8 @@ void GraphicsLayer::distributeOpacity(float accumulatedOpacity) > setOpacityInternal(accumulatedOpacity); > > if (preserves3D()) { >- size_t numChildren = children().size(); >- for (size_t i = 0; i < numChildren; ++i) >- children()[i]->distributeOpacity(accumulatedOpacity); >+ for (auto& layer : children()) >+ layer->distributeOpacity(accumulatedOpacity); > } > } > >@@ -693,8 +694,8 @@ void GraphicsLayer::traverse(GraphicsLayer& layer, const WTF::Function<void (Gra > { > traversalFunc(layer); > >- for (auto* childLayer : layer.children()) >- traverse(*childLayer, traversalFunc); >+ for (auto& childLayer : layer.children()) >+ traverse(childLayer.get(), traversalFunc); > > if (auto* replicaLayer = layer.replicaLayer()) > traverse(*replicaLayer, traversalFunc); >@@ -717,11 +718,11 @@ void GraphicsLayer::dumpLayer(TextStream& ts, LayerTreeAsTextBehavior behavior) > ts << indent << ")\n"; > } > >-static void dumpChildren(TextStream& ts, const Vector<GraphicsLayer*>& children, unsigned& totalChildCount, LayerTreeAsTextBehavior behavior) >+static void dumpChildren(TextStream& ts, const Vector<Ref<GraphicsLayer>>& children, unsigned& totalChildCount, LayerTreeAsTextBehavior behavior) > { > totalChildCount += children.size(); >- for (auto* child : children) { >- if ((behavior & LayerTreeAsTextDebug) || !child->client().shouldSkipLayerInDump(child, behavior)) { >+ for (auto& child : children) { >+ if ((behavior & LayerTreeAsTextDebug) || !child->client().shouldSkipLayerInDump(child.ptr(), behavior)) { > TextStream::IndentScope indentScope(ts); > child->dumpLayer(ts, behavior); > continue; >diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.h b/Source/WebCore/platform/graphics/GraphicsLayer.h >index 202409be87e3b65a5b0a3b92623d065a433453b4..38adf191945fac9bd6297cd84bf4c06701e8c29e 100644 >--- a/Source/WebCore/platform/graphics/GraphicsLayer.h >+++ b/Source/WebCore/platform/graphics/GraphicsLayer.h >@@ -230,8 +230,8 @@ protected: > // GraphicsLayer is an abstraction for a rendering surface with backing store, > // which may have associated transformation and animations. > >-class GraphicsLayer { >- WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED; >+class GraphicsLayer : public RefCounted<GraphicsLayer> { >+ WTF_MAKE_FAST_ALLOCATED; > public: > enum class Type : uint8_t { > Normal, >@@ -239,8 +239,8 @@ public: > Scrolling, > Shape > }; >- >- WEBCORE_EXPORT static std::unique_ptr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient&, Type = Type::Normal); >+ >+ WEBCORE_EXPORT static Ref<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient&, Type = Type::Normal); > > WEBCORE_EXPORT virtual ~GraphicsLayer(); > >@@ -263,32 +263,25 @@ public: > // Returns true if the layer has the given layer as an ancestor (excluding self). > bool hasAncestor(GraphicsLayer*) const; > >- const Vector<GraphicsLayer*>& children() const { return m_children; } >- // Returns true if the child list changed. >- WEBCORE_EXPORT virtual bool setChildren(const Vector<GraphicsLayer*>&); >+ const Vector<Ref<GraphicsLayer>>& children() const { return m_children; } >+ Vector<Ref<GraphicsLayer>>& children() { return m_children; } > >- enum class ContentsLayerPurpose : uint8_t { >- None = 0, >- Image, >- Media, >- Canvas, >- BackgroundColor, >- Plugin >- }; >+ // Returns true if the child list changed. >+ WEBCORE_EXPORT virtual bool setChildren(Vector<Ref<GraphicsLayer>>&&); > > // Add child layers. If the child is already parented, it will be removed from its old parent. >- WEBCORE_EXPORT virtual void addChild(GraphicsLayer*); >- WEBCORE_EXPORT virtual void addChildAtIndex(GraphicsLayer*, int index); >- WEBCORE_EXPORT virtual void addChildAbove(GraphicsLayer*, GraphicsLayer* sibling); >- WEBCORE_EXPORT virtual void addChildBelow(GraphicsLayer*, GraphicsLayer* sibling); >- WEBCORE_EXPORT virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild); >+ WEBCORE_EXPORT virtual void addChild(Ref<GraphicsLayer>&&); >+ WEBCORE_EXPORT virtual void addChildAtIndex(Ref<GraphicsLayer>&&, int index); >+ WEBCORE_EXPORT virtual void addChildAbove(Ref<GraphicsLayer>&&, GraphicsLayer* sibling); >+ WEBCORE_EXPORT virtual void addChildBelow(Ref<GraphicsLayer>&&, GraphicsLayer* sibling); >+ WEBCORE_EXPORT virtual bool replaceChild(GraphicsLayer* oldChild, Ref<GraphicsLayer>&& newChild); > > WEBCORE_EXPORT void removeAllChildren(); > WEBCORE_EXPORT virtual void removeFromParent(); > > // The parent() of a maskLayer is set to the layer being masked. >- GraphicsLayer* maskLayer() const { return m_maskLayer; } >- virtual void setMaskLayer(GraphicsLayer*); >+ GraphicsLayer* maskLayer() const { return m_maskLayer.get(); } >+ virtual void setMaskLayer(RefPtr<GraphicsLayer>&&); > > void setIsMaskLayer(bool isMask) { m_isMaskLayer = isMask; } > bool isMaskLayer() const { return m_isMaskLayer; } >@@ -298,7 +291,7 @@ public: > // Whether this layer is being replicated by another layer. > bool isReplicated() const { return m_replicaLayer; } > // The layer that replicates this layer (if any). >- GraphicsLayer* replicaLayer() const { return m_replicaLayer; } >+ GraphicsLayer* replicaLayer() const { return m_replicaLayer.get(); } > > const FloatPoint& replicatedLayerPosition() const { return m_replicatedLayerPosition; } > void setReplicatedLayerPosition(const FloatPoint& p) { m_replicatedLayerPosition = p; } >@@ -466,6 +459,16 @@ public: > #if PLATFORM(IOS) > virtual PlatformLayer* contentsLayerForMedia() const { return 0; } > #endif >+ >+ enum class ContentsLayerPurpose : uint8_t { >+ None = 0, >+ Image, >+ Media, >+ Canvas, >+ BackgroundColor, >+ Plugin >+ }; >+ > // Pass an invalid color to remove the contents layer. > virtual void setContentsToSolidColor(const Color&) { } > virtual void setContentsToPlatformLayer(PlatformLayer*, ContentsLayerPurpose) { } >@@ -591,6 +594,7 @@ protected: > > // Should be called from derived class destructors. Should call willBeDestroyed() on super. > WEBCORE_EXPORT virtual void willBeDestroyed(); >+ bool beingDestroyed() const { return m_beingDestroyed; } > > // This method is used by platform GraphicsLayer classes to clear the filters > // when compositing is not done in hardware. It is not virtual, so the caller >@@ -656,6 +660,7 @@ protected: > GraphicsLayerPaintingPhase m_paintingPhase { GraphicsLayerPaintAllWithOverflowClip }; > CompositingCoordinatesOrientation m_contentsOrientation { CompositingCoordinatesOrientation::TopDown }; // affects orientation of layer contents > >+ bool m_beingDestroyed : 1; > bool m_contentsOpaque : 1; > bool m_supportsSubpixelAntialiasedText : 1; > bool m_preserves3D: 1; >@@ -675,12 +680,12 @@ protected: > > int m_repaintCount { 0 }; > >- Vector<GraphicsLayer*> m_children; >+ Vector<Ref<GraphicsLayer>> m_children; > GraphicsLayer* m_parent { nullptr }; > >- GraphicsLayer* m_maskLayer { nullptr }; // Reference to mask layer. We don't own this. >+ RefPtr<GraphicsLayer> m_maskLayer { nullptr }; // Reference to mask layer. > >- GraphicsLayer* m_replicaLayer { nullptr }; // A layer that replicates this layer. We only allow one, for now. >+ RefPtr<GraphicsLayer> m_replicaLayer { nullptr }; // A layer that replicates this layer. We only allow one, for now. > // The replica is not parented; this is the primary reference to it. > GraphicsLayer* m_replicatedLayer { nullptr }; // For a replica layer, a reference to the original layer. > FloatPoint m_replicatedLayerPosition; // For a replica layer, the position of the replica. >diff --git a/Source/WebCore/platform/graphics/GraphicsLayerFactory.h b/Source/WebCore/platform/graphics/GraphicsLayerFactory.h >index a7405fc23013021cafd9f1d8dbb94d5f09c7cec5..a7e61041f3cdca56ea75883971d7e758fa7395a7 100644 >--- a/Source/WebCore/platform/graphics/GraphicsLayerFactory.h >+++ b/Source/WebCore/platform/graphics/GraphicsLayerFactory.h >@@ -23,8 +23,7 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef GraphicsLayerFactory_h >-#define GraphicsLayerFactory_h >+#pragma once > > #include "GraphicsLayer.h" > #include <wtf/Forward.h> >@@ -35,9 +34,7 @@ class GraphicsLayerFactory { > public: > virtual ~GraphicsLayerFactory() = default; > >- virtual std::unique_ptr<GraphicsLayer> createGraphicsLayer(GraphicsLayer::Type, GraphicsLayerClient&) = 0; >+ virtual Ref<GraphicsLayer> createGraphicsLayer(GraphicsLayer::Type, GraphicsLayerClient&) = 0; > }; > > } // namespace WebCore >- >-#endif // GraphicsLayerFactory_h >diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >index cf1aa41e8fc6c3bfb5e405d3d22d3601bd4d2dca..23b0664195951249dddc6e1b38691bdd260bed5d 100644 >--- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >+++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >@@ -339,17 +339,17 @@ bool GraphicsLayer::supportsSubpixelAntialiasedLayerText() > #endif > } > >-std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType) >+Ref<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType) > { >- std::unique_ptr<GraphicsLayer> graphicsLayer; >- if (!factory) >- graphicsLayer = std::make_unique<GraphicsLayerCA>(layerType, client); >- else >- graphicsLayer = factory->createGraphicsLayer(layerType, client); >- >- graphicsLayer->initialize(layerType); >- >- return graphicsLayer; >+ if (factory) { >+ auto layer = factory->createGraphicsLayer(layerType, client); >+ layer->initialize(layerType); >+ return layer; >+ } >+ >+ auto layer = adoptRef(*new GraphicsLayerCA(layerType, client)); >+ layer->initialize(layerType); >+ return WTFMove(layer); > } > > bool GraphicsLayerCA::filtersCanBeComposited(const FilterOperations& filters) >@@ -505,42 +505,42 @@ PlatformLayer* GraphicsLayerCA::platformLayer() const > return primaryLayer()->platformLayer(); > } > >-bool GraphicsLayerCA::setChildren(const Vector<GraphicsLayer*>& children) >+bool GraphicsLayerCA::setChildren(Vector<Ref<GraphicsLayer>>&& children) > { >- bool childrenChanged = GraphicsLayer::setChildren(children); >+ bool childrenChanged = GraphicsLayer::setChildren(WTFMove(children)); > if (childrenChanged) > noteSublayersChanged(); > > return childrenChanged; > } > >-void GraphicsLayerCA::addChild(GraphicsLayer* childLayer) >+void GraphicsLayerCA::addChild(Ref<GraphicsLayer>&& childLayer) > { >- GraphicsLayer::addChild(childLayer); >+ GraphicsLayer::addChild(WTFMove(childLayer)); > noteSublayersChanged(); > } > >-void GraphicsLayerCA::addChildAtIndex(GraphicsLayer* childLayer, int index) >+void GraphicsLayerCA::addChildAtIndex(Ref<GraphicsLayer>&& childLayer, int index) > { >- GraphicsLayer::addChildAtIndex(childLayer, index); >+ GraphicsLayer::addChildAtIndex(WTFMove(childLayer), index); > noteSublayersChanged(); > } > >-void GraphicsLayerCA::addChildBelow(GraphicsLayer* childLayer, GraphicsLayer* sibling) >+void GraphicsLayerCA::addChildBelow(Ref<GraphicsLayer>&& childLayer, GraphicsLayer* sibling) > { >- GraphicsLayer::addChildBelow(childLayer, sibling); >+ GraphicsLayer::addChildBelow(WTFMove(childLayer), sibling); > noteSublayersChanged(); > } > >-void GraphicsLayerCA::addChildAbove(GraphicsLayer* childLayer, GraphicsLayer* sibling) >+void GraphicsLayerCA::addChildAbove(Ref<GraphicsLayer>&& childLayer, GraphicsLayer* sibling) > { >- GraphicsLayer::addChildAbove(childLayer, sibling); >+ GraphicsLayer::addChildAbove(WTFMove(childLayer), sibling); > noteSublayersChanged(); > } > >-bool GraphicsLayerCA::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild) >+bool GraphicsLayerCA::replaceChild(GraphicsLayer* oldChild, Ref<GraphicsLayer>&& newChild) > { >- if (GraphicsLayer::replaceChild(oldChild, newChild)) { >+ if (GraphicsLayer::replaceChild(oldChild, WTFMove(newChild))) { > noteSublayersChanged(); > return true; > } >@@ -554,12 +554,12 @@ void GraphicsLayerCA::removeFromParent() > GraphicsLayer::removeFromParent(); > } > >-void GraphicsLayerCA::setMaskLayer(GraphicsLayer* layer) >+void GraphicsLayerCA::setMaskLayer(RefPtr<GraphicsLayer>&& layer) > { > if (layer == m_maskLayer) > return; > >- GraphicsLayer::setMaskLayer(layer); >+ GraphicsLayer::setMaskLayer(WTFMove(layer)); > noteLayerPropertyChanged(MaskLayerChanged); > > propagateLayerChangeToReplicas(); >@@ -1300,16 +1300,13 @@ bool GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush(const CommitState& > childCommitState.ancestorIsViewportConstrained |= m_isViewportConstrained; > > if (m_maskLayer) { >- GraphicsLayerCA& maskLayerCA = downcast<GraphicsLayerCA>(*m_maskLayer); >+ auto& maskLayerCA = downcast<GraphicsLayerCA>(*m_maskLayer); > if (maskLayerCA.recursiveVisibleRectChangeRequiresFlush(childCommitState, localState)) > return true; > } > >- const Vector<GraphicsLayer*>& childLayers = children(); >- size_t numChildren = childLayers.size(); >- >- for (size_t i = 0; i < numChildren; ++i) { >- GraphicsLayerCA& currentChild = downcast<GraphicsLayerCA>(*childLayers[i]); >+ for (const auto& layer : children()) { >+ const auto& currentChild = downcast<GraphicsLayerCA>(layer.get()); > if (currentChild.recursiveVisibleRectChangeRequiresFlush(childCommitState, localState)) > return true; > } >@@ -1572,28 +1569,25 @@ void GraphicsLayerCA::recursiveCommitChanges(const CommitState& commitState, con > > childCommitState.ancestorIsViewportConstrained |= m_isViewportConstrained; > >- if (GraphicsLayerCA* maskLayer = downcast<GraphicsLayerCA>(m_maskLayer)) { >+ if (GraphicsLayerCA* maskLayer = downcast<GraphicsLayerCA>(m_maskLayer.get())) { > maskLayer->setVisibleAndCoverageRects(rects, m_isViewportConstrained || commitState.ancestorIsViewportConstrained); > maskLayer->commitLayerChangesBeforeSublayers(childCommitState, pageScaleFactor, baseRelativePosition); > } > >- const Vector<GraphicsLayer*>& childLayers = children(); >- size_t numChildren = childLayers.size(); >- > bool hasDescendantsWithRunningTransformAnimations = false; > >- for (size_t i = 0; i < numChildren; ++i) { >- GraphicsLayerCA& currentChild = downcast<GraphicsLayerCA>(*childLayers[i]); >+ for (auto& layer : children()) { >+ auto& currentChild = downcast<GraphicsLayerCA>(layer.get()); > currentChild.recursiveCommitChanges(childCommitState, localState, pageScaleFactor, baseRelativePosition, affectedByPageScale); > > if (currentChild.isRunningTransformAnimation() || currentChild.hasDescendantsWithRunningTransformAnimations()) > hasDescendantsWithRunningTransformAnimations = true; > } > >- if (GraphicsLayerCA* replicaLayer = downcast<GraphicsLayerCA>(m_replicaLayer)) >+ if (GraphicsLayerCA* replicaLayer = downcast<GraphicsLayerCA>(m_replicaLayer.get())) > replicaLayer->recursiveCommitChanges(childCommitState, localState, pageScaleFactor, baseRelativePosition, affectedByPageScale); > >- if (GraphicsLayerCA* maskLayer = downcast<GraphicsLayerCA>(m_maskLayer)) >+ if (GraphicsLayerCA* maskLayer = downcast<GraphicsLayerCA>(m_maskLayer.get())) > maskLayer->commitLayerChangesAfterSublayers(childCommitState); > > setHasDescendantsWithUncommittedChanges(false); >@@ -1928,10 +1922,8 @@ void GraphicsLayerCA::updateSublayerList(bool maxLayerDepthReached) > primaryLayerChildren.append(m_contentsClippingLayer ? m_contentsClippingLayer : m_contentsLayer); > } > >- const Vector<GraphicsLayer*>& childLayers = children(); >- size_t numChildren = childLayers.size(); >- for (size_t i = 0; i < numChildren; ++i) { >- GraphicsLayerCA& currentChild = downcast<GraphicsLayerCA>(*childLayers[i]); >+ for (const auto& layer : children()) { >+ const auto& currentChild = downcast<GraphicsLayerCA>(layer.get()); > PlatformCALayer* childLayer = currentChild.layerForSuperlayer(); > childListForSublayers.append(childLayer); > } >@@ -3977,7 +3969,7 @@ RefPtr<PlatformCALayer> GraphicsLayerCA::fetchCloneLayers(GraphicsLayer* replica > return primaryLayer; > } > >- const Vector<GraphicsLayer*>& childLayers = children(); >+ auto& childLayers = children(); > Vector<RefPtr<PlatformCALayer>> clonalSublayers; > > RefPtr<PlatformCALayer> replicaLayer; >@@ -4027,8 +4019,8 @@ RefPtr<PlatformCALayer> GraphicsLayerCA::fetchCloneLayers(GraphicsLayer* replica > > replicaState.push(ReplicaState::ChildBranch); > >- for (auto* childLayer : childLayers) { >- GraphicsLayerCA& childLayerCA = downcast<GraphicsLayerCA>(*childLayer); >+ for (auto& childLayer : childLayers) { >+ GraphicsLayerCA& childLayerCA = downcast<GraphicsLayerCA>(childLayer.get()); > if (auto platformLayer = childLayerCA.fetchCloneLayers(replicaRoot, replicaState, IntermediateCloneLevel)) > clonalSublayers.append(WTFMove(platformLayer)); > } >@@ -4192,6 +4184,9 @@ void GraphicsLayerCA::setHasDescendantsWithUncommittedChanges(bool value) > > void GraphicsLayerCA::noteLayerPropertyChanged(LayerChangeFlags flags, ScheduleFlushOrNot scheduleFlush) > { >+ if (beingDestroyed()) >+ return; >+ > bool hadUncommittedChanges = !!m_uncommittedChanges; > bool oldCanThrottleLayerFlush = canThrottleLayerFlush(); > >diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h >index cc307fb492ec0ae37304163364b95af1cfa0399a..8213ec4e3a9fe4f011357f63ec2722add3117d7d 100644 >--- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h >+++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h >@@ -49,7 +49,6 @@ class TransformState; > > class GraphicsLayerCA : public GraphicsLayer, public PlatformCALayerClient { > public: >- > WEBCORE_EXPORT explicit GraphicsLayerCA(Type, GraphicsLayerClient&); > WEBCORE_EXPORT virtual ~GraphicsLayerCA(); > >@@ -62,16 +61,16 @@ public: > WEBCORE_EXPORT PlatformLayer* platformLayer() const override; > PlatformCALayer* platformCALayer() const { return primaryLayer(); } > >- WEBCORE_EXPORT bool setChildren(const Vector<GraphicsLayer*>&) override; >- WEBCORE_EXPORT void addChild(GraphicsLayer*) override; >- WEBCORE_EXPORT void addChildAtIndex(GraphicsLayer*, int index) override; >- WEBCORE_EXPORT void addChildAbove(GraphicsLayer*, GraphicsLayer* sibling) override; >- WEBCORE_EXPORT void addChildBelow(GraphicsLayer*, GraphicsLayer* sibling) override; >- WEBCORE_EXPORT bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild) override; >+ WEBCORE_EXPORT bool setChildren(Vector<Ref<GraphicsLayer>>&&) override; >+ WEBCORE_EXPORT void addChild(Ref<GraphicsLayer>&&) override; >+ WEBCORE_EXPORT void addChildAtIndex(Ref<GraphicsLayer>&&, int index) override; >+ WEBCORE_EXPORT void addChildAbove(Ref<GraphicsLayer>&&, GraphicsLayer* sibling) override; >+ WEBCORE_EXPORT void addChildBelow(Ref<GraphicsLayer>&&, GraphicsLayer* sibling) override; >+ WEBCORE_EXPORT bool replaceChild(GraphicsLayer* oldChild, Ref<GraphicsLayer>&& newChild) override; > > WEBCORE_EXPORT void removeFromParent() override; > >- WEBCORE_EXPORT void setMaskLayer(GraphicsLayer*) override; >+ WEBCORE_EXPORT void setMaskLayer(RefPtr<GraphicsLayer>&&) override; > WEBCORE_EXPORT void setReplicatedLayer(GraphicsLayer*) override; > > WEBCORE_EXPORT void setPosition(const FloatPoint&) override; >diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp >index 0cec0c5b3f67fa7fd870e1ed78c5e54d49252610..1451a4ca861eee896d5e4f9b7dee9dabfa31ec47 100644 >--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp >+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp >@@ -29,10 +29,10 @@ > > namespace WebCore { > >-std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType) >+Ref<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType) > { > if (!factory) >- return std::make_unique<GraphicsLayerTextureMapper>(layerType, client); >+ return adoptRef(*new GraphicsLayerTextureMapper(layerType, client)); > > return factory->createGraphicsLayer(layerType, client); > } >@@ -93,59 +93,61 @@ void GraphicsLayerTextureMapper::setNeedsDisplayInRect(const FloatRect& rect, Sh > addRepaintRect(rect); > } > >-bool GraphicsLayerTextureMapper::setChildren(const Vector<GraphicsLayer*>& children) >+bool GraphicsLayerTextureMapper::setChildren(Vector<Ref<GraphicsLayer>>&& children) > { >- if (GraphicsLayer::setChildren(children)) { >+ if (GraphicsLayer::setChildren(WTFMove(children))) { > notifyChange(ChildrenChange); > return true; > } > return false; > } > >-void GraphicsLayerTextureMapper::addChild(GraphicsLayer* layer) >+void GraphicsLayerTextureMapper::addChild(Ref<GraphicsLayer>&& layer) > { > notifyChange(ChildrenChange); >- GraphicsLayer::addChild(layer); >+ GraphicsLayer::addChild(WTFMove(layer)); > } > >-void GraphicsLayerTextureMapper::addChildAtIndex(GraphicsLayer* layer, int index) >+void GraphicsLayerTextureMapper::addChildAtIndex(Ref<GraphicsLayer>&& layer, int index) > { >- GraphicsLayer::addChildAtIndex(layer, index); >+ GraphicsLayer::addChildAtIndex(WTFMove(layer), index); > notifyChange(ChildrenChange); > } > >-void GraphicsLayerTextureMapper::addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling) >+void GraphicsLayerTextureMapper::addChildAbove(Ref<GraphicsLayer>&& layer, GraphicsLayer* sibling) > { >- GraphicsLayer::addChildAbove(layer, sibling); >+ GraphicsLayer::addChildAbove(WTFMove(layer), sibling); > notifyChange(ChildrenChange); > } > >-void GraphicsLayerTextureMapper::addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling) >+void GraphicsLayerTextureMapper::addChildBelow(Ref<GraphicsLayer>&& layer, GraphicsLayer* sibling) > { >- GraphicsLayer::addChildBelow(layer, sibling); >+ GraphicsLayer::addChildBelow(WTFMove(layer), sibling); > notifyChange(ChildrenChange); > } > >-bool GraphicsLayerTextureMapper::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild) >+bool GraphicsLayerTextureMapper::replaceChild(GraphicsLayer* oldChild, Ref<GraphicsLayer>&& newChild) > { >- if (GraphicsLayer::replaceChild(oldChild, newChild)) { >+ if (GraphicsLayer::replaceChild(oldChild, WTFMove(newChild))) { > notifyChange(ChildrenChange); > return true; > } > return false; > } > >-void GraphicsLayerTextureMapper::setMaskLayer(GraphicsLayer* value) >+void GraphicsLayerTextureMapper::setMaskLayer(RefPtr<GraphicsLayer>&& value) > { > if (value == maskLayer()) > return; >- GraphicsLayer::setMaskLayer(value); >+ >+ GraphicsLayer* rawLayer = value.get(); >+ GraphicsLayer::setMaskLayer(WTFMove(value)); > notifyChange(MaskLayerChange); > >- if (!value) >+ if (!rawLayer) > return; >- value->setSize(size()); >- value->setContentsVisible(contentsAreVisible()); >+ rawLayer->setSize(size()); >+ rawLayer->setContentsVisible(contentsAreVisible()); > } > > >@@ -493,7 +495,7 @@ void GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers() > if (replicaLayer()) > downcast<GraphicsLayerTextureMapper>(*replicaLayer()).updateBackingStoreIfNeeded(); > for (auto* child : children()) >- downcast<GraphicsLayerTextureMapper>(*child).updateBackingStoreIncludingSubLayers(); >+ downcast<GraphicsLayerTextureMapper>(child.get()).updateBackingStoreIncludingSubLayers(); > } > > void GraphicsLayerTextureMapper::updateBackingStoreIfNeeded() >diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h >index 3fda5f182ff838b98b80539347c0dde901349422..fc91d927d0c2c179f29a80931d826b19e42f77c6 100644 >--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h >+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h >@@ -39,14 +39,14 @@ public: > void setID(uint32_t id) { m_layer.setID(id); } > > // GraphicsLayer >- bool setChildren(const Vector<GraphicsLayer*>&) override; >- void addChild(GraphicsLayer*) override; >- void addChildAtIndex(GraphicsLayer*, int index) override; >- void addChildAbove(GraphicsLayer*, GraphicsLayer* sibling) override; >- void addChildBelow(GraphicsLayer*, GraphicsLayer* sibling) override; >- bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild) override; >- >- void setMaskLayer(GraphicsLayer*) override; >+ bool setChildren(Vector<Ref<GraphicsLayer>>&&) override; >+ void addChild(Ref<GraphicsLayer>&&) override; >+ void addChildAtIndex(Ref<GraphicsLayer>&&, int index) override; >+ void addChildAbove(Ref<GraphicsLayer>&&, GraphicsLayer* sibling) override; >+ void addChildBelow(Ref<GraphicsLayer>&&, GraphicsLayer* sibling) override; >+ bool replaceChild(GraphicsLayer* oldChild, Ref<GraphicsLayer>&& newChild) override; >+ >+ void setMaskLayer(RefPtr<GraphicsLayer>&&) override; > void setReplicatedByLayer(GraphicsLayer*) override; > void setPosition(const FloatPoint&) override; > void setAnchorPoint(const FloatPoint3D&) override; >diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp >index 196297bd85cd43680d0ed26bc11954312e8039ac..a9a94aa0bfd7ac4b5fa128dc7ff72fda2f2fdde7 100644 >--- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp >+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp >@@ -448,11 +448,11 @@ void TextureMapperLayer::paintRecursive(const TextureMapperPaintOptions& options > } > > #if !USE(COORDINATED_GRAPHICS) >-void TextureMapperLayer::setChildren(const Vector<GraphicsLayer*>& newChildren) >+void TextureMapperLayer::setChildren(Vector<Ref<GraphicsLayer>>&& newChildren) > { > removeAllChildren(); >- for (auto* child : newChildren) >- addChild(&downcast<GraphicsLayerTextureMapper>(child)->layer()); >+ for (auto& child : newChildren) >+ addChild(&downcast<GraphicsLayerTextureMapper>(child.get()).layer()); > } > #endif > >diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h >index ea259ba1006b256eb1af8f699aee9322b1cc5eb2..6eef8c48ddffc6c1ad682270986a48cb6bf5cdd4 100644 >--- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h >+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h >@@ -50,7 +50,7 @@ public: > void setTextureMapper(TextureMapper* texmap) { m_textureMapper = texmap; } > > #if !USE(COORDINATED_GRAPHICS) >- void setChildren(const Vector<GraphicsLayer*>&); >+ void setChildren(Vector<Ref<GraphicsLayer>>&&); > #endif > void setChildren(const Vector<TextureMapperLayer*>&); > void setMaskLayer(TextureMapperLayer*); >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >index 09e56f331828c5bc05f4d4b983fb667f67896585..a078e4a6d44505809a8876a44993163bc862dd62 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >@@ -46,10 +46,10 @@ > > namespace WebCore { > >-std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType) >+Ref<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType) > { > if (!factory) >- return std::make_unique<CoordinatedGraphicsLayer>(layerType, client); >+ return adoptRef(*new CoordinatedGraphicsLayer(layerType, client)); > > return factory->createGraphicsLayer(layerType, client); > } >@@ -97,7 +97,7 @@ void CoordinatedGraphicsLayer::setShouldUpdateVisibleRect() > { > m_shouldUpdateVisibleRect = true; > for (auto& child : children()) >- downcast<CoordinatedGraphicsLayer>(*child).setShouldUpdateVisibleRect(); >+ downcast<CoordinatedGraphicsLayer>(child.get()).setShouldUpdateVisibleRect(); > if (replicaLayer()) > downcast<CoordinatedGraphicsLayer>(*replicaLayer()).setShouldUpdateVisibleRect(); > } >@@ -158,49 +158,54 @@ auto CoordinatedGraphicsLayer::primaryLayerID() const -> PlatformLayerID > return id(); > } > >-bool CoordinatedGraphicsLayer::setChildren(const Vector<GraphicsLayer*>& children) >+bool CoordinatedGraphicsLayer::setChildren(Vector<Ref<GraphicsLayer>>&& children) > { >- bool ok = GraphicsLayer::setChildren(children); >+ bool ok = GraphicsLayer::setChildren(WTFMove(children)); > if (!ok) > return false; > didChangeChildren(); > return true; > } > >-void CoordinatedGraphicsLayer::addChild(GraphicsLayer* layer) >+void CoordinatedGraphicsLayer::addChild(Ref<GraphicsLayer>&& layer) > { >- GraphicsLayer::addChild(layer); >- downcast<CoordinatedGraphicsLayer>(*layer).setCoordinatorIncludingSubLayersIfNeeded(m_coordinator); >+ GraphicsLayer* rawLayer = layer.ptr(); >+ GraphicsLayer::addChild(WTFMove(layer)); >+ downcast<CoordinatedGraphicsLayer>(*rawLayer).setCoordinatorIncludingSubLayersIfNeeded(m_coordinator); > didChangeChildren(); > } > >-void CoordinatedGraphicsLayer::addChildAtIndex(GraphicsLayer* layer, int index) >+void CoordinatedGraphicsLayer::addChildAtIndex(Ref<GraphicsLayer>&& layer, int index) > { >- GraphicsLayer::addChildAtIndex(layer, index); >- downcast<CoordinatedGraphicsLayer>(*layer).setCoordinatorIncludingSubLayersIfNeeded(m_coordinator); >+ GraphicsLayer* rawLayer = layer.ptr(); >+ GraphicsLayer::addChildAtIndex(WTFMove(layer), index); >+ downcast<CoordinatedGraphicsLayer>(*rawLayer).setCoordinatorIncludingSubLayersIfNeeded(m_coordinator); > didChangeChildren(); > } > >-void CoordinatedGraphicsLayer::addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling) >+void CoordinatedGraphicsLayer::addChildAbove(Ref<GraphicsLayer>&& layer, GraphicsLayer* sibling) > { >- GraphicsLayer::addChildAbove(layer, sibling); >- downcast<CoordinatedGraphicsLayer>(*layer).setCoordinatorIncludingSubLayersIfNeeded(m_coordinator); >+ GraphicsLayer* rawLayer = layer.ptr(); >+ GraphicsLayer::addChildAbove(WTFMove(layer), sibling); >+ downcast<CoordinatedGraphicsLayer>(*rawLayer).setCoordinatorIncludingSubLayersIfNeeded(m_coordinator); > didChangeChildren(); > } > >-void CoordinatedGraphicsLayer::addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling) >+void CoordinatedGraphicsLayer::addChildBelow(Ref<GraphicsLayer>&& layer, GraphicsLayer* sibling) > { >- GraphicsLayer::addChildBelow(layer, sibling); >- downcast<CoordinatedGraphicsLayer>(*layer).setCoordinatorIncludingSubLayersIfNeeded(m_coordinator); >+ GraphicsLayer* rawLayer = layer.ptr(); >+ GraphicsLayer::addChildBelow(WTFMove(layer), sibling); >+ downcast<CoordinatedGraphicsLayer>(*rawLayer).setCoordinatorIncludingSubLayersIfNeeded(m_coordinator); > didChangeChildren(); > } > >-bool CoordinatedGraphicsLayer::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild) >+bool CoordinatedGraphicsLayer::replaceChild(GraphicsLayer* oldChild, Ref<GraphicsLayer>&& newChild) > { >- bool ok = GraphicsLayer::replaceChild(oldChild, newChild); >+ GraphicsLayer* rawLayer = newChild.ptr(); >+ bool ok = GraphicsLayer::replaceChild(oldChild, WTFMove(newChild)); > if (!ok) > return false; >- downcast<CoordinatedGraphicsLayer>(*newChild).setCoordinatorIncludingSubLayersIfNeeded(m_coordinator); >+ downcast<CoordinatedGraphicsLayer>(*rawLayer).setCoordinatorIncludingSubLayersIfNeeded(m_coordinator); > didChangeChildren(); > return true; > } >@@ -495,18 +500,19 @@ void CoordinatedGraphicsLayer::setContentsToImage(Image* image) > notifyFlushRequired(); > } > >-void CoordinatedGraphicsLayer::setMaskLayer(GraphicsLayer* layer) >+void CoordinatedGraphicsLayer::setMaskLayer(RefPtr<GraphicsLayer>&& layer) > { > if (layer == maskLayer()) > return; > >- GraphicsLayer::setMaskLayer(layer); >+ GraphicsLayer* rawLayer = layer.get(); >+ GraphicsLayer::setMaskLayer(WTFMove(layer)); > >- if (!layer) >+ if (!rawLayer) > return; > >- layer->setSize(size()); >- layer->setContentsVisible(contentsAreVisible()); >+ rawLayer->setSize(size()); >+ rawLayer->setContentsVisible(contentsAreVisible()); > > m_nicosia.delta.maskChanged = true; > >@@ -732,9 +738,9 @@ void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() > > if (localDelta.childrenChanged) { > state.children = WTF::map(children(), >- [](auto* child) >+ [](auto& child) > { >- return downcast<CoordinatedGraphicsLayer>(child)->m_nicosia.layer; >+ return downcast<CoordinatedGraphicsLayer>(child.get()).m_nicosia.layer; > }); > } > >@@ -784,7 +790,7 @@ void CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers() > downcast<CoordinatedGraphicsLayer>(*maskLayer()).syncPendingStateChangesIncludingSubLayers(); > > for (auto& child : children()) >- downcast<CoordinatedGraphicsLayer>(*child).syncPendingStateChangesIncludingSubLayers(); >+ downcast<CoordinatedGraphicsLayer>(child.get()).syncPendingStateChangesIncludingSubLayers(); > } > > void CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged() >@@ -837,7 +843,7 @@ void CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers() > updateContentBuffers(); > > for (auto& child : children()) >- downcast<CoordinatedGraphicsLayer>(*child).updateContentBuffersIncludingSubLayers(); >+ downcast<CoordinatedGraphicsLayer>(child.get()).updateContentBuffersIncludingSubLayers(); > } > > void CoordinatedGraphicsLayer::updateContentBuffers() >@@ -1007,7 +1013,7 @@ void CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded(Coordina > > coordinator->attachLayer(this); > for (auto& child : children()) >- downcast<CoordinatedGraphicsLayer>(*child).setCoordinatorIncludingSubLayersIfNeeded(coordinator); >+ downcast<CoordinatedGraphicsLayer>(child.get()).setCoordinatorIncludingSubLayersIfNeeded(coordinator); > } > > const RefPtr<Nicosia::CompositionLayer>& CoordinatedGraphicsLayer::compositionLayer() const >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >index f679b2c95370a3bfafafa78b1d0858fa0490092e..ee4e84119a716e0184c91b0e7d7a2fdd730e63f6 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >@@ -63,12 +63,12 @@ public: > PlatformLayerID primaryLayerID() const override; > > // Reimplementations from GraphicsLayer.h. >- bool setChildren(const Vector<GraphicsLayer*>&) override; >- void addChild(GraphicsLayer*) override; >- void addChildAtIndex(GraphicsLayer*, int) override; >- void addChildAbove(GraphicsLayer*, GraphicsLayer*) override; >- void addChildBelow(GraphicsLayer*, GraphicsLayer*) override; >- bool replaceChild(GraphicsLayer*, GraphicsLayer*) override; >+ bool setChildren(Vector<Ref<GraphicsLayer>>&&) override; >+ void addChild(Ref<GraphicsLayer>&&) override; >+ void addChildAtIndex(Ref<GraphicsLayer>&&, int) override; >+ void addChildAbove(Ref<GraphicsLayer>&&, GraphicsLayer*) override; >+ void addChildBelow(Ref<GraphicsLayer>&&, GraphicsLayer*) override; >+ bool replaceChild(GraphicsLayer*, Ref<GraphicsLayer>&&) override; > void removeFromParent() override; > void setPosition(const FloatPoint&) override; > void setAnchorPoint(const FloatPoint3D&) override; >@@ -91,7 +91,7 @@ public: > void setShowRepaintCounter(bool) override; > bool shouldDirectlyCompositeImage(Image*) const override; > void setContentsToPlatformLayer(PlatformLayer*, ContentsLayerPurpose) override; >- void setMaskLayer(GraphicsLayer*) override; >+ void setMaskLayer(RefPtr<GraphicsLayer>&&) override; > void setReplicatedByLayer(GraphicsLayer*) override; > void setNeedsDisplay() override; > void setNeedsDisplayInRect(const FloatRect&, ShouldClipToLayer = ClipToLayer) override; >diff --git a/Source/WebCore/platform/graphics/win/GraphicsLayerDirect2D.cpp b/Source/WebCore/platform/graphics/win/GraphicsLayerDirect2D.cpp >index 644fa390d0f57d4490ebbd7407f60fa6d4861e76..99bd71d38fb240971306ebb42e89c0ac242f523a 100644 >--- a/Source/WebCore/platform/graphics/win/GraphicsLayerDirect2D.cpp >+++ b/Source/WebCore/platform/graphics/win/GraphicsLayerDirect2D.cpp >@@ -46,18 +46,17 @@ > > namespace WebCore { > >- >-std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType) >+Ref<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType) > { >- std::unique_ptr<GraphicsLayer> graphicsLayer; >- if (!factory) >- graphicsLayer = std::make_unique<GraphicsLayerDirect2D>(layerType, client); >- else >- graphicsLayer = factory->createGraphicsLayer(layerType, client); >- >- graphicsLayer->initialize(layerType); >- >- return graphicsLayer; >+ if (factory) { >+ auto layer = factory->createGraphicsLayer(layerType, client); >+ layer->initialize(layerType); >+ return layer; >+ } >+ >+ auto layer = adoptRef(*new GraphicsLayerCA(layerType, client); >+ layer->initialize(layerType); >+ return layer; > } > > GraphicsLayerDirect2D::GraphicsLayerDirect2D(Type layerType, GraphicsLayerClient& client) >diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp >index 0aa00dd184e9519d5a0f11c3ad1d3bff7708b602..72b4328ec40fcd9964dda11fe74cadc4b33a9674 100644 >--- a/Source/WebCore/rendering/RenderLayerBacking.cpp >+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp >@@ -254,11 +254,11 @@ void RenderLayerBacking::willDestroyLayer(const GraphicsLayer* layer) > compositor().layerTiledBackingUsageChanged(layer, false); > } > >-std::unique_ptr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String& name, GraphicsLayer::Type layerType) >+Ref<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String& name, GraphicsLayer::Type layerType) > { > auto* graphicsLayerFactory = renderer().page().chrome().client().graphicsLayerFactory(); > >- std::unique_ptr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, *this, layerType); >+ auto graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, *this, layerType); > > graphicsLayer->setName(name); > >@@ -401,7 +401,7 @@ void RenderLayerBacking::createPrimaryGraphicsLayer() > > if (m_isFrameLayerWithTiledBacking) { > m_childContainmentLayer = createGraphicsLayer("Page TiledBacking containment"); >- m_graphicsLayer->addChild(m_childContainmentLayer.get()); >+ m_graphicsLayer->addChild(*m_childContainmentLayer); > } > > #if !PLATFORM(IOS) >@@ -709,7 +709,7 @@ bool RenderLayerBacking::updateConfiguration() > > if (auto* flatteningLayer = tileCacheFlatteningLayer()) { > if (layerConfigChanged || flatteningLayer->parent() != m_graphicsLayer.get()) >- m_graphicsLayer->addChild(flatteningLayer); >+ m_graphicsLayer->addChild(*flatteningLayer); > } > > updateMaskingLayer(renderer().hasMask(), renderer().hasClipPath()); >@@ -1302,26 +1302,26 @@ void RenderLayerBacking::updateInternalHierarchy() > if (m_contentsContainmentLayer) { > m_contentsContainmentLayer->removeAllChildren(); > if (m_ancestorClippingLayer) >- m_ancestorClippingLayer->addChild(m_contentsContainmentLayer.get()); >+ m_ancestorClippingLayer->addChild(*m_contentsContainmentLayer); > } > > if (m_backgroundLayer) >- m_contentsContainmentLayer->addChild(m_backgroundLayer.get()); >+ m_contentsContainmentLayer->addChild(*m_backgroundLayer); > > if (m_contentsContainmentLayer) >- m_contentsContainmentLayer->addChild(m_graphicsLayer.get()); >+ m_contentsContainmentLayer->addChild(*m_graphicsLayer); > else if (m_ancestorClippingLayer) >- m_ancestorClippingLayer->addChild(m_graphicsLayer.get()); >+ m_ancestorClippingLayer->addChild(*m_graphicsLayer); > > if (m_childContainmentLayer) { > m_childContainmentLayer->removeFromParent(); >- m_graphicsLayer->addChild(m_childContainmentLayer.get()); >+ m_graphicsLayer->addChild(*m_childContainmentLayer); > } > > if (m_scrollingLayer) { > auto* superlayer = m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsLayer.get(); > m_scrollingLayer->removeFromParent(); >- superlayer->addChild(m_scrollingLayer.get()); >+ superlayer->addChild(*m_scrollingLayer); > } > > // The clip for child layers does not include space for overflow controls, so they exist as >@@ -1329,15 +1329,15 @@ void RenderLayerBacking::updateInternalHierarchy() > // children of the clipping layer. > if (m_layerForHorizontalScrollbar) { > m_layerForHorizontalScrollbar->removeFromParent(); >- m_graphicsLayer->addChild(m_layerForHorizontalScrollbar.get()); >+ m_graphicsLayer->addChild(*m_layerForHorizontalScrollbar); > } > if (m_layerForVerticalScrollbar) { > m_layerForVerticalScrollbar->removeFromParent(); >- m_graphicsLayer->addChild(m_layerForVerticalScrollbar.get()); >+ m_graphicsLayer->addChild(*m_layerForVerticalScrollbar); > } > if (m_layerForScrollCorner) { > m_layerForScrollCorner->removeFromParent(); >- m_graphicsLayer->addChild(m_layerForScrollCorner.get()); >+ m_graphicsLayer->addChild(*m_layerForScrollCorner); > } > } > >@@ -1690,7 +1690,7 @@ void RenderLayerBacking::updateMaskingLayer(bool hasMask, bool hasClipPath) > m_maskLayer->setDrawsContent(paintsContent); > m_maskLayer->setPaintingPhase(maskPhases); > layerChanged = true; >- m_graphicsLayer->setMaskLayer(m_maskLayer.get()); >+ m_graphicsLayer->setMaskLayer(m_maskLayer.copyRef()); > } > } else if (m_maskLayer) { > m_graphicsLayer->setMaskLayer(nullptr); >@@ -1721,7 +1721,7 @@ void RenderLayerBacking::updateChildClippingStrategy(bool needsDescendantsClippi > m_childClippingMaskLayer = createGraphicsLayer("child clipping mask"); > m_childClippingMaskLayer->setDrawsContent(true); > m_childClippingMaskLayer->setPaintingPhase(GraphicsLayerPaintChildClippingMask); >- clippingLayer()->setMaskLayer(m_childClippingMaskLayer.get()); >+ clippingLayer()->setMaskLayer(m_childClippingMaskLayer.copyRef()); > } > } > } else { >@@ -1754,7 +1754,7 @@ bool RenderLayerBacking::updateScrollingLayers(bool needsScrollingLayers) > if (!m_foregroundLayer) > paintPhase |= GraphicsLayerPaintForeground; > m_scrollingContentsLayer->setPaintingPhase(paintPhase); >- m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); >+ m_scrollingLayer->addChild(*m_scrollingContentsLayer); > } else { > compositor().willRemoveScrollingLayerWithBacking(m_owningLayer, *this); > >diff --git a/Source/WebCore/rendering/RenderLayerBacking.h b/Source/WebCore/rendering/RenderLayerBacking.h >index 34546f5d52fd7f11f155e89d8b733df54a20a566..43a597e3a20b627133080a2515c17736ca68b96a 100644 >--- a/Source/WebCore/rendering/RenderLayerBacking.h >+++ b/Source/WebCore/rendering/RenderLayerBacking.h >@@ -267,7 +267,7 @@ private: > > LayoutRect compositedBoundsIncludingMargin() const; > >- std::unique_ptr<GraphicsLayer> createGraphicsLayer(const String&, GraphicsLayer::Type = GraphicsLayer::Type::Normal); >+ Ref<GraphicsLayer> createGraphicsLayer(const String&, GraphicsLayer::Type = GraphicsLayer::Type::Normal); > > RenderLayerModelObject& renderer() const { return m_owningLayer.renderer(); } > RenderBox* renderBox() const { return m_owningLayer.renderBox(); } >@@ -355,21 +355,21 @@ private: > > RenderLayer& m_owningLayer; > >- std::unique_ptr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context. >- std::unique_ptr<GraphicsLayer> m_contentsContainmentLayer; // Only used if we have a background layer; takes the transform. >- std::unique_ptr<GraphicsLayer> m_graphicsLayer; >- std::unique_ptr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately. >- std::unique_ptr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately. >- std::unique_ptr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipping on a stacking context with compositing children, or if the layer has a tile cache. >- std::unique_ptr<GraphicsLayer> m_maskLayer; // Only used if we have a mask and/or clip-path. >- std::unique_ptr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path. >- >- std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar; >- std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar; >- std::unique_ptr<GraphicsLayer> m_layerForScrollCorner; >- >- std::unique_ptr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling. >- std::unique_ptr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling. >+ RefPtr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context. >+ RefPtr<GraphicsLayer> m_contentsContainmentLayer; // Only used if we have a background layer; takes the transform. >+ RefPtr<GraphicsLayer> m_graphicsLayer; >+ RefPtr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately. >+ RefPtr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately. >+ RefPtr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipping on a stacking context with compositing children, or if the layer has a tile cache. >+ RefPtr<GraphicsLayer> m_maskLayer; // Only used if we have a mask and/or clip-path. >+ RefPtr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path. >+ >+ RefPtr<GraphicsLayer> m_layerForHorizontalScrollbar; >+ RefPtr<GraphicsLayer> m_layerForVerticalScrollbar; >+ RefPtr<GraphicsLayer> m_layerForScrollCorner; >+ >+ RefPtr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling. >+ RefPtr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling. > > LayoutRect m_compositedBounds; > LayoutSize m_subpixelOffsetFromRenderer; // This is the subpixel distance between the primary graphics layer and the associated renderer's bounds. >diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp >index 175d58d51b91678561c7bf69ae7e5e096fb5dff0..8d82753ea8812e94b32035682a922e510c5aec06 100644 >--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp >+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp >@@ -758,7 +758,7 @@ bool RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update > > if (needHierarchyUpdate) { > // Update the hierarchy of the compositing layers. >- Vector<GraphicsLayer*> childList; >+ Vector<Ref<GraphicsLayer>> childList; > rebuildCompositingLayerTree(*updateRoot, childList, 0); > > // Host the document layer in the RenderView's root layer. >@@ -769,7 +769,7 @@ bool RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update > if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(*updateRoot)) > destroyRootLayer(); > else if (m_rootContentLayer) >- m_rootContentLayer->setChildren(childList); >+ m_rootContentLayer->setChildren(WTFMove(childList)); > } > > reattachSubframeScrollLayers(); >@@ -802,12 +802,13 @@ bool RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update > return true; > } > >-void RenderLayerCompositor::appendDocumentOverlayLayers(Vector<GraphicsLayer*>& childList) >+void RenderLayerCompositor::appendDocumentOverlayLayers(Vector<Ref<GraphicsLayer>>& childList) > { > if (!isMainFrameCompositor() || !m_compositing) > return; > >- childList.append(&page().pageOverlayController().layerWithDocumentOverlays()); >+ Ref<GraphicsLayer> overlayHost = page().pageOverlayController().layerWithDocumentOverlays(); >+ childList.append(WTFMove(overlayHost)); > } > > void RenderLayerCompositor::layerBecameNonComposited(const RenderLayer& layer) >@@ -1523,7 +1524,7 @@ void RenderLayerCompositor::setCompositingParent(RenderLayer& childLayer, Render > auto* hostingLayer = parentLayer->backing()->parentForSublayers(); > auto* hostedLayer = childLayer.backing()->childForSuperlayers(); > >- hostingLayer->addChild(hostedLayer); >+ hostingLayer->addChild(*hostedLayer); > } else > childLayer.backing()->childForSuperlayers()->removeFromParent(); > } >@@ -1545,7 +1546,7 @@ bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo& video) cons > } > #endif > >-void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer& layer, Vector<GraphicsLayer*>& childLayersOfEnclosingLayer, int depth) >+void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer& layer, Vector<Ref<GraphicsLayer>>& childLayersOfEnclosingLayer, int depth) > { > // Make the layer compositing if necessary, and set up clipping and content layers. > // Note that we can only do work here that is independent of whether the descendant layers >@@ -1581,8 +1582,8 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer& layer, Vect > > // If this layer has backing, then we are collecting its children, otherwise appending > // to the compositing child list of an enclosing layer. >- Vector<GraphicsLayer*> layerChildren; >- Vector<GraphicsLayer*>& childList = layerBacking ? layerChildren : childLayersOfEnclosingLayer; >+ Vector<Ref<GraphicsLayer>> layerChildren; >+ auto& childList = layerBacking ? layerChildren : childLayersOfEnclosingLayer; > > #if !ASSERT_DISABLED > LayerListMutationDetector mutationChecker(&layer); >@@ -1594,7 +1595,7 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer& layer, Vect > > // If a negative z-order child is compositing, we get a foreground layer which needs to get parented. > if (layerBacking && layerBacking->foregroundLayer()) >- childList.append(layerBacking->foregroundLayer()); >+ childList.append(*layerBacking->foregroundLayer()); > } > > if (auto* normalFlowList = layer.normalFlowList()) { >@@ -1613,28 +1614,28 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer& layer, Vect > parented = parentFrameContentLayers(&downcast<RenderWidget>(layer.renderer())); > > if (!parented) >- layerBacking->parentForSublayers()->setChildren(layerChildren); >+ layerBacking->parentForSublayers()->setChildren(WTFMove(layerChildren)); > > // If the layer has a clipping layer the overflow controls layers will be siblings of the clipping layer. > // Otherwise, the overflow control layers are normal children. > if (!layerBacking->hasClippingLayer() && !layerBacking->hasScrollingLayer()) { > if (auto* overflowControlLayer = layerBacking->layerForHorizontalScrollbar()) { > overflowControlLayer->removeFromParent(); >- layerBacking->parentForSublayers()->addChild(overflowControlLayer); >+ layerBacking->parentForSublayers()->addChild(*overflowControlLayer); > } > > if (auto* overflowControlLayer = layerBacking->layerForVerticalScrollbar()) { > overflowControlLayer->removeFromParent(); >- layerBacking->parentForSublayers()->addChild(overflowControlLayer); >+ layerBacking->parentForSublayers()->addChild(*overflowControlLayer); > } > > if (auto* overflowControlLayer = layerBacking->layerForScrollCorner()) { > overflowControlLayer->removeFromParent(); >- layerBacking->parentForSublayers()->addChild(overflowControlLayer); >+ layerBacking->parentForSublayers()->addChild(*overflowControlLayer); > } > } > >- childLayersOfEnclosingLayer.append(layerBacking->childForSuperlayers()); >+ childLayersOfEnclosingLayer.append(*layerBacking->childForSuperlayers()); > } > > if (auto* layerBacking = layer.backing()) >@@ -1809,9 +1810,9 @@ bool RenderLayerCompositor::parentFrameContentLayers(RenderWidget* renderer) > auto* backing = layer->backing(); > auto* hostingLayer = backing->parentForSublayers(); > auto* rootLayer = innerCompositor->rootGraphicsLayer(); >- if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != rootLayer) { >+ if (hostingLayer->children().size() != 1 || hostingLayer->children()[0].ptr() != rootLayer) { > hostingLayer->removeAllChildren(); >- hostingLayer->addChild(rootLayer); >+ hostingLayer->addChild(*rootLayer); > } > return true; > } >@@ -3046,7 +3047,7 @@ GraphicsLayer* RenderLayerCompositor::updateLayerForTopOverhangArea(bool wantsLa > if (!m_layerForTopOverhangArea) { > m_layerForTopOverhangArea = GraphicsLayer::create(graphicsLayerFactory(), *this); > m_layerForTopOverhangArea->setName("top overhang"); >- m_scrollLayer->addChildBelow(m_layerForTopOverhangArea.get(), m_rootContentLayer.get()); >+ m_scrollLayer->addChildBelow(*m_layerForTopOverhangArea, m_rootContentLayer.get()); > } > > return m_layerForTopOverhangArea.get(); >@@ -3068,7 +3069,7 @@ GraphicsLayer* RenderLayerCompositor::updateLayerForBottomOverhangArea(bool want > if (!m_layerForBottomOverhangArea) { > m_layerForBottomOverhangArea = GraphicsLayer::create(graphicsLayerFactory(), *this); > m_layerForBottomOverhangArea->setName("bottom overhang"); >- m_scrollLayer->addChildBelow(m_layerForBottomOverhangArea.get(), m_rootContentLayer.get()); >+ m_scrollLayer->addChildBelow(*m_layerForBottomOverhangArea, m_rootContentLayer.get()); > } > > m_layerForBottomOverhangArea->setPosition(FloatPoint(0, m_rootContentLayer->size().height() + m_renderView.frameView().headerHeight() >@@ -3097,7 +3098,7 @@ GraphicsLayer* RenderLayerCompositor::updateLayerForHeader(bool wantsLayer) > if (!m_layerForHeader) { > m_layerForHeader = GraphicsLayer::create(graphicsLayerFactory(), *this); > m_layerForHeader->setName("header"); >- m_scrollLayer->addChildAbove(m_layerForHeader.get(), m_rootContentLayer.get()); >+ m_scrollLayer->addChildAbove(*m_layerForHeader, m_rootContentLayer.get()); > m_renderView.frameView().addPaintPendingMilestones(DidFirstFlushForHeaderLayer); > } > >@@ -3135,7 +3136,7 @@ GraphicsLayer* RenderLayerCompositor::updateLayerForFooter(bool wantsLayer) > if (!m_layerForFooter) { > m_layerForFooter = GraphicsLayer::create(graphicsLayerFactory(), *this); > m_layerForFooter->setName("footer"); >- m_scrollLayer->addChildAbove(m_layerForFooter.get(), m_rootContentLayer.get()); >+ m_scrollLayer->addChildAbove(*m_layerForFooter, m_rootContentLayer.get()); > } > > float totalContentHeight = m_rootContentLayer->size().height() + m_renderView.frameView().headerHeight() + m_renderView.frameView().footerHeight(); >@@ -3258,7 +3259,7 @@ void RenderLayerCompositor::updateOverflowControlsLayers() > > // We want the overhang areas layer to be positioned below the frame contents, > // so insert it below the clip layer. >- m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.get(), m_clipLayer.get()); >+ m_overflowControlsHostLayer->addChildBelow(*m_layerForOverhangAreas, m_clipLayer.get()); > } > } else if (m_layerForOverhangAreas) { > m_layerForOverhangAreas->removeFromParent(); >@@ -3274,7 +3275,7 @@ void RenderLayerCompositor::updateOverflowControlsLayers() > m_contentShadowLayer->setAnchorPoint(FloatPoint3D()); > m_contentShadowLayer->setCustomAppearance(GraphicsLayer::CustomAppearance::ScrollingShadow); > >- m_scrollLayer->addChildBelow(m_contentShadowLayer.get(), m_rootContentLayer.get()); >+ m_scrollLayer->addChildBelow(*m_contentShadowLayer, m_rootContentLayer.get()); > } > } else if (m_contentShadowLayer) { > m_contentShadowLayer->removeFromParent(); >@@ -3291,7 +3292,7 @@ void RenderLayerCompositor::updateOverflowControlsLayers() > #if PLATFORM(COCOA) && USE(CA) > m_layerForHorizontalScrollbar->setAcceleratesDrawing(acceleratedDrawingEnabled()); > #endif >- m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get()); >+ m_overflowControlsHostLayer->addChild(*m_layerForHorizontalScrollbar); > > if (auto* scrollingCoordinator = this->scrollingCoordinator()) > scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), HorizontalScrollbar); >@@ -3313,7 +3314,7 @@ void RenderLayerCompositor::updateOverflowControlsLayers() > #if PLATFORM(COCOA) && USE(CA) > m_layerForVerticalScrollbar->setAcceleratesDrawing(acceleratedDrawingEnabled()); > #endif >- m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get()); >+ m_overflowControlsHostLayer->addChild(*m_layerForVerticalScrollbar); > > if (auto* scrollingCoordinator = this->scrollingCoordinator()) > scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), VerticalScrollbar); >@@ -3335,7 +3336,7 @@ void RenderLayerCompositor::updateOverflowControlsLayers() > #if PLATFORM(COCOA) && USE(CA) > m_layerForScrollCorner->setAcceleratesDrawing(acceleratedDrawingEnabled()); > #endif >- m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get()); >+ m_overflowControlsHostLayer->addChild(*m_layerForScrollCorner); > } > } else if (m_layerForScrollCorner) { > m_layerForScrollCorner->removeFromParent(); >@@ -3387,9 +3388,9 @@ void RenderLayerCompositor::ensureRootLayer() > m_scrollLayer->setName("frame scrolling"); > > // Hook them up >- m_overflowControlsHostLayer->addChild(m_clipLayer.get()); >- m_clipLayer->addChild(m_scrollLayer.get()); >- m_scrollLayer->addChild(m_rootContentLayer.get()); >+ m_overflowControlsHostLayer->addChild(*m_clipLayer); >+ m_clipLayer->addChild(*m_scrollLayer); >+ m_scrollLayer->addChild(*m_rootContentLayer); > > m_clipLayer->setSize(m_renderView.frameView().sizeForVisibleContent()); > m_clipLayer->setPosition(positionForClipLayer()); >@@ -3560,7 +3561,8 @@ void RenderLayerCompositor::rootLayerAttachmentChanged() > if (!frame.isMainFrame()) > return; > >- m_rootContentLayer->addChild(&page().pageOverlayController().layerWithDocumentOverlays()); >+ Ref<GraphicsLayer> overlayHost = page().pageOverlayController().layerWithDocumentOverlays(); >+ m_rootContentLayer->addChild(WTFMove(overlayHost)); > } > > void RenderLayerCompositor::notifyIFramesOfCompositingChange() >diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h >index 2bf183beb7ffe257feabf63ebeeffb578684d1be..a5d83b6f360d4e3bd35c9eb2ac08fedc072258e6 100644 >--- a/Source/WebCore/rendering/RenderLayerCompositor.h >+++ b/Source/WebCore/rendering/RenderLayerCompositor.h >@@ -376,7 +376,7 @@ private: > void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer&, OverlapMap&, CompositingState&, bool& layersChanged, bool& descendantHas3DTransform); > > // Recurses down the tree, parenting descendant compositing layers and collecting an array of child layers for the current compositing layer. >- void rebuildCompositingLayerTree(RenderLayer&, Vector<GraphicsLayer*>& childGraphicsLayersOfEnclosingLayer, int depth); >+ void rebuildCompositingLayerTree(RenderLayer&, Vector<Ref<GraphicsLayer>>& childGraphicsLayersOfEnclosingLayer, int depth); > > // Recurses down the tree, updating layer geometry only. > void updateLayerTreeGeometry(RenderLayer&, int depth); >@@ -388,7 +388,7 @@ private: > bool layerHas3DContent(const RenderLayer&) const; > bool isRunningTransformAnimation(RenderLayerModelObject&) const; > >- void appendDocumentOverlayLayers(Vector<GraphicsLayer*>&); >+ void appendDocumentOverlayLayers(Vector<Ref<GraphicsLayer>>&); > bool hasAnyAdditionalCompositedLayers(const RenderLayer& rootLayer) const; > > void ensureRootLayer(); >@@ -488,7 +488,7 @@ private: > > private: > RenderView& m_renderView; >- std::unique_ptr<GraphicsLayer> m_rootContentLayer; >+ RefPtr<GraphicsLayer> m_rootContentLayer; > Timer m_updateCompositingLayersTimer; > > ChromeClient::CompositingTriggerFlags m_compositingTriggers { static_cast<ChromeClient::CompositingTriggerFlags>(ChromeClient::AllTriggers) }; >@@ -524,8 +524,8 @@ private: > RootLayerAttachment m_rootLayerAttachment { RootLayerUnattached }; > > // Enclosing clipping layer for iframe content >- std::unique_ptr<GraphicsLayer> m_clipLayer; >- std::unique_ptr<GraphicsLayer> m_scrollLayer; >+ RefPtr<GraphicsLayer> m_clipLayer; >+ RefPtr<GraphicsLayer> m_scrollLayer; > > #if PLATFORM(IOS) > HashSet<RenderLayer*> m_scrollingLayers; >@@ -535,19 +535,19 @@ private: > HashSet<RenderLayer*> m_scrollCoordinatedLayersNeedingUpdate; > > // Enclosing layer for overflow controls and the clipping layer >- std::unique_ptr<GraphicsLayer> m_overflowControlsHostLayer; >+ RefPtr<GraphicsLayer> m_overflowControlsHostLayer; > > // Layers for overflow controls >- std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar; >- std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar; >- std::unique_ptr<GraphicsLayer> m_layerForScrollCorner; >+ RefPtr<GraphicsLayer> m_layerForHorizontalScrollbar; >+ RefPtr<GraphicsLayer> m_layerForVerticalScrollbar; >+ RefPtr<GraphicsLayer> m_layerForScrollCorner; > #if ENABLE(RUBBER_BANDING) >- std::unique_ptr<GraphicsLayer> m_layerForOverhangAreas; >- std::unique_ptr<GraphicsLayer> m_contentShadowLayer; >- std::unique_ptr<GraphicsLayer> m_layerForTopOverhangArea; >- std::unique_ptr<GraphicsLayer> m_layerForBottomOverhangArea; >- std::unique_ptr<GraphicsLayer> m_layerForHeader; >- std::unique_ptr<GraphicsLayer> m_layerForFooter; >+ RefPtr<GraphicsLayer> m_layerForOverhangAreas; >+ RefPtr<GraphicsLayer> m_contentShadowLayer; >+ RefPtr<GraphicsLayer> m_layerForTopOverhangArea; >+ RefPtr<GraphicsLayer> m_layerForBottomOverhangArea; >+ RefPtr<GraphicsLayer> m_layerForHeader; >+ RefPtr<GraphicsLayer> m_layerForFooter; > #endif > > std::unique_ptr<GraphicsLayerUpdater> m_layerUpdater; // Updates tiled layer visible area periodically while animations are running. >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp >index a51a4a300888f3024c2630a8b93988387788c976..81423ec53401ecd9f39009eef3c8dd9e9cfa5720 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp >@@ -66,10 +66,10 @@ WebInspectorClient::WebInspectorClient(WebPage* page) > > WebInspectorClient::~WebInspectorClient() > { >- for (auto layer : m_paintRectLayers) { >+ for (auto& layer : m_paintRectLayers) > layer->removeFromParent(); >- delete layer; >- } >+ >+ m_paintRectLayers.clear(); > > if (m_paintRectOverlay && m_page->corePage()) > m_page->corePage()->pageOverlayController().uninstallPageOverlay(*m_paintRectOverlay, PageOverlay::FadeMode::Fade); >@@ -152,7 +152,7 @@ void WebInspectorClient::showPaintRect(const FloatRect& rect) > if (!m_paintIndicatorLayerClient) > m_paintIndicatorLayerClient = std::make_unique<RepaintIndicatorLayerClient>(*this); > >- std::unique_ptr<GraphicsLayer> paintLayer = GraphicsLayer::create(m_page->drawingArea()->graphicsLayerFactory(), *m_paintIndicatorLayerClient); >+ auto paintLayer = GraphicsLayer::create(m_page->drawingArea()->graphicsLayerFactory(), *m_paintIndicatorLayerClient); > > paintLayer->setName("paint rect"); > paintLayer->setAnchorPoint(FloatPoint3D()); >@@ -165,22 +165,23 @@ void WebInspectorClient::showPaintRect(const FloatRect& rect) > > fadeKeyframes.insert(std::make_unique<FloatAnimationValue>(0.25, 0)); > >- RefPtr<Animation> opacityAnimation = Animation::create(); >+ auto opacityAnimation = Animation::create(); > opacityAnimation->setDuration(0.25); > >- paintLayer->addAnimation(fadeKeyframes, FloatSize(), opacityAnimation.get(), "opacity"_s, 0); >+ paintLayer->addAnimation(fadeKeyframes, FloatSize(), opacityAnimation.ptr(), "opacity"_s, 0); > >- m_paintRectLayers.add(paintLayer.get()); >+ GraphicsLayer& rawLayer = paintLayer.get(); >+ m_paintRectLayers.add(WTFMove(paintLayer)); > > GraphicsLayer& overlayRootLayer = m_paintRectOverlay->layer(); >- overlayRootLayer.addChild(paintLayer.release()); >+ overlayRootLayer.addChild(rawLayer); > } > > void WebInspectorClient::animationEndedForLayer(const GraphicsLayer* layer) > { >- const_cast<GraphicsLayer*>(layer)->removeFromParent(); >- m_paintRectLayers.remove(const_cast<GraphicsLayer*>(layer)); >- delete layer; >+ GraphicsLayer* nonConstLayer = const_cast<GraphicsLayer*>(layer); >+ nonConstLayer->removeFromParent(); >+ m_paintRectLayers.remove(*nonConstLayer); > } > > #if PLATFORM(IOS) >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h >index 9c214ce5b82266ea6cffedde722463a912a569b6..e9746950e72470f7cc7928dd1c3b26cd6ae6c2ff 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h >@@ -84,7 +84,7 @@ private: > > RefPtr<WebCore::PageOverlay> m_paintRectOverlay; > std::unique_ptr<RepaintIndicatorLayerClient> m_paintIndicatorLayerClient; >- HashSet<WebCore::GraphicsLayer*> m_paintRectLayers; // Ideally this would be HashSet<std::unique_ptr<GraphicsLayer>> but that doesn't work yet. webkit.org/b/136166 >+ HashSet<Ref<WebCore::GraphicsLayer>> m_paintRectLayers; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp >index 36d52b61b8cc92aabcb5763b7ab3921c33d8dd3f..ae37833bd2cecf91c825ccbc8226439bd9d166b3 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp >@@ -85,7 +85,7 @@ void CompositingCoordinator::setRootCompositingLayer(GraphicsLayer* graphicsLaye > > m_rootCompositingLayer = graphicsLayer; > if (m_rootCompositingLayer) >- m_rootLayer->addChildAtIndex(m_rootCompositingLayer, 0); >+ m_rootLayer->addChildAtIndex(*m_rootCompositingLayer, 0); > } > > void CompositingCoordinator::setViewOverlayRootLayer(GraphicsLayer* graphicsLayer) >@@ -98,7 +98,7 @@ void CompositingCoordinator::setViewOverlayRootLayer(GraphicsLayer* graphicsLaye > > m_overlayCompositingLayer = graphicsLayer; > if (m_overlayCompositingLayer) >- m_rootLayer->addChild(m_overlayCompositingLayer); >+ m_rootLayer->addChild(*m_overlayCompositingLayer); > } > > void CompositingCoordinator::sizeDidChange(const IntSize& newSize) >@@ -231,15 +231,15 @@ float CompositingCoordinator::pageScaleFactor() const > return m_page->pageScaleFactor(); > } > >-std::unique_ptr<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(GraphicsLayer::Type layerType, GraphicsLayerClient& client) >+Ref<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(GraphicsLayer::Type layerType, GraphicsLayerClient& client) > { >- CoordinatedGraphicsLayer* layer = new CoordinatedGraphicsLayer(layerType, client); >+ auto layer = adoptRef(*new CoordinatedGraphicsLayer(layerType, client)); > layer->setCoordinator(this); > m_nicosia.state.layers.add(layer->compositionLayer()); >- m_registeredLayers.add(layer->id(), layer); >+ m_registeredLayers.add(layer->id(), layer.ptr()); > layer->setNeedsVisibleRectAdjustment(); >- notifyFlushRequired(layer); >- return std::unique_ptr<GraphicsLayer>(layer); >+ notifyFlushRequired(layer.ptr()); >+ return WTFMove(layer); > } > > FloatRect CompositingCoordinator::visibleContentsRect() const >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h >index 6ba85f1e4f3b458ef17496ea75bdb8c726524f13..b4a0d1544d508080cf69dd66fdf96442e2c22a41 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h >@@ -103,7 +103,7 @@ private: > void syncLayerState() override; > > // GraphicsLayerFactory >- std::unique_ptr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override; >+ Ref<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override; > > void initializeRootCompositingLayerIfNeeded(); > >@@ -114,7 +114,7 @@ private: > WebCore::Page* m_page; > CompositingCoordinator::Client& m_client; > >- std::unique_ptr<WebCore::GraphicsLayer> m_rootLayer; >+ RefPtr<WebCore::GraphicsLayer> m_rootLayer; > WebCore::GraphicsLayer* m_rootCompositingLayer { nullptr }; > WebCore::GraphicsLayer* m_overlayCompositingLayer { nullptr }; > >diff --git a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h >index e3d3f5a57e2a6ee363e6a56423e2c11e8f1fb862..9a413f3fa6b84075a81f160b470f61fe8e70377d 100644 >--- a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h >+++ b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h >@@ -74,7 +74,7 @@ public: > > private: > // WebCore::GraphicsLayerFactory >- std::unique_ptr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override; >+ Ref<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override; > > WebPage& m_webPage; > >diff --git a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm >index 9677dda48a96ec888adda9b9618e901bcd5d089f..42811944f97465d881de1a0f8a4777f5ba49eaba 100644 >--- a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm >+++ b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm >@@ -109,9 +109,9 @@ bool RemoteLayerTreeContext::backingStoreWillBeDisplayed(RemoteLayerBackingStore > return m_backingStoreCollection.backingStoreWillBeDisplayed(backingStore); > } > >-std::unique_ptr<GraphicsLayer> RemoteLayerTreeContext::createGraphicsLayer(WebCore::GraphicsLayer::Type layerType, GraphicsLayerClient& client) >+Ref<GraphicsLayer> RemoteLayerTreeContext::createGraphicsLayer(WebCore::GraphicsLayer::Type layerType, GraphicsLayerClient& client) > { >- return std::make_unique<GraphicsLayerCARemote>(layerType, client, *this); >+ return adoptRef(*new GraphicsLayerCARemote(layerType, client, *this)); > } > > void RemoteLayerTreeContext::buildTransaction(RemoteLayerTreeTransaction& transaction, PlatformCALayer& rootLayer) >diff --git a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h >index 747cfd4d43ca59c35f33a406ebf76a0cb39e286c..ba7fd8bfe8f7460af7f9f65dae000ef7993d0d14 100644 >--- a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h >+++ b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h >@@ -137,7 +137,7 @@ private: > }; > > std::unique_ptr<RemoteLayerTreeContext> m_remoteLayerTreeContext; >- std::unique_ptr<WebCore::GraphicsLayer> m_rootLayer; >+ Ref<WebCore::GraphicsLayer> m_rootLayer; > > WebCore::IntSize m_viewSize; > >diff --git a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm >index 837d6c5066502373508fe2494807d10b6233469f..3f5ceed56c5751fe3f63b346d1d508d9ec5d47ba 100644 >--- a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm >+++ b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm >@@ -115,14 +115,14 @@ void RemoteLayerTreeDrawingArea::willDestroyDisplayRefreshMonitor(DisplayRefresh > > void RemoteLayerTreeDrawingArea::updateRootLayers() > { >- Vector<GraphicsLayer*> children; >+ Vector<Ref<GraphicsLayer>> children; > if (m_contentLayer) { >- children.append(m_contentLayer); >+ children.append(*m_contentLayer); > if (m_viewOverlayRootLayer) >- children.append(m_viewOverlayRootLayer); >+ children.append(*m_viewOverlayRootLayer); > } > >- m_rootLayer->setChildren(children); >+ m_rootLayer->setChildren(WTFMove(children)); > } > > void RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer(Frame* frame, GraphicsLayer* viewOverlayRootLayer) >@@ -318,9 +318,6 @@ bool RemoteLayerTreeDrawingArea::adjustLayerFlushThrottling(WebCore::LayerFlushT > > void RemoteLayerTreeDrawingArea::flushLayers() > { >- if (!m_rootLayer) >- return; >- > if (m_isFlushingSuspended) { > m_hasDeferredFlush = true; > return; >@@ -366,7 +363,7 @@ void RemoteLayerTreeDrawingArea::flushLayers() > layerTransaction.setTransactionID(takeNextTransactionID()); > layerTransaction.setCallbackIDs(WTFMove(m_pendingCallbackIDs)); > m_remoteLayerTreeContext->setNextFlushIsForImmediatePaint(m_nextFlushIsForImmediatePaint); >- m_remoteLayerTreeContext->buildTransaction(layerTransaction, *downcast<GraphicsLayerCARemote>(*m_rootLayer).platformCALayer()); >+ m_remoteLayerTreeContext->buildTransaction(layerTransaction, *downcast<GraphicsLayerCARemote>(m_rootLayer.get()).platformCALayer()); > m_remoteLayerTreeContext->setNextFlushIsForImmediatePaint(false); > backingStoreCollection.willCommitLayerTree(layerTransaction); > m_webPage.willCommitLayerTree(layerTransaction);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189521
:
349449
|
349460
|
349464
|
349475
|
349477
|
349483
|
349485
|
349487
|
349488
|
349498
|
349504
|
349506
|
349507
|
349519
|
349520
|
349522
|
349525
|
349529
|
349530
|
349547
|
349556
|
349559
|
349720