Remove some uses of PassOwnPtr in WebKit2
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Sep 2013 18:57:52 +0000 (18:57 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Sep 2013 18:57:52 +0000 (18:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121443

Reviewed by Andreas Kling.

* Scripts/webkit2/messages.py:
(message_to_struct_declaration):
(generate_message_handler):
* Scripts/webkit2/messages_unittest.py:
* UIProcess/API/mac/FindIndicatorWindow.h:
* UIProcess/API/mac/FindIndicatorWindow.mm:
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* UIProcess/API/mac/WKView.mm:
(-[WKView WebKit::]):
(-[WKView _setFindIndicator:fadeOut:animate:]):
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/DrawingAreaProxyImpl.cpp:
* UIProcess/DrawingAreaProxyImpl.h:
* UIProcess/PageClient.h:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
* WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
(PageOverlayClientImpl::PageOverlayClientImpl):
(WKBundlePageOverlayCreate):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::createWebEvent):
* WebProcess/Plugins/PluginView.h:

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

17 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Scripts/webkit2/messages.py
Source/WebKit2/Scripts/webkit2/messages_unittest.py
Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h
Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm
Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h
Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp
Source/WebKit2/WebProcess/Plugins/PluginView.cpp
Source/WebKit2/WebProcess/Plugins/PluginView.h

index ef2c0b7..7574d1d 100644 (file)
@@ -1,3 +1,35 @@
+2013-09-16  Anders Carlsson  <andersca@apple.com>
+
+        Remove some uses of PassOwnPtr in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=121443
+
+        Reviewed by Andreas Kling.
+
+        * Scripts/webkit2/messages.py:
+        (message_to_struct_declaration):
+        (generate_message_handler):
+        * Scripts/webkit2/messages_unittest.py:
+        * UIProcess/API/mac/FindIndicatorWindow.h:
+        * UIProcess/API/mac/FindIndicatorWindow.mm:
+        * UIProcess/API/mac/PageClientImpl.h:
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::createDrawingAreaProxy):
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView WebKit::]):
+        (-[WKView _setFindIndicator:fadeOut:animate:]):
+        * UIProcess/API/mac/WKViewInternal.h:
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        * UIProcess/DrawingAreaProxyImpl.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
+        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
+        * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
+        (PageOverlayClientImpl::PageOverlayClientImpl):
+        (WKBundlePageOverlayCreate):
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::createWebEvent):
+        * WebProcess/Plugins/PluginView.h:
+
 2013-09-16  Andre Moreira Magalhaes   <andre.magalhaes@collabora.co.uk>
 
         Web Inspector: Do not try to parse incomplete HTTP requests
index 07676de..7970c09 100644 (file)
@@ -130,7 +130,7 @@ def message_to_struct_declaration(message):
         if message.has_attribute(DELAYED_ATTRIBUTE):
             send_parameters = [(function_parameter_type(x.type), x.name) for x in message.reply_parameters]
             result.append('    struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> {\n')
-            result.append('        DelayedReply(PassRefPtr<CoreIPC::Connection>, PassOwnPtr<CoreIPC::MessageEncoder>);\n')
+            result.append('        DelayedReply(PassRefPtr<CoreIPC::Connection>, OwnPtr<CoreIPC::MessageEncoder>);\n')
             result.append('        ~DelayedReply();\n')
             result.append('\n')
             result.append('        bool send(%s);\n' % ', '.join([' '.join(x) for x in send_parameters]))
@@ -521,9 +521,9 @@ def generate_message_handler(file):
             if message.condition:
                 result.append('#if %s\n\n' % message.condition)
             
-            result.append('%s::DelayedReply::DelayedReply(PassRefPtr<CoreIPC::Connection> connection, PassOwnPtr<CoreIPC::MessageEncoder> encoder)\n' % message.name)
+            result.append('%s::DelayedReply::DelayedReply(PassRefPtr<CoreIPC::Connection> connection, OwnPtr<CoreIPC::MessageEncoder> encoder)\n' % message.name)
             result.append('    : m_connection(connection)\n')
