Drop uses of PassRefPtr in WebKit/mac
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 May 2017 05:26:11 +0000 (05:26 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 May 2017 05:26:11 +0000 (05:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172066

Reviewed by Sam Weinig.

Source/WebKit/ios:

Build fix.

* Misc/WebGeolocationProviderIOS.mm:

Source/WebKit/mac:

* History/WebBackForwardListInternal.h:
* History/WebHistoryItem.mm:
(kit):
(-[WebHistoryItem initWithWebCoreHistoryItem:]):
* History/WebHistoryItemInternal.h:
* Plugins/Hosted/HostedNetscapePluginStream.h:
(WebKit::HostedNetscapePluginStream::create):
* Plugins/Hosted/NetscapePluginHostManager.h:
* Plugins/Hosted/NetscapePluginHostManager.mm:
(WebKit::NetscapePluginHostManager::instantiatePlugin):
* Plugins/Hosted/NetscapePluginInstanceProxy.h:
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::PluginRequest::create):
(WebKit::NetscapePluginInstanceProxy::create):
(WebKit::NetscapePluginInstanceProxy::setManualStream):
* Plugins/Hosted/ProxyInstance.h:
(WebKit::ProxyInstance::create):
* Plugins/Hosted/ProxyInstance.mm:
(WebKit::ProxyInstance::ProxyInstance):
(WebKit::ProxyInstance::newRuntimeObject):
* Plugins/Hosted/ProxyRuntimeObject.h:
(WebKit::ProxyRuntimeObject::create):
* Plugins/Hosted/ProxyRuntimeObject.mm:
(WebKit::ProxyRuntimeObject::ProxyRuntimeObject):
* Plugins/Hosted/WebHostedNetscapePluginView.h:
* Plugins/Hosted/WebHostedNetscapePluginView.mm:
(-[WebHostedNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:]):
* Plugins/WebBaseNetscapePluginView.h:
* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:]):
* Plugins/WebNetscapePluginStream.h:
(WebNetscapePluginStream::create):
* Plugins/WebNetscapePluginView.h:
* Plugins/WebNetscapePluginView.mm:
(-[WebNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:]):
* WebCoreSupport/WebChromeClient.mm:
* WebCoreSupport/WebEditorClient.mm:
* WebCoreSupport/WebNotificationClient.mm:
(WebNotificationClient::requestPermission):
(-[WebNotificationPolicyListener initWithCallback:]):
* WebCoreSupport/WebOpenPanelResultListener.mm:
* WebCoreSupport/WebUserMediaClient.mm:
(WebUserMediaClient::requestUserMediaAccess):
(WebUserMediaClient::enumerateMediaDevices):
(-[WebUserMediaPolicyListener initWithUserMediaRequest:]):
(-[WebUserMediaPolicyCheckerListener initWithMediaDevicesEnumerationRequest:]):
* WebView/WebArchive.mm:
(-[WebArchivePrivate initWithCoreArchive:]):
(-[WebArchivePrivate setCoreArchive:]):
(-[WebArchive initWithData:]):
(-[WebArchive subframeArchives]):
(-[WebArchive _initWithCoreLegacyWebArchive:]):
* WebView/WebArchiveInternal.h:
* WebView/WebDataSource.mm:
(WebDataSourcePrivate::WebDataSourcePrivate):
(WebDataSourcePrivate::~WebDataSourcePrivate):
(-[WebDataSource _initWithDocumentLoader:]):
* WebView/WebDataSourceInternal.h:
* WebView/WebDeviceOrientation.mm:
(-[WebDeviceOrientation initWithCoreDeviceOrientation:]):
* WebView/WebDeviceOrientationInternal.h:
* WebView/WebFrame.mm:
(-[WebFrame _convertToDOMRange:]):
(-[WebFrame _convertToDOMRange:rangeIsRelativeTo:]):
* WebView/WebFrameInternal.h:
* WebView/WebFullScreenController.h:
* WebView/WebFullScreenController.mm:
(-[WebFullScreenController setElement:]):
* WebView/WebGeolocationPosition.mm:
(-[WebGeolocationPositionInternal initWithCoreGeolocationPosition:]):
(-[WebGeolocationPosition initWithGeolocationPosition:]):
* WebView/WebHTMLView.mm:
(currentKeyboardEvent):
* WebView/WebResource.mm:
* WebView/WebScriptWorld.mm:
(-[WebScriptWorld initWithWorld:]):
(+[WebScriptWorld standardWorld]):
(+[WebScriptWorld findOrCreateWorld:]):
* WebView/WebViewData.h:
(LayerFlushController::create):

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

43 files changed:
Source/WebKit/ios/ChangeLog
Source/WebKit/ios/Misc/WebGeolocationProviderIOS.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/History/WebBackForwardListInternal.h
Source/WebKit/mac/History/WebHistoryItem.mm
Source/WebKit/mac/History/WebHistoryItemInternal.h
Source/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h
Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
Source/WebKit/mac/Plugins/Hosted/ProxyInstance.h
Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h
Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm
Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.h
Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
Source/WebKit/mac/Plugins/WebNetscapePluginStream.h
Source/WebKit/mac/Plugins/WebNetscapePluginView.h
Source/WebKit/mac/Plugins/WebNetscapePluginView.mm
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
Source/WebKit/mac/WebCoreSupport/WebOpenPanelResultListener.mm
Source/WebKit/mac/WebCoreSupport/WebUserMediaClient.mm
Source/WebKit/mac/WebView/WebArchive.mm
Source/WebKit/mac/WebView/WebArchiveInternal.h
Source/WebKit/mac/WebView/WebDataSource.mm
Source/WebKit/mac/WebView/WebDataSourceInternal.h
Source/WebKit/mac/WebView/WebDeviceOrientation.mm
Source/WebKit/mac/WebView/WebDeviceOrientationInternal.h
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/mac/WebView/WebFrameInternal.h
Source/WebKit/mac/WebView/WebFullScreenController.h
Source/WebKit/mac/WebView/WebFullScreenController.mm
Source/WebKit/mac/WebView/WebGeolocationPosition.mm
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/mac/WebView/WebResource.mm
Source/WebKit/mac/WebView/WebScriptWorld.mm
Source/WebKit/mac/WebView/WebViewData.h

index dca1b5e..92eca28 100644 (file)
@@ -1,3 +1,14 @@
+2017-05-12  Chris Dumez  <cdumez@apple.com>
+
+        Drop uses of PassRefPtr in WebKit/mac
+        https://bugs.webkit.org/show_bug.cgi?id=172066
+
+        Reviewed by Sam Weinig.
+
+        Build fix.
+
+        * Misc/WebGeolocationProviderIOS.mm:
+
 2017-05-01  Chris Dumez  <cdumez@apple.com>
 
         Remove some usage of PassRefPtr in editing code
index 860c0a3..0d53af0 100644 (file)
@@ -44,7 +44,7 @@
 using namespace WebCore;
 
 @interface WebGeolocationPosition (Internal)
-- (id)initWithGeolocationPosition:(RefPtr<GeolocationPosition>)coreGeolocationPosition;
+- (id)initWithGeolocationPosition:(RefPtr<GeolocationPosition>&&)coreGeolocationPosition;
 @end
 
 // CoreLocation runs in the main thread. WebGeolocationProviderIOS lives on the WebThread.
