Title: [216448] trunk/Source
Revision
216448
Author
achristen...@apple.com
Date
2017-05-08 13:11:29 -0700 (Mon, 08 May 2017)

Log Message

Reduce PassRefPtr use
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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (216447 => 216448)


--- trunk/Source/WebCore/ChangeLog	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebCore/ChangeLog	2017-05-08 20:11:29 UTC (rev 216448)
@@ -1,3 +1,24 @@
+2017-05-08  Alex Christensen  <achristen...@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.no...@apple.com>
 
         [Mac] Audio capture fails when shouldCaptureAudioInUIProcess is set.

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (216447 => 216448)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -356,7 +356,7 @@
     if (result->canHaveBackingStore())
         result->setWantsDeepColorBackingStore(screenSupportsExtendedColor());
     
-    return result;
+    return WTFMove(result);
 #elif PLATFORM(WIN)
     return PlatformCALayerWin::create(layerType, owner);
 #endif

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp (216447 => 216448)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -167,19 +167,16 @@
     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()

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (216447 => 216448)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -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 @@
     };
     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 @@
 
     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 @@
     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;

Modified: trunk/Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp (216447 => 216448)


--- trunk/Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -35,10 +35,10 @@
 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);

Modified: trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp (216447 => 216448)


--- trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -65,7 +65,7 @@
 
 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)
 {

Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h (216447 => 216448)


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -33,11 +33,11 @@
 
 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 @@
 
     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 @@
 
     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;
 

Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm (216447 => 216448)


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2017-05-08 20:11:29 UTC (rev 216448)
@@ -69,14 +69,14 @@
 
 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 @@
     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 @@
         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 @@
     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 @@
     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 @@
     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);
 }

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (216447 => 216448)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -47,14 +47,14 @@
 
 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 @@
     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 @@
     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 @@
     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);
 }

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h (216447 => 216448)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -32,8 +32,8 @@
 
 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 @@
 
     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 @@
 
     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);

Modified: trunk/Source/WebKit2/ChangeLog (216447 => 216448)


--- trunk/Source/WebKit2/ChangeLog	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/ChangeLog	2017-05-08 20:11:29 UTC (rev 216448)
@@ -1,3 +1,54 @@
+2017-05-08  Alex Christensen  <achristen...@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.no...@apple.com>
 
         [Mac] Audio capture fails when shouldCaptureAudioInUIProcess is set.

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (216447 => 216448)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -91,10 +91,10 @@
         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()

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h (216447 => 216448)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -75,7 +75,7 @@
 
     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:

Modified: trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp (216447 => 216448)


--- trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -176,7 +176,7 @@
         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 @@
 #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 @@
     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;
         }
         

Modified: trunk/Source/WebKit2/PluginProcess/WebProcessConnection.h (216447 => 216448)


--- trunk/Source/WebKit2/PluginProcess/WebProcessConnection.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/PluginProcess/WebProcessConnection.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -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 @@
     // 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 @@
 } // namespace WebKit
 
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
-
-
-#endif // WebProcessConnection_h

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -773,7 +773,7 @@
     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);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -245,8 +245,8 @@
     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));

Modified: trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.cpp (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -44,16 +44,16 @@
     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)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.h (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -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 @@
 
 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 @@
 };
 
 } // namespace WebKit
-
-#endif // VisitedLinkTableController_h

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -603,10 +603,10 @@
     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 @@
 }
 #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 @@
     graphicsContext->scale(deviceScaleFactor);
     graphicsContext->drawConsumingImageBuffer(WTFMove(snapshot), FloatPoint());
 
-    return WTFMove(sharedSnapshot);
+    return sharedSnapshot;
 }
     
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -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 @@
     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 @@
     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 @@
 };
 
 } // namespace WebKit
-
-#endif // WebFrame_h

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -26,18 +26,19 @@
 #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))
 {
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.h (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -23,13 +23,15 @@
  * 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 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 @@
 #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

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -3710,7 +3710,7 @@
     if (!step)
         return;
 
-    step->step()->unapply();
+    step->step().unapply();
 }
 
 void WebPage::reapplyEditCommand(uint64_t stepID)
@@ -3720,7 +3720,7 @@
         return;
 
     m_isInRedo = true;
-    step->step()->reapply();
+    step->step().reapply();
     m_isInRedo = false;
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -35,7 +35,7 @@
 
 namespace WebKit {
 
-PassRefPtr<WebPageGroupProxy> WebPageGroupProxy::create(const WebPageGroupData& data)
+Ref<WebPageGroupProxy> WebPageGroupProxy::create(const WebPageGroupData& data)
 {
     auto pageGroup = adoptRef(*new WebPageGroupProxy(data));
 
@@ -42,7 +42,7 @@
     if (pageGroup->isVisibleToInjectedBundle() && WebProcess::singleton().injectedBundle())
         WebProcess::singleton().injectedBundle()->didInitializePageGroup(pageGroup.ptr());
 
-    return WTFMove(pageGroup);
+    return pageGroup;
 }
 
 WebPageGroupProxy::WebPageGroupProxy(const WebPageGroupData& data)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -23,12 +23,11 @@
  * 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 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 @@
 };
 
 } // namespace WebKit
-
-#endif // WebPageGroupProxy_h

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebUndoStep.cpp (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebUndoStep.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebUndoStep.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -34,9 +34,9 @@
     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()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebUndoStep.h (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebUndoStep.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebUndoStep.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -23,34 +23,30 @@
  * 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

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -49,7 +49,7 @@
     if (result->canHaveBackingStore())
         result->setWantsDeepColorBackingStore(screenSupportsExtendedColor());
 
-    return result;
+    return WTFMove(result);
 }
 
 PassRefPtr<PlatformCALayer> GraphicsLayerCARemote::createPlatformCALayer(PlatformLayer* platformLayer, PlatformCALayerClient* owner)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2017-05-08 20:11:29 UTC (rev 216448)
@@ -44,7 +44,7 @@
 
 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 @@
 
     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 @@
 {
 }
 
-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 @@
     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 @@
     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);
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -39,9 +39,9 @@
 
 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 @@
 
     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 @@
 
     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;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h	2017-05-08 20:11:29 UTC (rev 216448)
@@ -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 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 @@
 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 @@
 } // namespace WebKit
 
 SPECIALIZE_TYPE_TRAITS_PLATFORM_CALAYER(WebKit::PlatformCALayerRemoteCustom, isPlatformCALayerRemote())
-
-#endif // PlatformCALayerRemoteCustom_h

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm (216447 => 216448)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm	2017-05-08 20:07:28 UTC (rev 216447)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm	2017-05-08 20:11:29 UTC (rev 216448)
@@ -46,11 +46,10 @@
 
 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 @@
     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;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to