Reduce PassRefPtr use
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 May 2017 20:11:29 +0000 (20:11 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 May 2017 20:11:29 +0000 (20:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171809

Reviewed by Chris Dumez.

Source/WebCore:

* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::PlatformCALayer::createCompatibleLayerOrTakeFromPool):
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/TileCoverageMap.cpp:
(WebCore::TileCoverageMap::TileCoverageMap):
* platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::TileGrid):
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(PlatformCALayerCocoa::create):
(PlatformCALayerCocoa::clone):
(PlatformCALayerCocoa::animationForKey):
(PlatformCALayerCocoa::createCompatibleLayer):

Source/WebKit2:

* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::setInitializationReply):
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/WebProcessConnection.cpp:
(WebKit::WebProcessConnection::destroyPlugin):
(WebKit::WebProcessConnection::createPlugin):
* PluginProcess/WebProcessConnection.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::runOpenPanel):
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::registerUndoStep):
* WebProcess/WebPage/VisitedLinkTableController.cpp:
(WebKit::VisitedLinkTableController::getOrCreate):
* WebProcess/WebPage/VisitedLinkTableController.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::hitTest):
(WebKit::WebFrame::createSelectionSnapshot):
* WebProcess/WebPage/WebFrame.h:
* WebProcess/WebPage/WebOpenPanelResultListener.cpp:
(WebKit::WebOpenPanelResultListener::create):
(WebKit::WebOpenPanelResultListener::WebOpenPanelResultListener):
* WebProcess/WebPage/WebOpenPanelResultListener.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::unapplyEditCommand):
(WebKit::WebPage::reapplyEditCommand):
* WebProcess/WebPage/WebPageGroupProxy.cpp:
(WebKit::WebPageGroupProxy::create):
* WebProcess/WebPage/WebPageGroupProxy.h:
* WebProcess/WebPage/WebUndoStep.cpp:
(WebKit::WebUndoStep::create):
* WebProcess/WebPage/WebUndoStep.h:
(WebKit::WebUndoStep::step):
(WebKit::WebUndoStep::WebUndoStep):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::create):
(WebKit::PlatformCALayerRemote::clone):
(WebKit::PlatformCALayerRemote::animationForKey):
(WebKit::PlatformCALayerRemote::createCompatibleLayer):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
* WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h:
* WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
(WebKit::PlatformCALayerRemoteCustom::create):
(WebKit::PlatformCALayerRemoteCustom::clone):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216448 268f45cc-cd09-0410-ab3c-d52691b4dbfc

33 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp
Source/WebCore/platform/graphics/ca/PlatformCALayer.h
Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp
Source/WebCore/platform/graphics/ca/TileGrid.cpp
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h
Source/WebKit2/ChangeLog
Source/WebKit2/PluginProcess/PluginControllerProxy.cpp
Source/WebKit2/PluginProcess/PluginControllerProxy.h
Source/WebKit2/PluginProcess/WebProcessConnection.cpp
Source/WebKit2/PluginProcess/WebProcessConnection.h
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.cpp
Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.h
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.h
Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp
Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp
Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h
Source/WebKit2/WebProcess/WebPage/WebUndoStep.cpp
Source/WebKit2/WebProcess/WebPage/WebUndoStep.h
Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm

index f24b782..4964772 100644 (file)
@@ -1,3 +1,24 @@
+2017-05-08  Alex Christensen  <achristensen@webkit.org>
+
+        Reduce PassRefPtr use
+        https://bugs.webkit.org/show_bug.cgi?id=171809
+
+        Reviewed by Chris Dumez.
+
+        * platform/graphics/ca/PlatformCALayer.cpp:
+        (WebCore::PlatformCALayer::createCompatibleLayerOrTakeFromPool):
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/TileCoverageMap.cpp:
+        (WebCore::TileCoverageMap::TileCoverageMap):
+        * platform/graphics/ca/TileGrid.cpp:
+        (WebCore::TileGrid::TileGrid):
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+        (PlatformCALayerCocoa::create):
+        (PlatformCALayerCocoa::clone):
+        (PlatformCALayerCocoa::animationForKey):
+        (PlatformCALayerCocoa::createCompatibleLayer):
+
 2017-05-08  Jer Noble  <jer.noble@apple.com>
 
         [Mac] Audio capture fails when shouldCaptureAudioInUIProcess is set.