index 61de907..c01f25d 100644 (file)
@@ -1,3 +1,91 @@
+2017-05-12  Chris Dumez  <cdumez@apple.com>
+
+        Drop uses of PassRefPtr in WebKit/mac
+        https://bugs.webkit.org/show_bug.cgi?id=172066
+
+        Reviewed by Sam Weinig.
+
+        * History/WebBackForwardListInternal.h:
+        * History/WebHistoryItem.mm:
+        (kit):
+        (-[WebHistoryItem initWithWebCoreHistoryItem:]):
+        * History/WebHistoryItemInternal.h:
+        * Plugins/Hosted/HostedNetscapePluginStream.h:
+        (WebKit::HostedNetscapePluginStream::create):
+        * Plugins/Hosted/NetscapePluginHostManager.h:
+        * Plugins/Hosted/NetscapePluginHostManager.mm:
+        (WebKit::NetscapePluginHostManager::instantiatePlugin):
+        * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+        (WebKit::NetscapePluginInstanceProxy::PluginRequest::create):
+        (WebKit::NetscapePluginInstanceProxy::create):
+        (WebKit::NetscapePluginInstanceProxy::setManualStream):
+        * Plugins/Hosted/ProxyInstance.h:
+        (WebKit::ProxyInstance::create):
+        * Plugins/Hosted/ProxyInstance.mm:
+        (WebKit::ProxyInstance::ProxyInstance):
+        (WebKit::ProxyInstance::newRuntimeObject):
+        * Plugins/Hosted/ProxyRuntimeObject.h:
+        (WebKit::ProxyRuntimeObject::create):
+        * Plugins/Hosted/ProxyRuntimeObject.mm:
+        (WebKit::ProxyRuntimeObject::ProxyRuntimeObject):
+        * Plugins/Hosted/WebHostedNetscapePluginView.h:
+        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+        (-[WebHostedNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:]):
+        * Plugins/WebBaseNetscapePluginView.h:
+        * Plugins/WebBaseNetscapePluginView.mm:
+        (-[WebBaseNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:]):
+        * Plugins/WebNetscapePluginStream.h:
+        (WebNetscapePluginStream::create):
+        * Plugins/WebNetscapePluginView.h:
+        * Plugins/WebNetscapePluginView.mm:
+        (-[WebNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:]):
+        * WebCoreSupport/WebChromeClient.mm:
+        * WebCoreSupport/WebEditorClient.mm:
+        * WebCoreSupport/WebNotificationClient.mm:
+        (WebNotificationClient::requestPermission):
+        (-[WebNotificationPolicyListener initWithCallback:]):
+        * WebCoreSupport/WebOpenPanelResultListener.mm:
+        * WebCoreSupport/WebUserMediaClient.mm:
+        (WebUserMediaClient::requestUserMediaAccess):
+        (WebUserMediaClient::enumerateMediaDevices):
+        (-[WebUserMediaPolicyListener initWithUserMediaRequest:]):
+        (-[WebUserMediaPolicyCheckerListener initWithMediaDevicesEnumerationRequest:]):
+        * WebView/WebArchive.mm:
+        (-[WebArchivePrivate initWithCoreArchive:]):
+        (-[WebArchivePrivate setCoreArchive:]):
+        (-[WebArchive initWithData:]):
+        (-[WebArchive subframeArchives]):
+        (-[WebArchive _initWithCoreLegacyWebArchive:]):
+        * WebView/WebArchiveInternal.h:
+        * WebView/WebDataSource.mm:
+        (WebDataSourcePrivate::WebDataSourcePrivate):
+        (WebDataSourcePrivate::~WebDataSourcePrivate):
+        (-[WebDataSource _initWithDocumentLoader:]):
+        * WebView/WebDataSourceInternal.h:
+        * WebView/WebDeviceOrientation.mm:
+        (-[WebDeviceOrientation initWithCoreDeviceOrientation:]):
+        * WebView/WebDeviceOrientationInternal.h:
+        * WebView/WebFrame.mm:
+        (-[WebFrame _convertToDOMRange:]):
+        (-[WebFrame _convertToDOMRange:rangeIsRelativeTo:]):
+        * WebView/WebFrameInternal.h:
+        * WebView/WebFullScreenController.h:
+        * WebView/WebFullScreenController.mm:
+        (-[WebFullScreenController setElement:]):
+        * WebView/WebGeolocationPosition.mm:
+        (-[WebGeolocationPositionInternal initWithCoreGeolocationPosition:]):
+        (-[WebGeolocationPosition initWithGeolocationPosition:]):
+        * WebView/WebHTMLView.mm:
+        (currentKeyboardEvent):
+        * WebView/WebResource.mm:
+        * WebView/WebScriptWorld.mm:
+        (-[WebScriptWorld initWithWorld:]):
+        (+[WebScriptWorld standardWorld]):
+        (+[WebScriptWorld findOrCreateWorld:]):
+        * WebView/WebViewData.h:
+        (LayerFlushController::create):
+
 2017-05-11  Chris Dumez  <cdumez@apple.com>
 
         Drop remaining uses of PassRefPtr in WebCore
index 8de0e31..e5c0157 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 #import <WebKitLegacy/WebBackForwardList.h>
-#import <wtf/PassRefPtr.h>
+#import <wtf/Ref.h>
 
 class BackForwardList;
 
index 25a4332..aec06ff 100644 (file)
@@ -267,7 +267,7 @@ WebHistoryItem *kit(HistoryItem* item)
     if (kitItem)
         return kitItem;
     
-    return [[[WebHistoryItem alloc] initWithWebCoreHistoryItem:item] autorelease];
+    return [[[WebHistoryItem alloc] initWithWebCoreHistoryItem:*item] autorelease];
 }
 
 + (WebHistoryItem *)entryWithURL:(NSURL *)URL
@@ -284,7 +284,7 @@ WebHistoryItem *kit(HistoryItem* item)
     return item;
 }
 
