Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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:

Canonical link: https://commits.webkit.org/139423@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155888 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Sep 16, 2013
1 parent 485bfcf commit 9fb1141
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 53 deletions.
32 changes: 32 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions Source/WebKit2/Scripts/webkit2/messages.py
Expand Up @@ -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]))
Expand Down Expand Up @@ -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')
Expand Down
12 changes: 6 additions & 6 deletions Source/WebKit2/Scripts/webkit2/messages_unittest.py
Expand Up @@ -476,7 +476,7 @@ class WebTouchEvent;
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);
Expand All @@ -500,7 +500,7 @@ class WebTouchEvent;
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();
Expand Down Expand Up @@ -663,9 +663,9 @@ class WebTouchEvent;
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))
{
}
Expand All @@ -683,9 +683,9 @@ class WebTouchEvent;
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))
{
}
Expand Down
3 changes: 1 addition & 2 deletions Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h
Expand Up @@ -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();
Expand Down
5 changes: 0 additions & 5 deletions Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm
Expand Up @@ -112,11 +112,6 @@ - (void)animationDidEnd:(NSAnimation *)animation

namespace WebKit {

PassOwnPtr<FindIndicatorWindow> FindIndicatorWindow::create(WKView *wkView)
{
return adoptPtr(new FindIndicatorWindow(wkView));
}

FindIndicatorWindow::FindIndicatorWindow(WKView *wkView)
: m_wkView(wkView)
, m_bounceAnimationContext(0)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
Expand Up @@ -50,7 +50,7 @@ class PageClientImpl FINAL : public PageClient {
private:
explicit PageClientImpl(WKView*);

virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
virtual OwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
virtual void setViewNeedsDisplay(const WebCore::IntRect&);
virtual void displayView();
virtual bool canScrollView();
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Expand Up @@ -138,7 +138,7 @@ - (void)redoEditing:(id)sender
{
}

PassOwnPtr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
OwnPtr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
{
return [m_wkView _createDrawingAreaProxy];
}
Expand Down
8 changes: 4 additions & 4 deletions Source/WebKit2/UIProcess/API/mac/WKView.mm
Expand Up @@ -2365,18 +2365,18 @@ - (void)_setIsWindowOccluded:(BOOL)isWindowOccluded

@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
Expand Down Expand Up @@ -2659,7 +2659,7 @@ - (void)_setFindIndicator:(PassRefPtr<FindIndicator>)findIndicator fadeOut:(BOOL
}

if (!_data->_findIndicatorWindow)
_data->_findIndicatorWindow = FindIndicatorWindow::create(self);
_data->_findIndicatorWindow = createOwned<FindIndicatorWindow>(self);

_data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut, animate);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
Expand Up @@ -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);
Expand All @@ -55,8 +55,6 @@ class DrawingAreaProxyImpl : public DrawingAreaProxy {
bool hasReceivedFirstUpdate() const { return m_hasReceivedFirstUpdate; }

private:
explicit DrawingAreaProxyImpl(WebPageProxy*);

// DrawingAreaProxy
virtual void sizeDidChange();
virtual void deviceScaleFactorDidChange();
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/UIProcess/PageClient.h
Expand Up @@ -77,7 +77,7 @@ class PageClient {
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;
Expand Down
Expand Up @@ -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;
Expand Down
Expand Up @@ -39,11 +39,6 @@

namespace WebKit {

PassOwnPtr<TiledCoreAnimationDrawingAreaProxy> TiledCoreAnimationDrawingAreaProxy::create(WebPageProxy* webPageProxy)
{
return adoptPtr(new TiledCoreAnimationDrawingAreaProxy(webPageProxy));
}

TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy(WebPageProxy* webPageProxy)
: DrawingAreaProxy(DrawingAreaTypeTiledCoreAnimation, webPageProxy)
, m_isWaitingForDidUpdateGeometry(false)
Expand Down
Expand Up @@ -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)
Expand All @@ -49,14 +52,6 @@ class PageOverlayClientImpl : public PageOverlay::Client {
}

private:
explicit PageOverlayClientImpl(WKBundlePageOverlayClient* client)
: m_client()
, m_accessibilityClient()
{
if (client)
m_client = *client;
}

// PageOverlay::Client.
virtual void pageOverlayDestroyed(PageOverlay*)
{
Expand Down Expand Up @@ -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());
}

Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/WebProcess/Plugins/PluginView.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/WebProcess/Plugins/PluginView.h
Expand Up @@ -219,7 +219,7 @@ class PluginView : public WebCore::PluginViewBase, public PluginController, priv
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;
Expand Down

0 comments on commit 9fb1141

Please sign in to comment.