-            result.append('    , m_encoder(encoder)\n')
+            result.append('    , m_encoder(std::move(encoder))\n')
             result.append('{\n')
             result.append('}\n')
             result.append('\n')
index a7a403c..d11e278 100644 (file)
@@ -476,7 +476,7 @@ struct GetPluginProcessConnection : CoreIPC::Arguments1<const WTF::String&> {
     static const bool isSync = true;
 
     struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> {
-        DelayedReply(PassRefPtr<CoreIPC::Connection>, PassOwnPtr<CoreIPC::MessageEncoder>);
+        DelayedReply(PassRefPtr<CoreIPC::Connection>, OwnPtr<CoreIPC::MessageEncoder>);
         ~DelayedReply();
 
         bool send(const CoreIPC::Connection::Handle& connectionHandle);
@@ -500,7 +500,7 @@ struct TestMultipleAttributes : CoreIPC::Arguments0 {
     static const bool isSync = true;
 
     struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> {
-        DelayedReply(PassRefPtr<CoreIPC::Connection>, PassOwnPtr<CoreIPC::MessageEncoder>);
+        DelayedReply(PassRefPtr<CoreIPC::Connection>, OwnPtr<CoreIPC::MessageEncoder>);
         ~DelayedReply();
 
         bool send();
@@ -663,9 +663,9 @@ namespace Messages {
 
 namespace WebPage {
 
-GetPluginProcessConnection::DelayedReply::DelayedReply(PassRefPtr<CoreIPC::Connection> connection, PassOwnPtr<CoreIPC::MessageEncoder> encoder)
+GetPluginProcessConnection::DelayedReply::DelayedReply(PassRefPtr<CoreIPC::Connection> connection, OwnPtr<CoreIPC::MessageEncoder> encoder)
     : m_connection(connection)
-    , m_encoder(encoder)
+    , m_encoder(std::move(encoder))
 {
 }
 
@@ -683,9 +683,9 @@ bool GetPluginProcessConnection::DelayedReply::send(const CoreIPC::Connection::H
     return result;
 }
 
-TestMultipleAttributes::DelayedReply::DelayedReply(PassRefPtr<CoreIPC::Connection> connection, PassOwnPtr<CoreIPC::MessageEncoder> encoder)
+TestMultipleAttributes::DelayedReply::DelayedReply(PassRefPtr<CoreIPC::Connection> connection, OwnPtr<CoreIPC::MessageEncoder> encoder)
     : m_connection(connection)
-    , m_encoder(encoder)
+    , m_encoder(std::move(encoder))
 {
 }
 
index cbe34a1..1631493 100644 (file)
@@ -44,13 +44,12 @@ class FindIndicatorWindow {
     WTF_MAKE_NONCOPYABLE(FindIndicatorWindow);
 
 public:
-    static PassOwnPtr<FindIndicatorWindow> create(WKView *);
+    explicit FindIndicatorWindow(WKView *);
     ~FindIndicatorWindow();
 
     void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
 
 private:
-    explicit FindIndicatorWindow(WKView *);
     void closeWindow();
 
     void startFadeOutTimerFired();
index 19d6966..8aa94bd 100644 (file)
@@ -112,11 +112,6 @@ using namespace WebCore;
 
 namespace WebKit {
 
-PassOwnPtr<FindIndicatorWindow> FindIndicatorWindow::create(WKView *wkView)
-{
-    return adoptPtr(new FindIndicatorWindow(wkView));
-}
-
 FindIndicatorWindow::FindIndicatorWindow(WKView *wkView)
     : m_wkView(wkView)
     , m_bounceAnimationContext(0)
index 5f747c0..932c74b 100644 (file)
@@ -50,7 +50,7 @@ public:
 private:
     explicit PageClientImpl(WKView*);
 
-    virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
+    virtual OwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
     virtual void setViewNeedsDisplay(const WebCore::IntRect&);
     virtual void displayView();
     virtual bool canScrollView();
index f80ef7d..6e71d11 100644 (file)
@@ -138,7 +138,7 @@ PageClientImpl::~PageClientImpl()
 {
 }
 
-PassOwnPtr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
+OwnPtr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
 {
     return [m_wkView _createDrawingAreaProxy];
 }
index 77ed70c..3999a01 100644 (file)
@@ -2365,18 +2365,18 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
 
 @implementation WKView (Internal)
 
-- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy
+- (OwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy
 {
 #if ENABLE(THREADED_SCROLLING)
     if ([self _shouldUseTiledDrawingArea]) {
         if (getenv("WK_USE_REMOTE_LAYER_TREE_DRAWING_AREA"))
             return RemoteLayerTreeDrawingAreaProxy::create(_data->_page.get());
 
-        return TiledCoreAnimationDrawingAreaProxy::create(_data->_page.get());
+        return createOwned<TiledCoreAnimationDrawingAreaProxy>(_data->_page.get());
     }
 #endif
 
-    return DrawingAreaProxyImpl::create(_data->_page.get());
+    return createOwned<DrawingAreaProxyImpl>(_data->_page.get());
 }
 
 - (BOOL)_isFocused
@@ -2659,7 +2659,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
     }
 
     if (!_data->_findIndicatorWindow)
-        _data->_findIndicatorWindow = FindIndicatorWindow::create(self);
+        _data->_findIndicatorWindow = createOwned<FindIndicatorWindow>(self);
 
     _data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut, animate);
 }
index 8e62c57..67aee1c 100644 (file)
@@ -50,7 +50,7 @@ namespace WebKit {
 @class WKFullScreenWindowController;
 
 @interface WKView (Internal)
-- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy;
+- (OwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy;
 - (BOOL)_isFocused;
 - (void)_processDidCrash;
 - (void)_pageClosed;
index 790c8a9..1c7ab40 100644 (file)
@@ -44,11 +44,6 @@ using namespace WebCore;
 
 namespace WebKit {
 
-PassOwnPtr<DrawingAreaProxyImpl> DrawingAreaProxyImpl::create(WebPageProxy* webPageProxy)
-{
-    return adoptPtr(new DrawingAreaProxyImpl(webPageProxy));
-}
-
 DrawingAreaProxyImpl::DrawingAreaProxyImpl(WebPageProxy* webPageProxy)
     : DrawingAreaProxy(DrawingAreaTypeImpl, webPageProxy)
     , m_currentBackingStoreStateID(0)
index 27bc143..b91a2bc 100644 (file)
@@ -43,7 +43,7 @@ class CoordinatedLayerTreeHostProxy;
 
 class DrawingAreaProxyImpl : public DrawingAreaProxy {
 public:
-    static PassOwnPtr<DrawingAreaProxyImpl> create(WebPageProxy*);
+    explicit DrawingAreaProxyImpl(WebPageProxy*);
     virtual ~DrawingAreaProxyImpl();
 
     void paint(BackingStore::PlatformGraphicsContext, const WebCore::IntRect&, WebCore::Region& unpaintedRegion);
@@ -55,8 +55,6 @@ public:
     bool hasReceivedFirstUpdate() const { return m_hasReceivedFirstUpdate; }
 
 private:
-    explicit DrawingAreaProxyImpl(WebPageProxy*);
-
     // DrawingAreaProxy
     virtual void sizeDidChange();
     virtual void deviceScaleFactorDidChange();
index 3b7ecb8..eead146 100644 (file)
@@ -77,7 +77,7 @@ public:
     virtual ~PageClient() { }
 
     // Create a new drawing area proxy for the given page.
-    virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy() = 0;
+    virtual OwnPtr<DrawingAreaProxy> createDrawingAreaProxy() = 0;
 
     // Tell the view to invalidate the given rect. The rect is in view coordinates.
     virtual void setViewNeedsDisplay(const WebCore::IntRect&) = 0;
index ad1043b..6e0ca28 100644 (file)
@@ -35,12 +35,10 @@ namespace WebKit {
 
 class TiledCoreAnimationDrawingAreaProxy : public DrawingAreaProxy {
 public:
-    static PassOwnPtr<TiledCoreAnimationDrawingAreaProxy> create(WebPageProxy*);
+    explicit TiledCoreAnimationDrawingAreaProxy(WebPageProxy*);
     virtual ~TiledCoreAnimationDrawingAreaProxy();
 
 private:
-    explicit TiledCoreAnimationDrawingAreaProxy(WebPageProxy*);
-
     // DrawingAreaProxy
     virtual void deviceScaleFactorDidChange() OVERRIDE;
     virtual void layerHostingModeDidChange() OVERRIDE;
index 973768d..d0338eb 100644 (file)
@@ -39,11 +39,6 @@ using namespace WebCore;
 
 namespace WebKit {
 
-PassOwnPtr<TiledCoreAnimationDrawingAreaProxy> TiledCoreAnimationDrawingAreaProxy::create(WebPageProxy* webPageProxy)
-{
-    return adoptPtr(new TiledCoreAnimationDrawingAreaProxy(webPageProxy));
-}
-
 TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy(WebPageProxy* webPageProxy)
     : DrawingAreaProxy(DrawingAreaTypeTiledCoreAnimation, webPageProxy)
     , m_isWaitingForDidUpdateGeometry(false)
index e963b81..de48100 100644 (file)
@@ -37,9 +37,12 @@ using namespace WebKit;
 
 class PageOverlayClientImpl : public PageOverlay::Client {
 public:
-    static PassOwnPtr<PageOverlayClientImpl> create(WKBundlePageOverlayClient* client)
+    explicit PageOverlayClientImpl(WKBundlePageOverlayClient* client)
+        : m_client()
+        , m_accessibilityClient()
     {
-        return adoptPtr(new PageOverlayClientImpl(client));
+        if (client)
+            m_client = *client;
     }
 
     virtual void setAccessibilityClient(WKBundlePageOverlayAccessibilityClient* client)
@@ -49,14 +52,6 @@ public:
     }
 
 private:
-    explicit PageOverlayClientImpl(WKBundlePageOverlayClient* client)
-        : m_client()
-        , m_accessibilityClient()
-    {
-        if (client)
-            m_client = *client;
-    }
-
     // PageOverlay::Client.
     virtual void pageOverlayDestroyed(PageOverlay*)
     {
@@ -150,8 +145,9 @@ WKBundlePageOverlayRef WKBundlePageOverlayCreate(WKBundlePageOverlayClient* wkCl
     if (wkClient && wkClient->version)
         return 0;
 
-    OwnPtr<PageOverlayClientImpl> clientImpl = PageOverlayClientImpl::create(wkClient);
+    auto clientImpl = createOwned<PageOverlayClientImpl>(wkClient);
 
+    // FIXME: Looks like this leaks the clientImpl.
     return toAPI(PageOverlay::create(clientImpl.leakPtr()).leakRef());
 }
 
index afe1473..d3683e7 100644 (file)
@@ -816,7 +816,7 @@ String PluginView::getSelectionString() const
     return m_plugin->getSelectionString();
 }
 
-PassOwnPtr<WebEvent> PluginView::createWebEvent(MouseEvent* event) const
+OwnPtr<WebEvent> PluginView::createWebEvent(MouseEvent* event) const
 {
     WebEvent::Type type = WebEvent::NoType;
     unsigned clickCount = 1;
index 3524c9a..2d0433d 100644 (file)
@@ -219,7 +219,7 @@ private:
     virtual void didFinishLoad(WebFrame*);
     virtual void didFailLoad(WebFrame*, bool wasCancelled);
 
-    PassOwnPtr<WebEvent> createWebEvent(WebCore::MouseEvent*) const;
+    OwnPtr<WebEvent> createWebEvent(WebCore::MouseEvent*) const;
 
     RefPtr<WebCore::HTMLPlugInElement> m_pluginElement;
     RefPtr<Plugin> m_plugin;