-- (id)initWithWebCoreHistoryItem:(PassRefPtr<HistoryItem>)item
+- (id)initWithWebCoreHistoryItem:(Ref<HistoryItem>&&)item
 {   
     WebCoreThreadViolationCheckRoundOne();
     // Need to tell WebCore what function to call for the 
@@ -298,7 +298,7 @@ WebHistoryItem *kit(HistoryItem* item)
         return nil;
 
     _private = [[WebHistoryItemPrivate alloc] init];
-    _private->_historyItem = item;
+    _private->_historyItem = WTFMove(item);
 
     ASSERT(!historyItemWrappers().get(core(_private)));
     historyItemWrappers().set(core(_private), self);
index 0e20e7a..7914d39 100644 (file)
@@ -47,7 +47,7 @@ extern void WKNotifyHistoryItemChanged(WebCore::HistoryItem*);
 
 - (id)initWithURLString:(NSString *)URLString title:(NSString *)title displayTitle:(NSString *)displayTitle lastVisitedTimeInterval:(NSTimeInterval)time;
 - (id)initFromDictionaryRepresentation:(NSDictionary *)dict;
-- (id)initWithWebCoreHistoryItem:(PassRefPtr<WebCore::HistoryItem>)item;
+- (id)initWithWebCoreHistoryItem:(Ref<WebCore::HistoryItem>&&)item;
 
 - (void)setTitle:(NSString *)title;
 - (void)_visitedWithTitle:(NSString *)title;
index 8ddde88..a6160f0 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <WebCore/NetscapePlugInStreamLoader.h>
 #include <WebKitLegacy/npapi.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 #include <wtf/RetainPtr.h>
@@ -47,13 +47,13 @@ class NetscapePluginInstanceProxy;
 class HostedNetscapePluginStream : public RefCounted<HostedNetscapePluginStream>
                                  , private WebCore::NetscapePlugInStreamLoaderClient {
 public:
-    static PassRefPtr<HostedNetscapePluginStream> create(NetscapePluginInstanceProxy* instance, uint32_t streamID, NSURLRequest *request)
+    static Ref<HostedNetscapePluginStream> create(NetscapePluginInstanceProxy* instance, uint32_t streamID, NSURLRequest *request)
     {
-        return adoptRef(new HostedNetscapePluginStream(instance, streamID, request));
+        return adoptRef(*new HostedNetscapePluginStream(instance, streamID, request));
     }
-    static PassRefPtr<HostedNetscapePluginStream> create(NetscapePluginInstanceProxy* instance, WebCore::FrameLoader* frameLoader)
+    static Ref<HostedNetscapePluginStream> create(NetscapePluginInstanceProxy* instance, WebCore::FrameLoader* frameLoader)
     {
-        return adoptRef(new HostedNetscapePluginStream(instance, frameLoader));
+        return adoptRef(*new HostedNetscapePluginStream(instance, frameLoader));
     }
 
     ~HostedNetscapePluginStream();
index d849497..2d24fd7 100644 (file)
@@ -29,8 +29,8 @@
 #define NetscapePluginHostManager_h
 
 #import <wtf/HashMap.h>
-#import <wtf/PassRefPtr.h>
 #import <wtf/NeverDestroyed.h>
+#import <wtf/RefPtr.h>
 #import <wtf/text/StringHash.h>
 #import <wtf/text/WTFString.h>
 
@@ -45,7 +45,7 @@ class NetscapePluginHostManager {
 public:
     static NetscapePluginHostManager& singleton();
     
-    PassRefPtr<NetscapePluginInstanceProxy> instantiatePlugin(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled, bool hostLayersInWindowServer);
+    RefPtr<NetscapePluginInstanceProxy> instantiatePlugin(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled, bool hostLayersInWindowServer);
 
     void pluginHostDied(NetscapePluginHostProxy*);
 
index e4b7c89..5b954b8 100644 (file)
@@ -213,11 +213,11 @@ void NetscapePluginHostManager::pluginHostDied(NetscapePluginHostProxy* pluginHo
     }
 }
 
-PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled, bool hostLayersInWindowServer)
+RefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled, bool hostLayersInWindowServer)
 {
     NetscapePluginHostProxy* hostProxy = hostForPlugin(pluginPath, pluginArchitecture, bundleIdentifier);
     if (!hostProxy)
-        return 0;
+        return nullptr;
 
     RetainPtr<NSMutableDictionary> properties = adoptNS([[NSMutableDictionary alloc] init]);
     
@@ -272,7 +272,7 @@ PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePl
     instance->setRenderContextID(reply->m_renderContextID);
     instance->setRendererType(reply->m_rendererType);
 
-    return WTFMove(instance);
+    return instance;
 }
 
 void NetscapePluginHostManager::createPropertyListFile(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier)
index 6cae027..65205fc 100644 (file)
@@ -36,7 +36,7 @@
 #include <wtf/Deque.h>
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RetainPtr.h>
 #include "WebKitPluginHostTypes.h"