index 834a65f..f91dd3e 100644 (file)
@@ -356,7 +356,7 @@ PassRefPtr<PlatformCALayer> GraphicsLayerCA::createPlatformCALayer(PlatformCALay
     if (result->canHaveBackingStore())
         result->setWantsDeepColorBackingStore(screenSupportsExtendedColor());
     
-    return result;
+    return WTFMove(result);
 #elif PLATFORM(WIN)
     return PlatformCALayerWin::create(layerType, owner);
 #endif
index f4f845e..d0c538e 100644 (file)
@@ -167,19 +167,16 @@ void PlatformCALayer::drawTextAtPoint(CGContextRef context, CGFloat x, CGFloat y
     CTLineDraw(line.get(), context);
 }
 
-PassRefPtr<PlatformCALayer> PlatformCALayer::createCompatibleLayerOrTakeFromPool(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client, IntSize size)
+Ref<PlatformCALayer> PlatformCALayer::createCompatibleLayerOrTakeFromPool(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client, IntSize size)
 {
-    RefPtr<PlatformCALayer> layer;
-
-    if ((layer = layerPool().takeLayerWithSize(size))) {
-        layer->setOwner(client);
-        return WTFMove(layer);
+    if (auto layerFromPool = layerPool().takeLayerWithSize(size)) {
+        layerFromPool->setOwner(client);
+        return layerFromPool.releaseNonNull();
     }
 
-    layer = createCompatibleLayer(layerType, client);
+    auto layer = createCompatibleLayer(layerType, client);
     layer->setBounds(FloatRect(FloatPoint(), size));
-    
-    return WTFMove(layer);
+    return layer;
 }
 
 void PlatformCALayer::moveToLayerPool()
index b9c3849..b2a2169 100644 (file)
@@ -29,7 +29,6 @@
 #include "GraphicsLayer.h"
 #include <QuartzCore/CABase.h>
 #include <wtf/CurrentTime.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/TypeCasts.h>
@@ -82,7 +81,7 @@ public:
     };
     enum FilterType { Linear, Nearest, Trilinear };
 
-    virtual PassRefPtr<PlatformCALayer> clone(PlatformCALayerClient*) const = 0;
+    virtual Ref<PlatformCALayer> clone(PlatformCALayerClient*) const = 0;
 
     virtual ~PlatformCALayer();
 
@@ -132,7 +131,7 @@ public:
 
     virtual void addAnimationForKey(const String& key, PlatformCAAnimation&) = 0;
     virtual void removeAnimationForKey(const String& key) = 0;
-    virtual PassRefPtr<PlatformCAAnimation> animationForKey(const String& key) = 0;
+    virtual RefPtr<PlatformCAAnimation> animationForKey(const String& key) = 0;
 
     virtual void setMask(PlatformCALayer*) = 0;
 
@@ -260,8 +259,8 @@ public:
     void setAnchorPointOnMainThread(FloatPoint3D);
 #endif
 
-    virtual PassRefPtr<PlatformCALayer> createCompatibleLayer(LayerType, PlatformCALayerClient*) const = 0;
-    PassRefPtr<PlatformCALayer> createCompatibleLayerOrTakeFromPool(LayerType layerType, PlatformCALayerClient* client, IntSize);
+    virtual Ref<PlatformCALayer> createCompatibleLayer(LayerType, PlatformCALayerClient*) const = 0;
+    Ref<PlatformCALayer> createCompatibleLayerOrTakeFromPool(LayerType, PlatformCALayerClient*, IntSize);
 
 #if PLATFORM(COCOA)
     virtual void enumerateRectsBeingDrawn(CGContextRef, void (^block)(CGRect)) = 0;
index 31d6a58..0260bab 100644 (file)
@@ -35,10 +35,10 @@ namespace WebCore {
 TileCoverageMap::TileCoverageMap(const TileController& controller)
     : m_controller(controller)
     , m_updateTimer(*this, &TileCoverageMap::updateTimerFired)
-    , m_layer(*controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeSimpleLayer, this))
-    , m_visibleViewportIndicatorLayer(*controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
-    , m_layoutViewportIndicatorLayer(*controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
-    , m_coverageRectIndicatorLayer(*controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
+    , m_layer(controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeSimpleLayer, this))
+    , m_visibleViewportIndicatorLayer(controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
+    , m_layoutViewportIndicatorLayer(controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
+    , m_coverageRectIndicatorLayer(controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
     , m_position(FloatPoint(0, controller.topContentInset()))
 {
     m_layer.get().setOpacity(0.75);
index b8496b1..1223722 100644 (file)
@@ -65,7 +65,7 @@ static String validationPolicyAsString(TileGrid::TileValidationPolicy validation
 
 TileGrid::TileGrid(TileController& controller)
     : m_controller(controller)
-    , m_containerLayer(*controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
+    , m_containerLayer(controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
     , m_cohortRemovalTimer(*this, &TileGrid::cohortRemovalTimerFired)
     , m_tileSize(kDefaultTileSize, kDefaultTileSize)
 {
index bc8b7a4..57467a0 100644 (file)
@@ -33,11 +33,11 @@ namespace WebCore {
 
 class PlatformCALayerCocoa final : public PlatformCALayer {
 public:
-    static PassRefPtr<PlatformCALayer> create(LayerType, PlatformCALayerClient*);
+    static Ref<PlatformCALayer> create(LayerType, PlatformCALayerClient*);
     
     // This function passes the layer as a void* rather than a PlatformLayer because PlatformLayer
     // is defined differently for Obj C and C++. This allows callers from both languages.
-    static PassRefPtr<PlatformCALayer> create(void* platformLayer, PlatformCALayerClient*);
+    static Ref<PlatformCALayer> create(void* platformLayer, PlatformCALayerClient*);
 
     WEBCORE_EXPORT static LayerType layerTypeForPlatformLayer(PlatformLayer*);
 
@@ -62,7 +62,7 @@ public:
 
     void addAnimationForKey(const String& key, PlatformCAAnimation&) override;
     void removeAnimationForKey(const String& key) override;
-    PassRefPtr<PlatformCAAnimation> animationForKey(const String& key) override;
+    RefPtr<PlatformCAAnimation> animationForKey(const String& key) override;
     void animationStarted(const String& key, CFTimeInterval beginTime) override;
     void animationEnded(const String& key) override;
 
@@ -169,9 +169,9 @@ public:
 
     TiledBacking* tiledBacking() override;
 
-    PassRefPtr<PlatformCALayer> clone(PlatformCALayerClient* owner) const override;
+    Ref<PlatformCALayer> clone(PlatformCALayerClient* owner) const override;
 
-    PassRefPtr<PlatformCALayer> createCompatibleLayer(PlatformCALayer::LayerType, PlatformCALayerClient*) const override;
+    Ref<PlatformCALayer> createCompatibleLayer(PlatformCALayer::LayerType, PlatformCALayerClient*) const override;
 
     void enumerateRectsBeingDrawn(CGContextRef, void (^block)(CGRect)) override;
 
index b05264d..ea238e6 100644 (file)
@@ -69,14 +69,14 @@ SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVPlayerLayer)
 
 using namespace WebCore;
 
-PassRefPtr<PlatformCALayer> PlatformCALayerCocoa::create(LayerType layerType, PlatformCALayerClient* owner)
+Ref<PlatformCALayer> PlatformCALayerCocoa::create(LayerType layerType, PlatformCALayerClient* owner)
 {
-    return adoptRef(new PlatformCALayerCocoa(layerType, owner));
+    return adoptRef(*new PlatformCALayerCocoa(layerType, owner));
 }
 
-PassRefPtr<PlatformCALayer> PlatformCALayerCocoa::create(void* platformLayer, PlatformCALayerClient* owner)
+Ref<PlatformCALayer> PlatformCALayerCocoa::create(void* platformLayer, PlatformCALayerClient* owner)
 {
-    return adoptRef(new PlatformCALayerCocoa(static_cast<PlatformLayer*>(platformLayer), owner));
+    return adoptRef(*new PlatformCALayerCocoa(static_cast<PlatformLayer*>(platformLayer), owner));
 }
 
 static NSString * const platformCALayerPointer = @"WKPlatformCALayer";
@@ -311,7 +311,7 @@ void PlatformCALayerCocoa::commonInit()
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
-PassRefPtr<PlatformCALayer> PlatformCALayerCocoa::clone(PlatformCALayerClient* owner) const
+Ref<PlatformCALayer> PlatformCALayerCocoa::clone(PlatformCALayerClient* owner) const
 {
     LayerType type;
     switch (layerType()) {
@@ -332,7 +332,7 @@ PassRefPtr<PlatformCALayer> PlatformCALayerCocoa::clone(PlatformCALayerClient* o
         type = LayerTypeLayer;
         break;
     };
-    RefPtr<PlatformCALayer> newLayer = PlatformCALayerCocoa::create(type, owner);
+    auto newLayer = PlatformCALayerCocoa::create(type, owner);
     
     newLayer->setPosition(position());
     newLayer->setBounds(bounds());
@@ -352,7 +352,7 @@ PassRefPtr<PlatformCALayer> PlatformCALayerCocoa::clone(PlatformCALayerClient* o
     if (type == LayerTypeAVPlayerLayer) {
         ASSERT([newLayer->platformLayer() isKindOfClass:getAVPlayerLayerClass()]);
 
-        AVPlayerLayer *destinationPlayerLayer = static_cast<PlatformCALayerCocoa *>(newLayer.get())->avPlayerLayer();
+        AVPlayerLayer *destinationPlayerLayer = static_cast<PlatformCALayerCocoa&>(newLayer.get()).avPlayerLayer();
         AVPlayerLayer *sourcePlayerLayer = avPlayerLayer();
         ASSERT(sourcePlayerLayer);
 
@@ -508,11 +508,11 @@ void PlatformCALayerCocoa::removeAnimationForKey(const String& key)
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
-PassRefPtr<PlatformCAAnimation> PlatformCALayerCocoa::animationForKey(const String& key)
+RefPtr<PlatformCAAnimation> PlatformCALayerCocoa::animationForKey(const String& key)
 {
     CAPropertyAnimation* propertyAnimation = static_cast<CAPropertyAnimation*>([m_layer animationForKey:key]);
     if (!propertyAnimation)
-        return 0;
+        return nullptr;
     return PlatformCAAnimationCocoa::create(propertyAnimation);
 }
 
@@ -1190,7 +1190,7 @@ CGRect PlatformCALayer::frameForLayer(const PlatformLayer* tileLayer)
     return [tileLayer frame];
 }
 
-PassRefPtr<PlatformCALayer> PlatformCALayerCocoa::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
+Ref<PlatformCALayer> PlatformCALayerCocoa::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
 {
     return PlatformCALayerCocoa::create(layerType, client);
 }
index 629b3dc..d37f241 100644 (file)
 
 using namespace WebCore;
 
-PassRefPtr<PlatformCALayer> PlatformCALayerWin::create(LayerType layerType, PlatformCALayerClient* owner)
+Ref<PlatformCALayer> PlatformCALayerWin::create(LayerType layerType, PlatformCALayerClient* owner)
 {
-    return adoptRef(new PlatformCALayerWin(layerType, nullptr, owner));
+    return adoptRef(*new PlatformCALayerWin(layerType, nullptr, owner));
 }
 
-PassRefPtr<PlatformCALayer> PlatformCALayerWin::create(PlatformLayer* platformLayer, PlatformCALayerClient* owner)
+Ref<PlatformCALayer> PlatformCALayerWin::create(PlatformLayer* platformLayer, PlatformCALayerClient* owner)
 {
-    return adoptRef(new PlatformCALayerWin(LayerTypeCustom, platformLayer, owner));
+    return adoptRef(*new PlatformCALayerWin(LayerTypeCustom, platformLayer, owner));
 }
 
 static CFStringRef toCACFLayerType(PlatformCALayer::LayerType type)
@@ -181,11 +181,11 @@ PlatformCALayerWin::~PlatformCALayerWin()
     delete layerIntern;
 }
 
-PassRefPtr<PlatformCALayer> PlatformCALayerWin::clone(PlatformCALayerClient* owner) const
+Ref<PlatformCALayer> PlatformCALayerWin::clone(PlatformCALayerClient* owner) const
 {
     PlatformCALayer::LayerType type = (layerType() == PlatformCALayer::LayerTypeTransformLayer) ?
         PlatformCALayer::LayerTypeTransformLayer : PlatformCALayer::LayerTypeLayer;
-    RefPtr<PlatformCALayer> newLayer = PlatformCALayerWin::create(type, owner);
+    auto newLayer = PlatformCALayerWin::create(type, owner);
 
     newLayer->setPosition(position());
     newLayer->setBounds(bounds());
@@ -353,7 +353,7 @@ void PlatformCALayerWin::removeAnimationForKey(const String& key)
     setNeedsCommit();
 }
 
-PassRefPtr<PlatformCAAnimation> PlatformCALayerWin::animationForKey(const String& key)
+RefPtr<PlatformCAAnimation> PlatformCALayerWin::animationForKey(const String& key)
 {
     HashMap<String, RefPtr<PlatformCAAnimation> >::iterator it = m_animations.find(key);
     if (it == m_animations.end())
@@ -939,7 +939,7 @@ String PlatformCALayerWin::layerTreeAsString() const
     return builder.toString();
 }
 
-PassRefPtr<PlatformCALayer> PlatformCALayerWin::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
+Ref<PlatformCALayer> PlatformCALayerWin::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
 {
     return PlatformCALayerWin::create(layerType, client);
 }
index 670c011..b3fb254 100644 (file)
@@ -32,8 +32,8 @@ namespace WebCore {
 
 class PlatformCALayerWin final : public PlatformCALayer {
 public:
-    static PassRefPtr<PlatformCALayer> create(LayerType, PlatformCALayerClient*);
-    static PassRefPtr<PlatformCALayer> create(PlatformLayer*, PlatformCALayerClient*);
+    static Ref<PlatformCALayer> create(LayerType, PlatformCALayerClient*);
+    static Ref<PlatformCALayer> create(PlatformLayer*, PlatformCALayerClient*);
     
     ~PlatformCALayerWin();
 
@@ -54,7 +54,7 @@ public:
 
     void addAnimationForKey(const String& key, PlatformCAAnimation&) override;
     void removeAnimationForKey(const String& key) override;
-    PassRefPtr<PlatformCAAnimation> animationForKey(const String& key) override;
+    RefPtr<PlatformCAAnimation> animationForKey(const String& key) override;
     void animationStarted(const String& key, CFTimeInterval beginTime) override;
     void animationEnded(const String& key) override;
 
@@ -165,9 +165,9 @@ public:
 
     String layerTreeAsString() const override;
 
-    PassRefPtr<PlatformCALayer> clone(PlatformCALayerClient* owner) const override;
+    Ref<PlatformCALayer> clone(PlatformCALayerClient* owner) const override;
 
-    PassRefPtr<PlatformCALayer> createCompatibleLayer(PlatformCALayer::LayerType, PlatformCALayerClient*) const override;
+    Ref<PlatformCALayer> createCompatibleLayer(PlatformCALayer::LayerType, PlatformCALayerClient*) const override;
 
 private:
     PlatformCALayerWin(LayerType, PlatformLayer*, PlatformCALayerClient* owner);
index 495b816..66cb2e5 100644 (file)
@@ -1,3 +1,54 @@
+2017-05-08  Alex Christensen  <achristensen@webkit.org>
+
+        Reduce PassRefPtr use
+        https://bugs.webkit.org/show_bug.cgi?id=171809
+
+        Reviewed by Chris Dumez.
+
+        * PluginProcess/PluginControllerProxy.cpp:
+        (WebKit::PluginControllerProxy::setInitializationReply):
+        * PluginProcess/PluginControllerProxy.h:
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::WebProcessConnection::destroyPlugin):
+        (WebKit::WebProcessConnection::createPlugin):
+        * PluginProcess/WebProcessConnection.h:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::runOpenPanel):
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::registerUndoStep):
+        * WebProcess/WebPage/VisitedLinkTableController.cpp:
+        (WebKit::VisitedLinkTableController::getOrCreate):
+        * WebProcess/WebPage/VisitedLinkTableController.h:
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::hitTest):
+        (WebKit::WebFrame::createSelectionSnapshot):
+        * WebProcess/WebPage/WebFrame.h:
+        * WebProcess/WebPage/WebOpenPanelResultListener.cpp:
+        (WebKit::WebOpenPanelResultListener::create):
+        (WebKit::WebOpenPanelResultListener::WebOpenPanelResultListener):
+        * WebProcess/WebPage/WebOpenPanelResultListener.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::unapplyEditCommand):
+        (WebKit::WebPage::reapplyEditCommand):
+        * WebProcess/WebPage/WebPageGroupProxy.cpp:
+        (WebKit::WebPageGroupProxy::create):
+        * WebProcess/WebPage/WebPageGroupProxy.h:
+        * WebProcess/WebPage/WebUndoStep.cpp:
+        (WebKit::WebUndoStep::create):
+        * WebProcess/WebPage/WebUndoStep.h:
+        (WebKit::WebUndoStep::step):
+        (WebKit::WebUndoStep::WebUndoStep):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::create):
+        (WebKit::PlatformCALayerRemote::clone):
+        (WebKit::PlatformCALayerRemote::animationForKey):
+        (WebKit::PlatformCALayerRemote::createCompatibleLayer):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h:
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
+        (WebKit::PlatformCALayerRemoteCustom::create):
+        (WebKit::PlatformCALayerRemoteCustom::clone):
+
 2017-05-08  Jer Noble  <jer.noble@apple.com>
 
         [Mac] Audio capture fails when shouldCaptureAudioInUIProcess is set.
index 1739525..887173f 100644 (file)
@@ -91,10 +91,10 @@ PluginControllerProxy::~PluginControllerProxy()
         releaseNPObject(m_pluginElementNPObject);
 }
 
-void PluginControllerProxy::setInitializationReply(PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> reply)
+void PluginControllerProxy::setInitializationReply(Ref<Messages::WebProcessConnection::CreatePlugin::DelayedReply>&& reply)
 {
     ASSERT(!m_initializationReply);
-    m_initializationReply = reply;
+    m_initializationReply = WTFMove(reply);
 }
 
 RefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> PluginControllerProxy::takeInitializationReply()
index 764d097..43f6efa 100644 (file)
@@ -75,7 +75,7 @@ public:
 
     bool isInitializing() const { return m_isInitializing; }
     
-    void setInitializationReply(PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply>);
+    void setInitializationReply(Ref<Messages::WebProcessConnection::CreatePlugin::DelayedReply>&&);
     RefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> takeInitializationReply();
 
 private:
index 54a8ee6..e73663e 100644 (file)
@@ -176,7 +176,7 @@ void WebProcessConnection::didClose(IPC::Connection&)
         destroyPluginControllerProxy(pluginControllers[i]);
 }
 
-void WebProcessConnection::destroyPlugin(uint64_t pluginInstanceID, bool asynchronousCreationIncomplete, PassRefPtr<Messages::WebProcessConnection::DestroyPlugin::DelayedReply> reply)
+void WebProcessConnection::destroyPlugin(uint64_t pluginInstanceID, bool asynchronousCreationIncomplete, Ref<Messages::WebProcessConnection::DestroyPlugin::DelayedReply>&& reply)
 {
     // We return immediately from this synchronous IPC. We want to make sure the plugin destruction is just about to start so audio playback
     // will finish soon after returning. However we don't want to wait for destruction to complete fully as that may take a while.
@@ -229,7 +229,7 @@ void WebProcessConnection::createPluginInternal(const PluginCreationParameters&
 #endif
 }
 
-void WebProcessConnection::createPlugin(const PluginCreationParameters& creationParameters, PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> reply)
+void WebProcessConnection::createPlugin(const PluginCreationParameters& creationParameters, Ref<Messages::WebProcessConnection::CreatePlugin::DelayedReply>&& reply)
 {
     // Ensure we don't clamp any timers during initialization
     ActivityAssertion activityAssertion(PluginProcess::singleton().connectionActivity());
@@ -240,7 +240,7 @@ void WebProcessConnection::createPlugin(const PluginCreationParameters& creation
     if (pluginControllerProxy) {
         // It might still be in the middle of initialization in which case we have to let that initialization complete and respond to this message later.
         if (pluginControllerProxy->isInitializing()) {
-            pluginControllerProxy->setInitializationReply(reply);
+            pluginControllerProxy->setInitializationReply(WTFMove(reply));
             return;
         }
         
index 3f7c903..3b0eb35 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebProcessConnection_h
-#define WebProcessConnection_h
+#pragma once
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
 
@@ -70,9 +69,9 @@ private:
     // Message handlers.
     void didReceiveWebProcessConnectionMessage(IPC::Connection&, IPC::Decoder&);
     void didReceiveSyncWebProcessConnectionMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
-    void createPlugin(const PluginCreationParameters&, PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply>);
+    void createPlugin(const PluginCreationParameters&, Ref<Messages::WebProcessConnection::CreatePlugin::DelayedReply>&&);
     void createPluginAsynchronously(const PluginCreationParameters&);
-    void destroyPlugin(uint64_t pluginInstanceID, bool asynchronousCreationIncomplete, PassRefPtr<Messages::WebProcessConnection::DestroyPlugin::DelayedReply>);
+    void destroyPlugin(uint64_t pluginInstanceID, bool asynchronousCreationIncomplete, Ref<Messages::WebProcessConnection::DestroyPlugin::DelayedReply>&&);
     
     void createPluginInternal(const PluginCreationParameters&, bool& result, bool& wantsWheelEvents, uint32_t& remoteLayerClientID);
 
@@ -86,6 +85,3 @@ private:
 } // namespace WebKit
 
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
-
-
-#endif // WebProcessConnection_h
index 158b034..86f6013 100644 (file)
@@ -773,7 +773,7 @@ void WebChromeClient::runOpenPanel(Frame& frame, FileChooser& fileChooser)
     if (m_page.activeOpenPanelResultListener())
         return;
 
-    m_page.setActiveOpenPanelResultListener(WebOpenPanelResultListener::create(&m_page, &fileChooser));
+    m_page.setActiveOpenPanelResultListener(WebOpenPanelResultListener::create(m_page, fileChooser));
 
     auto* webFrame = WebFrame::fromCoreFrame(frame);
     ASSERT(webFrame);
index 3faee19..a831334 100644 (file)
@@ -245,8 +245,8 @@ void WebEditorClient::registerUndoStep(UndoStep& step)
     if (m_page->isInRedo())
         return;
 
-    auto webStep = WebUndoStep::create(&step);
-    auto editAction = static_cast<uint32_t>(webStep->step()->editingAction());
+    auto webStep = WebUndoStep::create(step);
+    auto editAction = static_cast<uint32_t>(webStep->step().editingAction());
 
     m_page->addWebUndoStep(webStep->stepID(), webStep.ptr());
     m_page->send(Messages::WebPageProxy::RegisterEditCommandForUndo(webStep->stepID(), editAction));
index 0e676f9..1d4b97e 100644 (file)
@@ -44,16 +44,16 @@ static HashMap<uint64_t, VisitedLinkTableController*>& visitedLinkTableControlle
     return visitedLinkTableControllers;
 }
 
-PassRefPtr<VisitedLinkTableController> VisitedLinkTableController::getOrCreate(uint64_t identifier)
+Ref<VisitedLinkTableController> VisitedLinkTableController::getOrCreate(uint64_t identifier)
 {
     auto& visitedLinkTableControllerPtr = visitedLinkTableControllers().add(identifier, nullptr).iterator->value;
     if (visitedLinkTableControllerPtr)
-        return visitedLinkTableControllerPtr;
+        return *visitedLinkTableControllerPtr;
 
     auto visitedLinkTableController = adoptRef(*new VisitedLinkTableController(identifier));
     visitedLinkTableControllerPtr = visitedLinkTableController.ptr();
 
-    return WTFMove(visitedLinkTableController);
+    return visitedLinkTableController;
 }
 
 VisitedLinkTableController::VisitedLinkTableController(uint64_t identifier)
index e133088..d6e82bf 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef VisitedLinkTableController_h
-#define VisitedLinkTableController_h
+#pragma once
 
 #include "MessageReceiver.h"
 #include "SharedMemory.h"
@@ -35,7 +34,7 @@ namespace WebKit {
 
 class VisitedLinkTableController final : public WebCore::VisitedLinkStore , private IPC::MessageReceiver {
 public:
-    static PassRefPtr<VisitedLinkTableController> getOrCreate(uint64_t identifier);
+    static Ref<VisitedLinkTableController> getOrCreate(uint64_t identifier);
     virtual ~VisitedLinkTableController();
 
 private:
@@ -58,5 +57,3 @@ private:
 };
 
 } // namespace WebKit
-
-#endif // VisitedLinkTableController_h
index 9061739..dabf359 100644 (file)
@@ -603,10 +603,10 @@ bool WebFrame::hasVerticalScrollbar() const
     return view->verticalScrollbar();
 }
 
-PassRefPtr<InjectedBundleHitTestResult> WebFrame::hitTest(const IntPoint point) const
+RefPtr<InjectedBundleHitTestResult> WebFrame::hitTest(const IntPoint point) const
 {
     if (!m_coreFrame)
-        return 0;
+        return nullptr;
 
     return InjectedBundleHitTestResult::create(m_coreFrame->eventHandler().hitTestResultAtPoint(point, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowUserAgentShadowContent));
 }
@@ -818,7 +818,7 @@ RetainPtr<CFDataRef> WebFrame::webArchiveData(FrameFilterFunction callback, void
 }
 #endif
 
-PassRefPtr<ShareableBitmap> WebFrame::createSelectionSnapshot() const
+RefPtr<ShareableBitmap> WebFrame::createSelectionSnapshot() const
 {
     std::unique_ptr<ImageBuffer> snapshot = snapshotSelection(*coreFrame(), WebCore::SnapshotOptionsForceBlackText);
     if (!snapshot)
@@ -835,7 +835,7 @@ PassRefPtr<ShareableBitmap> WebFrame::createSelectionSnapshot() const
     graphicsContext->scale(deviceScaleFactor);
     graphicsContext->drawConsumingImageBuffer(WTFMove(snapshot), FloatPoint());
 
-    return WTFMove(sharedSnapshot);
+    return sharedSnapshot;
 }
     
 } // namespace WebKit
index 5142a37..012ba1c 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebFrame_h
-#define WebFrame_h
+#pragma once
 
 #include "APIObject.h"
 #include "DownloadID.h"
@@ -36,7 +35,6 @@
 #include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/PolicyChecker.h>
 #include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/RetainPtr.h>
 
@@ -111,7 +109,7 @@ public:
     WebCore::IntSize scrollOffset() const;
     bool hasHorizontalScrollbar() const;
     bool hasVerticalScrollbar() const;
-    PassRefPtr<InjectedBundleHitTestResult> hitTest(const WebCore::IntPoint) const;
+    RefPtr<InjectedBundleHitTestResult> hitTest(const WebCore::IntPoint) const;
     bool getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha);
     bool containsAnyFormElements() const;
     bool containsAnyFormControls() const;
@@ -158,7 +156,7 @@ public:
     RetainPtr<CFDataRef> webArchiveData(FrameFilterFunction, void* context);
 #endif
 
-    PassRefPtr<ShareableBitmap> createSelectionSnapshot() const;
+    RefPtr<ShareableBitmap> createSelectionSnapshot() const;
 
 #if PLATFORM(IOS)
     uint64_t firstLayerTreeTransactionIDAfterDidCommitLoad() const { return m_firstLayerTreeTransactionIDAfterDidCommitLoad; }
@@ -186,5 +184,3 @@ private:
 };
 
 } // namespace WebKit
-
-#endif // WebFrame_h
index 6866c79..02ff502 100644 (file)
 #include "config.h"
 #include "WebOpenPanelResultListener.h"
 
+#include <WebCore/FileChooser.h>
 #include <WebCore/Icon.h>
 
 namespace WebKit {
 
-Ref<WebOpenPanelResultListener> WebOpenPanelResultListener::create(WebPage* page, PassRefPtr<WebCore::FileChooser> fileChooser)
+Ref<WebOpenPanelResultListener> WebOpenPanelResultListener::create(WebPage& page, Ref<WebCore::FileChooser>&& fileChooser)
 {
-    return adoptRef(*new WebOpenPanelResultListener(page, fileChooser));
+    return adoptRef(*new WebOpenPanelResultListener(page, WTFMove(fileChooser)));
 }
 
-WebOpenPanelResultListener::WebOpenPanelResultListener(WebPage* page, PassRefPtr<WebCore::FileChooser> fileChooser)
-    : m_page(page)
-    , m_fileChooser(fileChooser)
+WebOpenPanelResultListener::WebOpenPanelResultListener(WebPage& page, Ref<WebCore::FileChooser>&& fileChooser)
+    : m_page(&page)
+    , m_fileChooser(WTFMove(fileChooser))
 {
 }
 
index 69330d2..f47f02c 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebOpenPanelResultListener_h
-#define WebOpenPanelResultListener_h
+#pragma once
 
+#include <wtf/Forward.h>
+#include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
-#include <WebCore/FileChooser.h>
+#include <wtf/Vector.h>
 
 namespace WebCore {
+class FileChooser;
 class Icon;
 }
 
@@ -39,7 +41,7 @@ class WebPage;
 
 class WebOpenPanelResultListener : public RefCounted<WebOpenPanelResultListener> {
 public:
-    static Ref<WebOpenPanelResultListener> create(WebPage*, PassRefPtr<WebCore::FileChooser>);
+    static Ref<WebOpenPanelResultListener> create(WebPage&, Ref<WebCore::FileChooser>&&);
     ~WebOpenPanelResultListener();
 
     void disconnectFromPage() { m_page = 0; }
@@ -49,13 +51,10 @@ public:
 #endif
 
 private:
-    WebOpenPanelResultListener(WebPage*, PassRefPtr<WebCore::FileChooser>);
+    WebOpenPanelResultListener(WebPage&, Ref<WebCore::FileChooser>&&);
 
     WebPage* m_page;
-    RefPtr<WebCore::FileChooser> m_fileChooser;
+    Ref<WebCore::FileChooser> m_fileChooser;
 };
 
 } // namespace WebKit
-
-
-#endif // WebOpenPanelResultListener_h
index a452c03..e2bd931 100644 (file)
@@ -3710,7 +3710,7 @@ void WebPage::unapplyEditCommand(uint64_t stepID)
     if (!step)
         return;
 
-    step->step()->unapply();
+    step->step().unapply();
 }
 
 void WebPage::reapplyEditCommand(uint64_t stepID)
@@ -3720,7 +3720,7 @@ void WebPage::reapplyEditCommand(uint64_t stepID)
         return;
 
     m_isInRedo = true;
-    step->step()->reapply();
+    step->step().reapply();
     m_isInRedo = false;
 }
 
index c6fb721..f55f1d7 100644 (file)
 
 namespace WebKit {
 
-PassRefPtr<WebPageGroupProxy> WebPageGroupProxy::create(const WebPageGroupData& data)
+Ref<WebPageGroupProxy> WebPageGroupProxy::create(const WebPageGroupData& data)
 {
     auto pageGroup = adoptRef(*new WebPageGroupProxy(data));
 
     if (pageGroup->isVisibleToInjectedBundle() && WebProcess::singleton().injectedBundle())
         WebProcess::singleton().injectedBundle()->didInitializePageGroup(pageGroup.ptr());
 
-    return WTFMove(pageGroup);
+    return pageGroup;
 }
 
 WebPageGroupProxy::WebPageGroupProxy(const WebPageGroupData& data)
index c98b8ae..c88ae3c 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebPageGroupProxy_h
-#define WebPageGroupProxy_h
+#pragma once
 
 #include "APIObject.h"
 #include "WebPageGroupData.h"
-#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
 
 namespace WebCore {
 class PageGroup;
@@ -40,7 +39,7 @@ class WebUserContentController;
 
 class WebPageGroupProxy : public API::ObjectImpl<API::Object::Type::BundlePageGroup> {
 public:
-    static PassRefPtr<WebPageGroupProxy> create(const WebPageGroupData&);
+    static Ref<WebPageGroupProxy> create(const WebPageGroupData&);
     virtual ~WebPageGroupProxy();
 
     const String& identifier() const { return m_data.identifier; }
@@ -60,5 +59,3 @@ private:
 };
 
 } // namespace WebKit
-
-#endif // WebPageGroupProxy_h
index 2caa8d0..55ec550 100644 (file)
@@ -34,9 +34,9 @@ static uint64_t generateUndoStep()
     return uniqueEntryID++;
 }
 
-Ref<WebUndoStep> WebUndoStep::create(PassRefPtr<WebCore::UndoStep> step)
+Ref<WebUndoStep> WebUndoStep::create(Ref<WebCore::UndoStep>&& step)
 {
-    return adoptRef(*new WebUndoStep(step, generateUndoStep()));
+    return adoptRef(*new WebUndoStep(WTFMove(step), generateUndoStep()));
 }
 
 WebUndoStep::~WebUndoStep()
index 11871e9..9b6fcf8 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebUndoStep_h
-#define WebUndoStep_h
+#pragma once
 
 #include <WebCore/UndoStep.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
+#include <wtf/Ref.h>
 
 namespace WebKit {
 
 class WebUndoStep : public RefCounted<WebUndoStep> {
 public:
-    static Ref<WebUndoStep> create(PassRefPtr<WebCore::UndoStep>);
+    static Ref<WebUndoStep> create(Ref<WebCore::UndoStep>&&);
     ~WebUndoStep();
 
-    WebCore::UndoStep* step() const { return m_step.get(); }
+    WebCore::UndoStep& step() const { return m_step.get(); }
     uint64_t stepID() const { return m_stepID; }
 
 private:
-    WebUndoStep(PassRefPtr<WebCore::UndoStep> step, uint64_t stepID)
-        : m_step(step)
+    WebUndoStep(Ref<WebCore::UndoStep>&& step, uint64_t stepID)
+        : m_step(WTFMove(step))
         , m_stepID(stepID)
     {
     }
 
-    RefPtr<WebCore::UndoStep> m_step;
+    Ref<WebCore::UndoStep> m_step;
     uint64_t m_stepID;
 };
 
 } // namespace WebKit
-
-#endif // WebEditCommand_h
index d2ce358..761b2a2 100644 (file)
@@ -49,7 +49,7 @@ PassRefPtr<PlatformCALayer> GraphicsLayerCARemote::createPlatformCALayer(Platfor
     if (result->canHaveBackingStore())
         result->setWantsDeepColorBackingStore(screenSupportsExtendedColor());
 
-    return result;
+    return WTFMove(result);
 }
 
 PassRefPtr<PlatformCALayer> GraphicsLayerCARemote::createPlatformCALayer(PlatformLayer* platformLayer, PlatformCALayerClient* owner)
index c1d8b88..ee7fe8c 100644 (file)
@@ -44,7 +44,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
-PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
+Ref<PlatformCALayerRemote> PlatformCALayerRemote::create(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
 {
     RefPtr<PlatformCALayerRemote> layer;
 
@@ -55,21 +55,21 @@ PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(LayerType layerT
 
     context.layerWasCreated(*layer, layerType);
 
-    return WTFMove(layer);
+    return layer.releaseNonNull();
 }
 
-PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(PlatformLayer *platformLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
+Ref<PlatformCALayerRemote> PlatformCALayerRemote::create(PlatformLayer *platformLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
 {
     return PlatformCALayerRemoteCustom::create(platformLayer, owner, context);
 }
 
-PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(const PlatformCALayerRemote& other, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
+Ref<PlatformCALayerRemote> PlatformCALayerRemote::create(const PlatformCALayerRemote& other, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
 {
     auto layer = adoptRef(*new PlatformCALayerRemote(other, owner, context));
 
     context.layerWasCreated(layer.get(), other.layerType());
 
-    return WTFMove(layer);
+    return layer;
 }
 
 PlatformCALayerRemote::PlatformCALayerRemote(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
@@ -89,11 +89,11 @@ PlatformCALayerRemote::PlatformCALayerRemote(const PlatformCALayerRemote& other,
 {
 }
 
-PassRefPtr<PlatformCALayer> PlatformCALayerRemote::clone(PlatformCALayerClient* owner) const
+Ref<PlatformCALayer> PlatformCALayerRemote::clone(PlatformCALayerClient* owner) const
 {
     auto clone = PlatformCALayerRemote::create(*this, owner, *m_context);
 
-    updateClonedLayerProperties(*clone);
+    updateClonedLayerProperties(clone);
 
     clone->setClonedLayer(this);
     return WTFMove(clone);
@@ -357,7 +357,7 @@ void PlatformCALayerRemote::removeAnimationForKey(const String& key)
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnimationsChanged);
 }
 
-PassRefPtr<PlatformCAAnimation> PlatformCALayerRemote::animationForKey(const String& key)
+RefPtr<PlatformCAAnimation> PlatformCALayerRemote::animationForKey(const String& key)
 {
     return m_animations.get(key);
 }
@@ -821,7 +821,7 @@ void PlatformCALayerRemote::updateCustomAppearance(GraphicsLayer::CustomAppearan
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomAppearanceChanged);
 }
 
-PassRefPtr<PlatformCALayer> PlatformCALayerRemote::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
+Ref<PlatformCALayer> PlatformCALayerRemote::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
 {
     return PlatformCALayerRemote::create(layerType, client, *m_context);
 }
index 58b5a98..5267682 100644 (file)
@@ -39,9 +39,9 @@ class RemoteLayerTreeContext;
 
 class PlatformCALayerRemote : public WebCore::PlatformCALayer {
 public:
-    static PassRefPtr<PlatformCALayerRemote> create(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
-    static PassRefPtr<PlatformCALayerRemote> create(PlatformLayer *, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
-    static PassRefPtr<PlatformCALayerRemote> create(const PlatformCALayerRemote&, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
+    static Ref<PlatformCALayerRemote> create(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
+    static Ref<PlatformCALayerRemote> create(PlatformLayer *, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
+    static Ref<PlatformCALayerRemote> create(const PlatformCALayerRemote&, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
 
     virtual ~PlatformCALayerRemote();
 
@@ -66,7 +66,7 @@ public:
 
     void addAnimationForKey(const String& key, WebCore::PlatformCAAnimation&) override;
     void removeAnimationForKey(const String& key) override;
-    PassRefPtr<WebCore::PlatformCAAnimation> animationForKey(const String& key) override;
+    RefPtr<WebCore::PlatformCAAnimation> animationForKey(const String& key) override;
     void animationStarted(const String& key, CFTimeInterval beginTime) override;
     void animationEnded(const String& key) override;
 
@@ -175,9 +175,9 @@ public:
 
     WebCore::TiledBacking* tiledBacking() override { return nullptr; }
 
-    PassRefPtr<WebCore::PlatformCALayer> clone(WebCore::PlatformCALayerClient* owner) const override;
+    Ref<WebCore::PlatformCALayer> clone(WebCore::PlatformCALayerClient* owner) const override;
 
-    PassRefPtr<PlatformCALayer> createCompatibleLayer(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*) const override;
+    Ref<PlatformCALayer> createCompatibleLayer(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*) const override;
 
     void enumerateRectsBeingDrawn(CGContextRef, void (^block)(CGRect)) override;
 
index e28d367..dad64cf 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef PlatformCALayerRemoteCustom_h
-#define PlatformCALayerRemoteCustom_h
+#pragma once
 
 #include "PlatformCALayerRemote.h"
 
@@ -36,7 +35,7 @@ class LayerHostingContext;
 class PlatformCALayerRemoteCustom final : public PlatformCALayerRemote {
     friend class PlatformCALayerRemote;
 public:
-    static PassRefPtr<PlatformCALayerRemote> create(PlatformLayer *, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
+    static Ref<PlatformCALayerRemote> create(PlatformLayer *, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
 
     virtual ~PlatformCALayerRemoteCustom();
 
@@ -50,7 +49,7 @@ public:
 private:
     PlatformCALayerRemoteCustom(WebCore::PlatformCALayer::LayerType, PlatformLayer *, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext&);
 
-    PassRefPtr<WebCore::PlatformCALayer> clone(WebCore::PlatformCALayerClient* owner) const override;
+    Ref<WebCore::PlatformCALayer> clone(WebCore::PlatformCALayerClient* owner) const override;
 
     bool isPlatformCALayerRemoteCustom() const override { return true; }
 
@@ -65,5 +64,3 @@ private:
 } // namespace WebKit
 
 SPECIALIZE_TYPE_TRAITS_PLATFORM_CALAYER(WebKit::PlatformCALayerRemoteCustom, isPlatformCALayerRemote())
-
-#endif // PlatformCALayerRemoteCustom_h
index 49c4397..b9690d9 100644 (file)
@@ -46,11 +46,10 @@ namespace WebKit {
 
 static NSString * const platformCALayerPointer = @"WKPlatformCALayer";
 
-PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemoteCustom::create(PlatformLayer *platformLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
+Ref<PlatformCALayerRemote> PlatformCALayerRemoteCustom::create(PlatformLayer *platformLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
 {
     auto layer = adoptRef(*new PlatformCALayerRemoteCustom(PlatformCALayerCocoa::layerTypeForPlatformLayer(platformLayer), platformLayer, owner, context));
     context.layerWasCreated(layer.get(), layer->layerType());
-
     return WTFMove(layer);
 }
 
@@ -100,7 +99,7 @@ uint32_t PlatformCALayerRemoteCustom::hostingContextID()
     return m_layerHostingContext->contextID();
 }
 
-PassRefPtr<WebCore::PlatformCALayer> PlatformCALayerRemoteCustom::clone(PlatformCALayerClient* owner) const
+Ref<WebCore::PlatformCALayer> PlatformCALayerRemoteCustom::clone(PlatformCALayerClient* owner) const
 {
     RetainPtr<CALayer *> clonedLayer;
     bool copyContents = true;