@@ -60,7 +60,7 @@ class ProxyInstance;
     
 class NetscapePluginInstanceProxy : public RefCounted<NetscapePluginInstanceProxy> {
 public:
-    static PassRefPtr<NetscapePluginInstanceProxy> create(NetscapePluginHostProxy*, WebHostedNetscapePluginView *, bool fullFramePlugin);
+    static Ref<NetscapePluginInstanceProxy> create(NetscapePluginHostProxy*, WebHostedNetscapePluginView *, bool fullFramePlugin);
     ~NetscapePluginInstanceProxy();
     
     uint32_t pluginID() const 
@@ -81,7 +81,7 @@ public:
     bool cancelStreamLoad(uint32_t streamID, NPReason);
     void disconnectStream(HostedNetscapePluginStream*);
     
-    void setManualStream(PassRefPtr<HostedNetscapePluginStream>);
+    void setManualStream(Ref<HostedNetscapePluginStream>&&);
     HostedNetscapePluginStream* manualStream() const { return m_manualStream.get(); }
     
     void pluginHostDied();
index f6858d3..fb8974d 100644 (file)
@@ -81,9 +81,9 @@ namespace WebKit {
 
 class NetscapePluginInstanceProxy::PluginRequest : public RefCounted<NetscapePluginInstanceProxy::PluginRequest> {
 public:
-    static PassRefPtr<PluginRequest> create(uint32_t requestID, NSURLRequest* request, NSString* frameName, bool allowPopups)
+    static Ref<PluginRequest> create(uint32_t requestID, NSURLRequest* request, NSString* frameName, bool allowPopups)
     {
-        return adoptRef(new PluginRequest(requestID, request, frameName, allowPopups));
+        return adoptRef(*new PluginRequest(requestID, request, frameName, allowPopups));
     }
 
     uint32_t requestID() const { return m_requestID; }
@@ -246,11 +246,11 @@ NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy
 #endif
 }
 
-PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginInstanceProxy::create(NetscapePluginHostProxy* pluginHostProxy, WebHostedNetscapePluginView *pluginView, bool fullFramePlugin)
+Ref<NetscapePluginInstanceProxy> NetscapePluginInstanceProxy::create(NetscapePluginHostProxy* pluginHostProxy, WebHostedNetscapePluginView *pluginView, bool fullFramePlugin)
 {
     auto proxy = adoptRef(*new NetscapePluginInstanceProxy(pluginHostProxy, pluginView, fullFramePlugin));
     pluginHostProxy->addPluginInstance(proxy.ptr());
-    return WTFMove(proxy);
+    return proxy;
 }
 
 NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy()
@@ -359,11 +359,11 @@ void NetscapePluginInstanceProxy::destroy()
     invalidate();
 }
 
-void NetscapePluginInstanceProxy::setManualStream(PassRefPtr<HostedNetscapePluginStream> manualStream) 
+void NetscapePluginInstanceProxy::setManualStream(Ref<HostedNetscapePluginStream>&& manualStream)
 {
     ASSERT(!m_manualStream);
     
-    m_manualStream = manualStream;
+    m_manualStream = WTFMove(manualStream);
 }
 
 bool NetscapePluginInstanceProxy::cancelStreamLoad(uint32_t streamID, NPReason reason) 
index afba102..3b0220b 100644 (file)
@@ -39,9 +39,9 @@ class ProxyClass;
     
 class ProxyInstance : public JSC::Bindings::Instance {
 public:
-    static PassRefPtr<ProxyInstance> create(PassRefPtr<JSC::Bindings::RootObject> rootObject, NetscapePluginInstanceProxy* instanceProxy, uint32_t objectID)
+    static Ref<ProxyInstance> create(Ref<JSC::Bindings::RootObject>&& rootObject, NetscapePluginInstanceProxy* instanceProxy, uint32_t objectID)
     {
-        return adoptRef(new ProxyInstance(rootObject, instanceProxy, objectID));
+        return adoptRef(*new ProxyInstance(WTFMove(rootObject), instanceProxy, objectID));
     }
     ~ProxyInstance();
 
@@ -59,7 +59,7 @@ public:
     uint32_t objectID() const { return m_objectID; }
     
 private:
-    ProxyInstance(PassRefPtr<JSC::Bindings::RootObject>, NetscapePluginInstanceProxy*, uint32_t objectID);
+    ProxyInstance(Ref<JSC::Bindings::RootObject>&&, NetscapePluginInstanceProxy*, uint32_t objectID);
 
     virtual JSC::Bindings::RuntimeObject* newRuntimeObject(JSC::ExecState*);
 
index 371c519..9c00d7c 100644 (file)
@@ -112,8 +112,8 @@ private:
     uint64_t m_serverIdentifier;
 };
 
-ProxyInstance::ProxyInstance(PassRefPtr<RootObject> rootObject, NetscapePluginInstanceProxy* instanceProxy, uint32_t objectID)
-    : Instance(rootObject)
+ProxyInstance::ProxyInstance(Ref<RootObject>&& rootObject, NetscapePluginInstanceProxy* instanceProxy, uint32_t objectID)
+    : Instance(WTFMove(rootObject))
     , m_instanceProxy(instanceProxy)
     , m_objectID(objectID)
 {
@@ -133,7 +133,7 @@ ProxyInstance::~ProxyInstance()
 RuntimeObject* ProxyInstance::newRuntimeObject(ExecState* exec)
 {
     // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object.
-    return ProxyRuntimeObject::create(exec->vm(), WebCore::deprecatedGetDOMStructure<ProxyRuntimeObject>(exec), this);
+    return ProxyRuntimeObject::create(exec->vm(), WebCore::deprecatedGetDOMStructure<ProxyRuntimeObject>(exec), *this);
 }
 
 JSC::Bindings::Class* ProxyInstance::getClass() const
index cbab6e9..6dd0885 100644 (file)
@@ -39,9 +39,9 @@ class ProxyRuntimeObject : public JSC::Bindings::RuntimeObject {
 public:
     typedef JSC::Bindings::RuntimeObject Base;
 
-    static ProxyRuntimeObject* create(JSC::VM& vm, JSC::Structure* structure, PassRefPtr<ProxyInstance> instance)
+    static ProxyRuntimeObject* create(JSC::VM& vm, JSC::Structure* structure, Ref<ProxyInstance>&& instance)
     {
-        ProxyRuntimeObject* object = new (JSC::allocateCell<ProxyRuntimeObject>(vm.heap)) ProxyRuntimeObject(vm, structure, instance);
+        ProxyRuntimeObject* object = new (JSC::allocateCell<ProxyRuntimeObject>(vm.heap)) ProxyRuntimeObject(vm, structure, WTFMove(instance));
         object->finishCreation(vm);
         return object;
     }
@@ -56,7 +56,7 @@ public:
     DECLARE_INFO;
 
 private:
-    ProxyRuntimeObject(JSC::VM&, JSC::Structure*, PassRefPtr<ProxyInstance>);
+    ProxyRuntimeObject(JSC::VM&, JSC::Structure*, Ref<ProxyInstance>&&);
     void finishCreation(JSC::VM&);
 };
 
index 5e6d2b3..927efaf 100644 (file)
@@ -36,8 +36,8 @@ namespace WebKit {
 
 const ClassInfo ProxyRuntimeObject::s_info = { "ProxyRuntimeObject", &RuntimeObject::s_info, 0, CREATE_METHOD_TABLE(ProxyRuntimeObject) };
 
-ProxyRuntimeObject::ProxyRuntimeObject(VM& vm, Structure* structure, PassRefPtr<ProxyInstance> instance)
-    : RuntimeObject(vm, structure, instance)
+ProxyRuntimeObject::ProxyRuntimeObject(VM& vm, Structure* structure, Ref<ProxyInstance>&& instance)
+    : RuntimeObject(vm, structure, WTFMove(instance))
 {
 }
 
index 1cae085..81f5906 100644 (file)
@@ -56,7 +56,7 @@ namespace WebKit {
       attributeKeys:(NSArray *)keys
     attributeValues:(NSArray *)values
        loadManually:(BOOL)loadManually
-            element:(PassRefPtr<WebCore::HTMLPlugInElement>)element;
+            element:(RefPtr<WebCore::HTMLPlugInElement>&&)element;
 
 - (void)pluginHostDied;
 - (CALayer *)pluginLayer;
index 25889b7..9e2044e 100644 (file)
@@ -87,9 +87,9 @@ extern "C" {
       attributeKeys:(NSArray *)keys
     attributeValues:(NSArray *)values
        loadManually:(BOOL)loadManually
-            element:(PassRefPtr<WebCore::HTMLPlugInElement>)element
+            element:(RefPtr<WebCore::HTMLPlugInElement>&&)element
 {
-    self = [super initWithFrame:frame pluginPackage:pluginPackage URL:URL baseURL:baseURL MIMEType:MIME attributeKeys:keys attributeValues:values loadManually:loadManually element:element];
+    self = [super initWithFrame:frame pluginPackage:pluginPackage URL:URL baseURL:baseURL MIMEType:MIME attributeKeys:keys attributeValues:values loadManually:loadManually element:WTFMove(element)];
     if (!self)
         return nil;
     
index 2499b3d..cf04858 100644 (file)
@@ -31,7 +31,6 @@
 
 #import "WebNetscapePluginPackage.h"
 #import <wtf/Forward.h>
-#import <wtf/PassRefPtr.h>
 #import <wtf/RefPtr.h>
 #import <wtf/RetainPtr.h>
 
@@ -78,7 +77,7 @@ namespace WebCore {
       attributeKeys:(NSArray *)keys
     attributeValues:(NSArray *)values
        loadManually:(BOOL)loadManually
-            element:(PassRefPtr<WebCore::HTMLPlugInElement>)element;
+            element:(RefPtr<WebCore::HTMLPlugInElement>&&)element;
 
 - (WebNetscapePluginPackage *)pluginPackage;
 
index 1e7a69e..21f9045 100644 (file)
@@ -84,14 +84,14 @@ using namespace WebCore;
       attributeKeys:(NSArray *)keys
     attributeValues:(NSArray *)values
        loadManually:(BOOL)loadManually
-            element:(PassRefPtr<WebCore::HTMLPlugInElement>)element
+            element:(RefPtr<WebCore::HTMLPlugInElement>&&)element
 {
     self = [super initWithFrame:frame];
     if (!self)
         return nil;
     
     _pluginPackage = pluginPackage;
-    _element = element;
+    _element = WTFMove(element);
     _sourceURL = adoptNS([URL copy]);
     _baseURL = adoptNS([baseURL copy]);
     _MIMEType = adoptNS([MIME copy]);
index d1291a6..bf43415 100644 (file)
@@ -32,7 +32,7 @@
 #import <WebCore/Timer.h>
 #import <WebCore/NetscapePlugInStreamLoader.h>
 #import <WebKitLegacy/npfunctions.h>
-#import <wtf/PassRefPtr.h>
+#import <wtf/Ref.h>
 #import <wtf/RefCounted.h>
 #import <wtf/RefPtr.h>
 #import <wtf/RetainPtr.h>
@@ -52,13 +52,13 @@ class WebNetscapePluginStream : public RefCounted<WebNetscapePluginStream>
                               , private WebCore::NetscapePlugInStreamLoaderClient
 {
 public:
-    static PassRefPtr<WebNetscapePluginStream> create(NSURLRequest *request, NPP plugin, bool sendNotification, void* notifyData)
+    static Ref<WebNetscapePluginStream> create(NSURLRequest *request, NPP plugin, bool sendNotification, void* notifyData)
     {
-        return adoptRef(new WebNetscapePluginStream(request, plugin, sendNotification, notifyData));
+        return adoptRef(*new WebNetscapePluginStream(request, plugin, sendNotification, notifyData));
     }
-    static PassRefPtr<WebNetscapePluginStream> create(WebCore::FrameLoader* frameLoader)
+    static Ref<WebNetscapePluginStream> create(WebCore::FrameLoader* frameLoader)
     {
-        return adoptRef(new WebNetscapePluginStream(frameLoader));
+        return adoptRef(*new WebNetscapePluginStream(frameLoader));
     }
     virtual ~WebNetscapePluginStream();
 
index d08fffa..5e6532f 100644 (file)
@@ -110,7 +110,7 @@ typedef union PluginPort {
       attributeKeys:(NSArray *)keys
     attributeValues:(NSArray *)values
        loadManually:(BOOL)loadManually
-            element:(PassRefPtr<WebCore::HTMLPlugInElement>)element;
+            element:(RefPtr<WebCore::HTMLPlugInElement>&&)element;
 
 
 - (NPP)plugin;
index 0193e40..e732052 100644 (file)
@@ -1256,9 +1256,9 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
       attributeKeys:(NSArray *)keys
     attributeValues:(NSArray *)values
        loadManually:(BOOL)loadManually
-            element:(PassRefPtr<WebCore::HTMLPlugInElement>)element
+            element:(RefPtr<WebCore::HTMLPlugInElement>&&)element
 {
-    self = [super initWithFrame:frame pluginPackage:pluginPackage URL:URL baseURL:baseURL MIMEType:MIME attributeKeys:keys attributeValues:values loadManually:loadManually element:element];
+    self = [super initWithFrame:frame pluginPackage:pluginPackage URL:URL baseURL:baseURL MIMEType:MIME attributeKeys:keys attributeValues:values loadManually:loadManually element:WTFMove(element)];
     if (!self)
         return nil;
 
index 1f687f2..2175752 100644 (file)
@@ -83,7 +83,7 @@
 #import <WebCore/Widget.h>
 #import <WebCore/WindowFeatures.h>
 #import <wtf/BlockObjCExceptions.h>
-#import <wtf/PassRefPtr.h>
+#import <wtf/RefPtr.h>
 #import <wtf/Vector.h>
 #import <wtf/text/WTFString.h>
 
index 249f950..2011952 100644 (file)
@@ -78,7 +78,7 @@
 #import <WebCore/WebCoreObjCExtras.h>
 #import <runtime/InitializeThreading.h>
 #import <wtf/MainThread.h>
-#import <wtf/PassRefPtr.h>
+#import <wtf/RefPtr.h>
 #import <wtf/RunLoop.h>
 #import <wtf/text/WTFString.h>
 
index c98002d..acdd4dd 100644 (file)
@@ -1340,9 +1340,9 @@ void WebFrameLoaderClient::prepareForDataSourceReplacement()
 
 Ref<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
 {
-    Ref<WebDocumentLoaderMac> loader = WebDocumentLoaderMac::create(request, substituteData);
+    auto loader = WebDocumentLoaderMac::create(request, substituteData);
 
-    WebDataSource *dataSource = [[WebDataSource alloc] _initWithDocumentLoader:loader.ptr()];
+    WebDataSource *dataSource = [[WebDataSource alloc] _initWithDocumentLoader:loader.copyRef()];
     loader->setDataSource(dataSource, getWebView(m_webFrame.get()));
     [dataSource release];
 
index 4fa0d41..ab8a4f4 100644 (file)
@@ -44,7 +44,7 @@ using namespace WebCore;
 {
     RefPtr<NotificationPermissionCallback> _callback;
 }
-- (id)initWithCallback:(PassRefPtr<NotificationPermissionCallback>)callback;
+- (id)initWithCallback:(RefPtr<NotificationPermissionCallback>&&)callback;
 @end
 #endif
 
@@ -177,7 +177,7 @@ bool WebNotificationClient::hasPendingPermissionRequests(ScriptExecutionContext*
 void WebNotificationClient::requestPermission(ScriptExecutionContext* context, RefPtr<NotificationPermissionCallback>&& callback)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    WebNotificationPolicyListener *listener = [[WebNotificationPolicyListener alloc] initWithCallback:callback];
+    WebNotificationPolicyListener *listener = [[WebNotificationPolicyListener alloc] initWithCallback:WTFMove(callback)];
     requestPermission(context, listener);
     [listener release];
     END_BLOCK_OBJC_EXCEPTIONS;
@@ -219,12 +219,12 @@ uint64_t WebNotificationClient::notificationIDForTesting(WebCore::Notification*
 
 @implementation WebNotificationPolicyListener
 
-- (id)initWithCallback:(PassRefPtr<NotificationPermissionCallback>)callback
+- (id)initWithCallback:(RefPtr<NotificationPermissionCallback>&&)callback
 {
     if (!(self = [super init]))
         return nil;
 
-    _callback = callback;
+    _callback = WTFMove(callback);
     return self;
 }
 
index 8b25209..e9c3bfe 100644 (file)
@@ -26,7 +26,7 @@
 #import "WebOpenPanelResultListener.h"
 
 #import <WebCore/FileChooser.h>
-#import <wtf/PassRefPtr.h>
+#import <wtf/RefPtr.h>
 
 #if PLATFORM(IOS)
 #import <WebCore/Icon.h>
index 1b4c828..019d11e 100644 (file)
@@ -48,7 +48,7 @@ using namespace WebCore;
 {
     RefPtr<UserMediaRequest> _request;
 }
-- (id)initWithUserMediaRequest:(PassRefPtr<UserMediaRequest>)request;
+- (id)initWithUserMediaRequest:(Ref<UserMediaRequest>&&)request;
 - (void)cancelUserMediaAccessRequest;
 - (void)deny;
 @end
@@ -56,7 +56,7 @@ using namespace WebCore;
 @interface WebUserMediaPolicyCheckerListener : NSObject <WebAllowDenyPolicyListener> {
     RefPtr<MediaDevicesEnumerationRequest> _request;
 }
-- (id)initWithMediaDevicesEnumerationRequest:(PassRefPtr<MediaDevicesEnumerationRequest>)request;
+- (id)initWithMediaDevicesEnumerationRequest:(Ref<MediaDevicesEnumerationRequest>&&)request;
 - (void)cancelMediaDevicesEnumerationRequest;
 - (void)deny;
 @end
@@ -141,7 +141,7 @@ void WebUserMediaClient::requestUserMediaAccess(UserMediaRequest& request)
         return;
     }
 
-    WebUserMediaPolicyListener *listener = [[WebUserMediaPolicyListener alloc] initWithUserMediaRequest:&request];
+    WebUserMediaPolicyListener *listener = [[WebUserMediaPolicyListener alloc] initWithUserMediaRequest:request];
     WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:request.userMediaDocumentOrigin()];
 
     AddRequestToRequestMap(&request, listener);
@@ -174,7 +174,7 @@ void WebUserMediaClient::enumerateMediaDevices(MediaDevicesEnumerationRequest& r
         return;
     }
 
-    WebUserMediaPolicyCheckerListener *listener = [[WebUserMediaPolicyCheckerListener alloc] initWithMediaDevicesEnumerationRequest:&request];
+    WebUserMediaPolicyCheckerListener *listener = [[WebUserMediaPolicyCheckerListener alloc] initWithMediaDevicesEnumerationRequest:request];
     WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:request.userMediaDocumentOrigin()];
 
     AddPermissionCheckToMap(&request, listener);
@@ -199,13 +199,13 @@ void WebUserMediaClient::cancelMediaDevicesEnumerationRequest(WebCore::MediaDevi
 
 @implementation WebUserMediaPolicyListener
 
-- (id)initWithUserMediaRequest:(PassRefPtr<UserMediaRequest>)request
+- (id)initWithUserMediaRequest:(Ref<UserMediaRequest>&&)request
 {
 #if ENABLE(MEDIA_STREAM)
     if (!(self = [super init]))
         return nil;
 
-    _request = request;
+    _request = WTFMove(request);
     return self;
 #endif
 }
@@ -261,13 +261,13 @@ void WebUserMediaClient::cancelMediaDevicesEnumerationRequest(WebCore::MediaDevi
 
 @implementation WebUserMediaPolicyCheckerListener
 
-- (id)initWithMediaDevicesEnumerationRequest:(PassRefPtr<MediaDevicesEnumerationRequest>)request
+- (id)initWithMediaDevicesEnumerationRequest:(Ref<MediaDevicesEnumerationRequest>&&)request
 {
 #if ENABLE(MEDIA_STREAM)
     if (!(self = [super init]))
         return nil;
 
-    _request = request;
+    _request = WTFMove(request);
     return self;
 #endif
 }
index d1044e1..7c2f866 100644 (file)
@@ -58,9 +58,9 @@ static NSString * const WebSubframeArchivesKey = @"WebSubframeArchives";
     RefPtr<LegacyWebArchive> coreArchive;
 }
 
-- (instancetype)initWithCoreArchive:(PassRefPtr<LegacyWebArchive>)coreArchive;
+- (instancetype)initWithCoreArchive:(RefPtr<LegacyWebArchive>&&)coreArchive;
 - (LegacyWebArchive*)coreArchive;
-- (void)setCoreArchive:(PassRefPtr<LegacyWebArchive>)newCoreArchive;
+- (void)setCoreArchive:(Ref<LegacyWebArchive>&&)newCoreArchive;
 @end
 
 @implementation WebArchivePrivate
@@ -83,14 +83,14 @@ static NSString * const WebSubframeArchivesKey = @"WebSubframeArchives";
     return self;
 }
 
-- (instancetype)initWithCoreArchive:(PassRefPtr<LegacyWebArchive>)_coreArchive
+- (instancetype)initWithCoreArchive:(RefPtr<LegacyWebArchive>&&)_coreArchive
 {
     self = [super init];
-    if (!self || !_coreArchive) {
+    if (!self|| !_coreArchive) {
         [self release];
         return nil;
     }
-    coreArchive = _coreArchive;
+    coreArchive = WTFMove(_coreArchive);
     return self;
 }
 
@@ -99,11 +99,10 @@ static NSString * const WebSubframeArchivesKey = @"WebSubframeArchives";
     return coreArchive.get();
 }
 
-- (void)setCoreArchive:(PassRefPtr<LegacyWebArchive>)newCoreArchive
+- (void)setCoreArchive:(Ref<LegacyWebArchive>&&)newCoreArchive
 {
     ASSERT(coreArchive);
-    ASSERT(newCoreArchive);
-    coreArchive = newCoreArchive;
+    coreArchive = WTFMove(newCoreArchive);
 }
 
 - (void)dealloc
@@ -206,7 +205,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
         return nil;
     }
         
-    [_private setCoreArchive:WTFMove(coreArchive)];
+    [_private setCoreArchive:coreArchive.releaseNonNull()];
         
 #if !LOG_DISABLED
     CFAbsoluteTime end = CFAbsoluteTimeGetCurrent();
@@ -317,7 +316,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
             auto mutableArray = [[NSMutableArray alloc] initWithCapacity:subframeArchives.size()];
             _private->cachedSubframeArchives = mutableArray;
             for (unsigned i = 0; i < subframeArchives.size(); ++i) {
-                WebArchive *archive = [[WebArchive alloc] _initWithCoreLegacyWebArchive:(LegacyWebArchive *)subframeArchives[i].ptr()];
+                WebArchive *archive = [[WebArchive alloc] _initWithCoreLegacyWebArchive:static_cast<LegacyWebArchive*>(subframeArchives[i].ptr())];
                 [mutableArray addObject:archive];
                 [archive release];
             }
@@ -350,7 +349,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
 
 @implementation WebArchive (WebInternal)
 
-- (id)_initWithCoreLegacyWebArchive:(PassRefPtr<WebCore::LegacyWebArchive>)coreLegacyWebArchive
+- (id)_initWithCoreLegacyWebArchive:(RefPtr<WebCore::LegacyWebArchive>&&)coreLegacyWebArchive
 {
     WebCoreThreadViolationCheckRoundTwo();
 
@@ -358,7 +357,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
     if (!self)
         return nil;
     
-    _private = [[WebArchivePrivate alloc] initWithCoreArchive:coreLegacyWebArchive];
+    _private = [[WebArchivePrivate alloc] initWithCoreArchive:WTFMove(coreLegacyWebArchive)];
     if (!_private) {
         [self release];
         return nil;
index 6a8a8e9..df9ee0d 100644 (file)
@@ -35,7 +35,7 @@ namespace WebCore {
 
 @interface WebArchive (WebInternal)
 
-- (id)_initWithCoreLegacyWebArchive:(WTF::PassRefPtr<WebCore::LegacyWebArchive>)coreLegacyWebArchive;
+- (id)_initWithCoreLegacyWebArchive:(WTF::RefPtr<WebCore::LegacyWebArchive>&&)coreLegacyWebArchive;
 - (WebCore::LegacyWebArchive *)_coreLegacyWebArchive;
 
 @end
index df36173..d33560a 100644 (file)
@@ -79,30 +79,27 @@ using namespace WebCore;
 class WebDataSourcePrivate
 {
 public:
-    WebDataSourcePrivate(PassRefPtr<WebDocumentLoaderMac> loader)
-        : loader(loader)
+    WebDataSourcePrivate(Ref<WebDocumentLoaderMac>&& loader)
+        : loader(WTFMove(loader))
         , representationFinishedLoading(NO)
         , includedInWebKitStatistics(NO)
 #if PLATFORM(IOS)
         , _dataSourceDelegate(nil)
 #endif
     {
-        ASSERT(this->loader);
     }
     ~WebDataSourcePrivate()
     {
-        if (loader) {
-            // We might run in to infinite recursion if we're stopping loading as the result of detaching from the frame.
-            // Therefore, DocumentLoader::detachFromFrame() did some smart things to stop the recursion.
-            // As a result of breaking the resursion, DocumentLoader::m_subresourceLoader
-            // and DocumentLoader::m_plugInStreamLoaders might not be empty at this time.
-            // See <rdar://problem/9673866> for more details.
-            ASSERT(!loader->isLoading() || loader->isStopping());
-            loader->detachDataSource();
-        }
+        // We might run in to infinite recursion if we're stopping loading as the result of detaching from the frame.
+        // Therefore, DocumentLoader::detachFromFrame() did some smart things to stop the recursion.
+        // As a result of breaking the resursion, DocumentLoader::m_subresourceLoader
+        // and DocumentLoader::m_plugInStreamLoaders might not be empty at this time.
+        // See <rdar://problem/9673866> for more details.
+        ASSERT(!loader->isLoading() || loader->isStopping());
+        loader->detachDataSource();
     }
 
-    RefPtr<WebDocumentLoaderMac> loader;
+    Ref<WebDocumentLoaderMac> loader;
     RetainPtr<id<WebDocumentRepresentation> > representation;
     BOOL representationFinishedLoading;
     BOOL includedInWebKitStatistics;
@@ -202,9 +199,6 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
 
 - (void)_setDeferMainResourceDataLoad:(BOOL)flag
 {
-    if (!toPrivate(_private)->loader)
-        return;
-
     toPrivate(_private)->loader->setDeferMainResourceDataLoad(flag);
 }
 
@@ -319,8 +313,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
             NSString *markupString = [[NSString alloc] initWithData:[mainResource data] encoding:NSUTF8StringEncoding];
 
             // FIXME: seems poor form to do this as a side effect of getting a document fragment
-            if (toPrivate(_private)->loader)
-                toPrivate(_private)->loader->addAllArchiveResources(*[archive _coreLegacyWebArchive]);
+            toPrivate(_private)->loader->addAllArchiveResources(*[archive _coreLegacyWebArchive]);
 
             DOMDocumentFragment *fragment = [[self webFrame] _documentFragmentWithMarkupString:markupString baseURLString:[[mainResource URL] _web_originalDataAsString]];
             [markupString release];
@@ -404,17 +397,16 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
 
 - (DocumentLoader*)_documentLoader
 {
-    return toPrivate(_private)->loader.get();
+    return toPrivate(_private)->loader.ptr();
 }
 
-- (id)_initWithDocumentLoader:(PassRefPtr<WebDocumentLoaderMac>)loader
+- (id)_initWithDocumentLoader:(Ref<WebDocumentLoaderMac>&&)loader
 {
     self = [super init];
     if (!self)
         return nil;
 
-    ASSERT(loader);
-    _private = static_cast<void*>(new WebDataSourcePrivate(loader));
+    _private = static_cast<void*>(new WebDataSourcePrivate(WTFMove(loader)));
         
     LOG(Loading, "creating datasource for %@", static_cast<NSURL *>(toPrivate(_private)->loader->request().url()));
 
index de161cb..b101b13 100644 (file)
@@ -51,7 +51,7 @@ class WebDocumentLoaderMac;
 - (DOMDocumentFragment *)_documentFragmentWithArchive:(WebArchive *)archive;
 + (NSMutableDictionary *)_repTypesAllowImageTypeOmission:(BOOL)allowImageTypeOmission;
 - (void)_replaceSelectionWithArchive:(WebArchive *)archive selectReplacement:(BOOL)selectReplacement;
-- (id)_initWithDocumentLoader:(PassRefPtr<WebDocumentLoaderMac>)loader;
+- (id)_initWithDocumentLoader:(Ref<WebDocumentLoaderMac>&&)loader;
 - (void)_finishedLoading;
 - (void)_receivedData:(NSData *)data;
 - (void)_revertToProvisionalState;
index 0eec238..d088958 100644 (file)
@@ -29,12 +29,12 @@ using namespace WebCore;
 
 @implementation WebDeviceOrientationInternal
 
-- (id)initWithCoreDeviceOrientation:(PassRefPtr<DeviceOrientationData>)coreDeviceOrientation
+- (id)initWithCoreDeviceOrientation:(RefPtr<DeviceOrientationData>&&)coreDeviceOrientation
 {
     self = [super init];
     if (!self)
         return nil;
-    m_orientation = coreDeviceOrientation;
+    m_orientation = WTFMove(coreDeviceOrientation);
     return self;
 }
 
@@ -42,12 +42,12 @@ using namespace WebCore;
 
 @implementation WebDeviceOrientation (Internal)
 
-- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientationData>)coreDeviceOrientation
+- (id)initWithCoreDeviceOrientation:(RefPtr<WebCore::DeviceOrientationData>&&)coreDeviceOrientation
 {
     self = [super init];
     if (!self)
         return nil;
-    m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:coreDeviceOrientation];
+    m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:WTFMove(coreDeviceOrientation)];
     return self;
 }
 
index 5dedd08..fcc3bb3 100644 (file)
     RefPtr<WebCore::DeviceOrientationData> m_orientation;
 }
 
-- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientationData>)coreDeviceOrientation;
+- (id)initWithCoreDeviceOrientation:(RefPtr<WebCore::DeviceOrientationData>&&)coreDeviceOrientation;
 @end
 
 @interface WebDeviceOrientation (Internal)
 
-- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientationData>)coreDeviceOrientation;
+- (id)initWithCoreDeviceOrientation:(RefPtr<WebCore::DeviceOrientationData>&&)coreDeviceOrientation;
 
 @end
 
index 3685e2c..7032600 100644 (file)
@@ -792,15 +792,15 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     return NSMakeRange(location, length);
 }
 
-- (PassRefPtr<Range>)_convertToDOMRange:(NSRange)nsrange
+- (RefPtr<Range>)_convertToDOMRange:(NSRange)nsrange
 {
     return [self _convertToDOMRange:nsrange rangeIsRelativeTo:WebRangeIsRelativeTo::EditableRoot];
 }
 
-- (PassRefPtr<Range>)_convertToDOMRange:(NSRange)nsrange rangeIsRelativeTo:(WebRangeIsRelativeTo)rangeIsRelativeTo
+- (RefPtr<Range>)_convertToDOMRange:(NSRange)nsrange rangeIsRelativeTo:(WebRangeIsRelativeTo)rangeIsRelativeTo
 {
     if (nsrange.location > INT_MAX)
-        return 0;
+        return nullptr;
     if (nsrange.length > INT_MAX || nsrange.location + nsrange.length > INT_MAX)
         nsrange.length = INT_MAX - nsrange.location;
 
@@ -822,11 +822,11 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     const VisibleSelection& selection = _private->coreFrame->selection().selection();
     RefPtr<Range> selectedRange = selection.toNormalizedRange();
     if (!selectedRange)
-        return 0;
+        return nullptr;
 
     RefPtr<Range> paragraphRange = makeRange(startOfParagraph(selection.visibleStart()), selection.visibleEnd());
     if (!paragraphRange)
-        return 0;
+        return nullptr;
 
     ContainerNode& rootNode = paragraphRange.get()->startContainer().treeScope().rootNode();
     int paragraphStartIndex = TextIterator::rangeLength(Range::create(rootNode.document(), &rootNode, 0, &paragraphRange->startContainer(), paragraphRange->startOffset()).ptr());
index 5c72d28..29a7d4e 100644 (file)
@@ -164,8 +164,8 @@ WebView *getWebView(WebFrame *webFrame);
 - (DOMRange *)_rangeByAlteringCurrentSelection:(WebCore::FrameSelection::EAlteration)alteration direction:(WebCore::SelectionDirection)direction granularity:(WebCore::TextGranularity)granularity;
 #endif
 - (NSRange)_convertToNSRange:(WebCore::Range*)range;
-- (PassRefPtr<WebCore::Range>)_convertToDOMRange:(NSRange)nsrange;
-- (PassRefPtr<WebCore::Range>)_convertToDOMRange:(NSRange)nsrange rangeIsRelativeTo:(WebRangeIsRelativeTo)rangeIsRelativeTo;
+- (RefPtr<WebCore::Range>)_convertToDOMRange:(NSRange)nsrange;
+- (RefPtr<WebCore::Range>)_convertToDOMRange:(NSRange)nsrange rangeIsRelativeTo:(WebRangeIsRelativeTo)rangeIsRelativeTo;
 
 - (DOMDocumentFragment *)_documentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString;
 - (DOMDocumentFragment *)_documentFragmentWithNodesAsParagraphs:(NSArray *)nodes;
index 4981a21..60d96e8 100644 (file)
@@ -67,7 +67,7 @@ namespace WebCore {
 
 - (BOOL)isFullScreen;
 
-- (void)setElement:(PassRefPtr<WebCore::Element>)element;
+- (void)setElement:(RefPtr<WebCore::Element>&&)element;
 - (WebCore::Element*)element;
 
 - (void)enterFullScreen:(NSScreen *)screen;
index 4bcf499..1ddf197 100644 (file)
@@ -138,9 +138,9 @@ static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
     return _element.get();
 }
 
-- (void)setElement:(PassRefPtr<Element>)element
+- (void)setElement:(RefPtr<Element>&&)element
 {
-    _element = element;
+    _element = WTFMove(element);
 }
 
 - (BOOL)isFullScreen
index 7937ef3..456d4ba 100644 (file)
@@ -26,7 +26,6 @@
 #import "WebGeolocationPosition.h"
 
 #import "WebGeolocationPositionInternal.h"
-#import <wtf/PassRefPtr.h>
 #import <wtf/RefPtr.h>
 
 #import <WebCore/GeolocationPosition.h>
@@ -39,17 +38,17 @@ using namespace WebCore;
     RefPtr<GeolocationPosition> _position;
 }
 
-- (id)initWithCoreGeolocationPosition:(PassRefPtr<GeolocationPosition>)coreGeolocationPosition;
+- (id)initWithCoreGeolocationPosition:(RefPtr<GeolocationPosition>&&)coreGeolocationPosition;
 @end
 
 @implementation WebGeolocationPositionInternal
 
-- (id)initWithCoreGeolocationPosition:(PassRefPtr<GeolocationPosition>)coreGeolocationPosition
+- (id)initWithCoreGeolocationPosition:(RefPtr<GeolocationPosition>&&)coreGeolocationPosition
 {
     self = [super init];
     if (!self)
         return nil;
-    _position = coreGeolocationPosition;
+    _position = WTFMove(coreGeolocationPosition);
     return self;
 }
 
@@ -71,12 +70,12 @@ GeolocationPosition* core(WebGeolocationPosition *position)
     return self;
 }
 
-- (id)initWithGeolocationPosition:(RefPtr<GeolocationPosition>)coreGeolocationPosition
+- (id)initWithGeolocationPosition:(RefPtr<GeolocationPosition>&&)coreGeolocationPosition
 {
     self = [super init];
     if (!self)
         return nil;
-    _internal = [[WebGeolocationPositionInternal alloc] initWithCoreGeolocationPosition:coreGeolocationPosition];
+    _internal = [[WebGeolocationPositionInternal alloc] initWithCoreGeolocationPosition:WTFMove(coreGeolocationPosition)];
     return self;
 }
 
index 852c914..5d55ab1 100644 (file)
@@ -4826,12 +4826,12 @@ static BOOL isInPasswordField(Frame* coreFrame)
 }
 #endif
 
-static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
+static RefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
 {
 #if !PLATFORM(IOS)
     NSEvent *event = [NSApp currentEvent];
     if (!event)
-        return 0;
+        return nullptr;
 
     switch ([event type]) {
     case NSEventTypeKeyDown: {
@@ -4842,18 +4842,18 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
     case NSEventTypeKeyUp:
         return KeyboardEvent::create(PlatformEventFactory::createPlatformKeyboardEvent(event), coreFrame->document()->defaultView());
     default:
-        return 0;
+        return nullptr;
     }
 #else
     WebEvent *event = [WAKWindow currentEvent];
     if (!event)
-        return 0;
+        return nullptr;
     WebEventType type = event.type;
     if (type == WebEventKeyDown || type == WebEventKeyUp) {
         Document* document = coreFrame->document();
         return KeyboardEvent::create(PlatformEventFactory::createPlatformKeyboardEvent(event), document ? document->defaultView() : 0);
     }
-    return 0;
+    return nullptr;
 #endif
 }
 
index 3977b44..19df05e 100644 (file)
@@ -35,7 +35,6 @@
 #import "WebNSObjectExtras.h"
 #import "WebNSURLExtras.h"
 #import <JavaScriptCore/InitializeThreading.h>
-#import <wtf/PassRefPtr.h>
 #import <WebCore/ArchiveResource.h>
 #import <WebCore/LegacyWebArchive.h>
 #import <WebCore/RuntimeApplicationChecks.h>
@@ -44,6 +43,7 @@
 #import <WebCore/WebCoreObjCExtras.h>
 #import <WebCore/WebCoreURLResponse.h>
 #import <wtf/MainThread.h>
+#import <wtf/RefPtr.h>
 #import <wtf/RunLoop.h>
 
 using namespace WebCore;
index 7848b24..3ebf193 100644 (file)
@@ -52,18 +52,14 @@ static WorldMap& allWorlds()
 
 @implementation WebScriptWorld
 
-- (id)initWithWorld:(PassRefPtr<DOMWrapperWorld>)world
+- (id)initWithWorld:(Ref<DOMWrapperWorld>&&)world
 {
-    ASSERT_ARG(world, world);
-    if (!world)
-        return nil;
-
     self = [super init];
     if (!self)
         return nil;
 
     _private = [[WebScriptWorldPrivate alloc] init];
-    _private->world = world;
+    _private->world = WTFMove(world);
 
     ASSERT_ARG(world, !allWorlds().contains(_private->world.get()));
     allWorlds().add(_private->world.get(), self);
@@ -93,7 +89,7 @@ static WorldMap& allWorlds()
 
 + (WebScriptWorld *)standardWorld
 {
-    static WebScriptWorld *world = [[WebScriptWorld alloc] initWithWorld:&mainThreadNormalWorld()];
+    static WebScriptWorld *world = [[WebScriptWorld alloc] initWithWorld:mainThreadNormalWorld()];
     return world;
 }
 
@@ -131,7 +127,7 @@ DOMWrapperWorld* core(WebScriptWorld *world)
     if (WebScriptWorld *existingWorld = allWorlds().get(&world))
         return existingWorld;
 
-    return [[[self alloc] initWithWorld:&world] autorelease];
+    return [[[self alloc] initWithWorld:world] autorelease];
 }
 
 @end
index 88f692c..6c36928 100644 (file)
@@ -128,9 +128,9 @@ private:
 
 class LayerFlushController : public RefCounted<LayerFlushController>, public WebCore::LayerFlushSchedulerClient {
 public:
-    static PassRefPtr<LayerFlushController> create(WebView* webView)
+    static Ref<LayerFlushController> create(WebView* webView)
     {
-        return adoptRef(new LayerFlushController(webView));
+        return adoptRef(*new LayerFlushController(webView));
     }
     
     virtual bool flushLayers();