Remove all uses of PassRefPtr in crypto, storage, and history
authorgyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Sep 2015 02:36:37 +0000 (02:36 +0000)
committergyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Sep 2015 02:36:37 +0000 (02:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149091

Reviewed by Andreas Kling.

Source/WebCore:

* crypto/CryptoKeyPair.cpp:
(WebCore::CryptoKeyPair::CryptoKeyPair):
* crypto/CryptoKeyPair.h:
(WebCore::CryptoKeyPair::create):
* crypto/SubtleCrypto.h:
(WebCore::SubtleCrypto::create):
* crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
(WebCore::CryptoKeyRSA::create):
* crypto/keys/CryptoKeyAES.cpp:
(WebCore::CryptoKeyAES::generate):
* crypto/keys/CryptoKeyAES.h:
* crypto/keys/CryptoKeyHMAC.cpp:
(WebCore::CryptoKeyHMAC::generate):
* crypto/keys/CryptoKeyHMAC.h:
* crypto/keys/CryptoKeyRSA.h:
* crypto/mac/CryptoKeyRSAMac.cpp:
(WebCore::CryptoKeyRSA::create):
* history/BackForwardController.cpp:
(WebCore::BackForwardController::BackForwardController):
* history/BackForwardController.h:
* history/HistoryItem.cpp:
(WebCore::HistoryItem::setStateObject):
(WebCore::HistoryItem::setFormData):
* history/HistoryItem.h:
(WebCore::HistoryItem::stateObject):
* loader/EmptyClients.cpp:
* page/Page.cpp:
(WebCore::Page::Page):
* storage/Storage.cpp:
(WebCore::Storage::create):
(WebCore::Storage::Storage):
* storage/Storage.h:
* storage/StorageArea.h:
* storage/StorageMap.cpp:
(WebCore::StorageMap::copy):
(WebCore::StorageMap::setItem):
(WebCore::StorageMap::setItemIgnoringQuota):
(WebCore::StorageMap::removeItem):
* storage/StorageMap.h:
* storage/StorageNamespace.h:

Source/WebKit:

* Storage/StorageNamespaceImpl.cpp:
(WebCore::StorageNamespaceImpl::storageArea):
* Storage/StorageNamespaceImpl.h:

Source/WebKit2:

* WebProcess/Storage/StorageNamespaceImpl.cpp:
(WebKit::StorageNamespaceImpl::storageArea):
* WebProcess/Storage/StorageNamespaceImpl.h:

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

29 files changed:
Source/WebCore/ChangeLog
Source/WebCore/crypto/CryptoKeyPair.cpp
Source/WebCore/crypto/CryptoKeyPair.h
Source/WebCore/crypto/SubtleCrypto.h
Source/WebCore/crypto/gnutls/CryptoKeyRSAGnuTLS.cpp
Source/WebCore/crypto/keys/CryptoKeyAES.cpp
Source/WebCore/crypto/keys/CryptoKeyAES.h
Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp
Source/WebCore/crypto/keys/CryptoKeyHMAC.h
Source/WebCore/crypto/keys/CryptoKeyRSA.h
Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp
Source/WebCore/history/BackForwardController.cpp
Source/WebCore/history/BackForwardController.h
Source/WebCore/history/HistoryItem.cpp
Source/WebCore/history/HistoryItem.h
Source/WebCore/loader/EmptyClients.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/storage/Storage.cpp
Source/WebCore/storage/Storage.h
Source/WebCore/storage/StorageArea.h
Source/WebCore/storage/StorageMap.cpp
Source/WebCore/storage/StorageMap.h
Source/WebCore/storage/StorageNamespace.h
Source/WebKit/ChangeLog
Source/WebKit/Storage/StorageNamespaceImpl.cpp
Source/WebKit/Storage/StorageNamespaceImpl.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Storage/StorageNamespaceImpl.cpp
Source/WebKit2/WebProcess/Storage/StorageNamespaceImpl.h

index 9805409..665d21b 100644 (file)
@@ -1,3 +1,51 @@
+2015-09-13  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
+
+        Remove all uses of PassRefPtr in crypto, storage, and history
+        https://bugs.webkit.org/show_bug.cgi?id=149091
+
+        Reviewed by Andreas Kling.
+
+        * crypto/CryptoKeyPair.cpp:
+        (WebCore::CryptoKeyPair::CryptoKeyPair):
+        * crypto/CryptoKeyPair.h:
+        (WebCore::CryptoKeyPair::create):
+        * crypto/SubtleCrypto.h:
+        (WebCore::SubtleCrypto::create):
+        * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
+        (WebCore::CryptoKeyRSA::create):
+        * crypto/keys/CryptoKeyAES.cpp:
+        (WebCore::CryptoKeyAES::generate):
+        * crypto/keys/CryptoKeyAES.h:
+        * crypto/keys/CryptoKeyHMAC.cpp:
+        (WebCore::CryptoKeyHMAC::generate):
+        * crypto/keys/CryptoKeyHMAC.h:
+        * crypto/keys/CryptoKeyRSA.h:
+        * crypto/mac/CryptoKeyRSAMac.cpp:
+        (WebCore::CryptoKeyRSA::create):
+        * history/BackForwardController.cpp:
+        (WebCore::BackForwardController::BackForwardController):
+        * history/BackForwardController.h:
+        * history/HistoryItem.cpp:
+        (WebCore::HistoryItem::setStateObject):
+        (WebCore::HistoryItem::setFormData):
+        * history/HistoryItem.h:
+        (WebCore::HistoryItem::stateObject):
+        * loader/EmptyClients.cpp:
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        * storage/Storage.cpp:
+        (WebCore::Storage::create):
+        (WebCore::Storage::Storage):
+        * storage/Storage.h:
+        * storage/StorageArea.h:
+        * storage/StorageMap.cpp:
+        (WebCore::StorageMap::copy):
+        (WebCore::StorageMap::setItem):
+        (WebCore::StorageMap::setItemIgnoringQuota):
+        (WebCore::StorageMap::removeItem):
+        * storage/StorageMap.h:
+        * storage/StorageNamespace.h:
+
 2015-09-12  Chris Dumez  <cdumez@apple.com>
 
         window.EventTarget should exist
index 693d863..e0e2739 100644 (file)
@@ -30,9 +30,9 @@
 
 namespace WebCore {
 
-CryptoKeyPair::CryptoKeyPair(PassRefPtr<CryptoKey> publicKey, PassRefPtr<CryptoKey> privateKey)
-    : m_publicKey(publicKey)
-    , m_privateKey(privateKey)
+CryptoKeyPair::CryptoKeyPair(RefPtr<CryptoKey>&& publicKey, RefPtr<CryptoKey>&& privateKey)
+    : m_publicKey(WTF::move(publicKey))
+    , m_privateKey(WTF::move(privateKey))
 {
 }
 
index fb27ce9..71309c9 100644 (file)
@@ -27,7 +27,6 @@
 #define CryptoKeyPair_h
 
 #include "CryptoKey.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
@@ -37,9 +36,9 @@ namespace WebCore {
 
 class CryptoKeyPair : public RefCounted<CryptoKeyPair> {
 public:
-    static Ref<CryptoKeyPair> create(PassRefPtr<CryptoKey> publicKey, PassRefPtr<CryptoKey> privateKey)
+    static Ref<CryptoKeyPair> create(RefPtr<CryptoKey>&& publicKey, RefPtr<CryptoKey>&& privateKey)
     {
-        return adoptRef(*new CryptoKeyPair(publicKey, privateKey));
+        return adoptRef(*new CryptoKeyPair(WTF::move(publicKey), WTF::move(privateKey)));
     }
     ~CryptoKeyPair();
 
@@ -47,7 +46,7 @@ public:
     CryptoKey* privateKey() { return m_privateKey.get(); }
 
 private:
-    CryptoKeyPair(PassRefPtr<CryptoKey> publicKey, PassRefPtr<CryptoKey> privateKey);
+    CryptoKeyPair(RefPtr<CryptoKey>&& publicKey, RefPtr<CryptoKey>&& privateKey);
 
     RefPtr<CryptoKey> m_publicKey;
     RefPtr<CryptoKey> m_privateKey;
index 70d490c..ed6ccb7 100644 (file)
@@ -26,9 +26,9 @@
 #ifndef SubtleCrypto_h
 #define SubtleCrypto_h
 
-#include "ContextDestructionObserver.h"
-#include <wtf/PassRefPtr.h>
+#include "ContextDestructionObserver.h" 
 #include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
 
 #if ENABLE(SUBTLE_CRYPTO)
 
@@ -38,7 +38,7 @@ class Document;
 
 class SubtleCrypto : public ContextDestructionObserver, public RefCounted<SubtleCrypto> {
 public:
-    static PassRefPtr<SubtleCrypto> create(Document& document) { return adoptRef(new SubtleCrypto(document)); }
+    static Ref<SubtleCrypto> create(Document& document) { return adoptRef(*new SubtleCrypto(document)); }
 
     Document* document() const;
 
index ed6b578..f48224b 100644 (file)
@@ -47,7 +47,7 @@ CryptoKeyRSA::CryptoKeyRSA(CryptoAlgorithmIdentifier identifier, CryptoKeyType t
     notImplemented();
 }
 
-PassRefPtr<CryptoKeyRSA> CryptoKeyRSA::create(CryptoAlgorithmIdentifier identifier, const CryptoKeyDataRSAComponents& keyData, bool extractable, CryptoKeyUsage usage)
+RefPtr<CryptoKeyRSA> CryptoKeyRSA::create(CryptoAlgorithmIdentifier identifier, const CryptoKeyDataRSAComponents& keyData, bool extractable, CryptoKeyUsage usage)
 {
     notImplemented();
     UNUSED_PARAM(identifier);
index 7954cc7..44b5007 100644 (file)
@@ -56,7 +56,7 @@ bool CryptoKeyAES::isValidAESAlgorithm(CryptoAlgorithmIdentifier algorithm)
         || algorithm == CryptoAlgorithmIdentifier::AES_KW;
 }
 
-PassRefPtr<CryptoKeyAES> CryptoKeyAES::generate(CryptoAlgorithmIdentifier algorithm, size_t lengthBits, bool extractable, CryptoKeyUsage usages)
+RefPtr<CryptoKeyAES> CryptoKeyAES::generate(CryptoAlgorithmIdentifier algorithm, size_t lengthBits, bool extractable, CryptoKeyUsage usages)
 {
     if (lengthBits % 8)
         return nullptr;
index 18b01b4..a6eb422 100644 (file)
@@ -44,7 +44,7 @@ public:
 
     static bool isValidAESAlgorithm(CryptoAlgorithmIdentifier);
 
-    static PassRefPtr<CryptoKeyAES> generate(CryptoAlgorithmIdentifier, size_t lengthBits, bool extractable, CryptoKeyUsage);
+    static RefPtr<CryptoKeyAES> generate(CryptoAlgorithmIdentifier, size_t lengthBits, bool extractable, CryptoKeyUsage);
 
     virtual CryptoKeyClass keyClass() const override { return CryptoKeyClass::AES; }
 
index 38e0a26..af604f4 100644 (file)
@@ -46,7 +46,7 @@ CryptoKeyHMAC::~CryptoKeyHMAC()
 {
 }
 
-PassRefPtr<CryptoKeyHMAC> CryptoKeyHMAC::generate(size_t lengthBytes, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage usages)
+RefPtr<CryptoKeyHMAC> CryptoKeyHMAC::generate(size_t lengthBytes, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage usages)
 {
     if (!lengthBytes) {
         switch (hash) {
index ca5131b..2873db9 100644 (file)
@@ -42,7 +42,7 @@ public:
     virtual ~CryptoKeyHMAC();
 
     // If lengthBytes is 0, a recommended length is used, which is the size of the associated hash function's block size.
-    static PassRefPtr<CryptoKeyHMAC> generate(size_t lengthBytes, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage);
+    static RefPtr<CryptoKeyHMAC> generate(size_t lengthBytes, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage);
 
     virtual CryptoKeyClass keyClass() const override { return CryptoKeyClass::HMAC; }
 
index 1aa5316..98e0107 100644 (file)
@@ -53,7 +53,7 @@ public:
     {
         return adoptRef(*new CryptoKeyRSA(identifier, type, platformKey, extractable, usage));
     }
-    static PassRefPtr<CryptoKeyRSA> create(CryptoAlgorithmIdentifier, const CryptoKeyDataRSAComponents&, bool extractable, CryptoKeyUsage);
+    static RefPtr<CryptoKeyRSA> create(CryptoAlgorithmIdentifier, const CryptoKeyDataRSAComponents&, bool extractable, CryptoKeyUsage);
     virtual ~CryptoKeyRSA();
 
     void restrictToHash(CryptoAlgorithmIdentifier);
index 9199020..dae0bec 100644 (file)
@@ -103,7 +103,7 @@ CryptoKeyRSA::CryptoKeyRSA(CryptoAlgorithmIdentifier identifier, CryptoKeyType t
 {
 }
 
-PassRefPtr<CryptoKeyRSA> CryptoKeyRSA::create(CryptoAlgorithmIdentifier identifier, const CryptoKeyDataRSAComponents& keyData, bool extractable, CryptoKeyUsage usage)
+RefPtr<CryptoKeyRSA> CryptoKeyRSA::create(CryptoAlgorithmIdentifier identifier, const CryptoKeyDataRSAComponents& keyData, bool extractable, CryptoKeyUsage usage)
 {
     if (keyData.type() == CryptoKeyDataRSAComponents::Type::Private && !keyData.hasAdditionalPrivateKeyParameters()) {
         // <rdar://problem/15452324> tracks adding support.
index 1aeb63c..bf96cb2 100644 (file)
@@ -32,9 +32,9 @@
 
 namespace WebCore {
 
-BackForwardController::BackForwardController(Page& page, PassRefPtr<BackForwardClient> client)
+BackForwardController::BackForwardController(Page& page, RefPtr<BackForwardClient>&& client)
     : m_page(page)
-    , m_client(client)
+    , m_client(WTF::move(client))
 {
     if (!m_client)
         m_client = BackForwardList::create(&page);
index 589ee5e..5a24f8e 100644 (file)
@@ -39,7 +39,7 @@ class Page;
 class BackForwardController {
     WTF_MAKE_NONCOPYABLE(BackForwardController); WTF_MAKE_FAST_ALLOCATED;
 public:
-    BackForwardController(Page&, PassRefPtr<BackForwardClient>);
+    BackForwardController(Page&, RefPtr<BackForwardClient>&&);
     ~BackForwardController();
 
     BackForwardClient* client() const { return m_client.get(); }
index a1902d3..1fc9eb3 100644 (file)
@@ -371,9 +371,9 @@ void HistoryItem::setIsTargetItem(bool flag)
     m_isTargetItem = flag;
 }
 
-void HistoryItem::setStateObject(PassRefPtr<SerializedScriptValue> object)
+void HistoryItem::setStateObject(RefPtr<SerializedScriptValue>&& object)
 {
-    m_stateObject = object;
+    m_stateObject = WTF::move(object);
 }
 
 void HistoryItem::addChildItem(Ref<HistoryItem>&& child)
@@ -539,9 +539,9 @@ void HistoryItem::setFormInfoFromRequest(const ResourceRequest& request)
     }
 }
 
-void HistoryItem::setFormData(PassRefPtr<FormData> formData)
+void HistoryItem::setFormData(RefPtr<FormData>&& formData)
 {
-    m_formData = formData;
+    m_formData = WTF::move(formData);
 }
 
 void HistoryItem::setFormContentType(const String& formContentType)
index 09cf5ee..8d747cf 100644 (file)
@@ -130,8 +130,8 @@ public:
     WEBCORE_EXPORT void setTitle(const String&);
     WEBCORE_EXPORT void setIsTargetItem(bool);
     
-    WEBCORE_EXPORT void setStateObject(PassRefPtr<SerializedScriptValue>);
-    PassRefPtr<SerializedScriptValue> stateObject() const { return m_stateObject; }
+    WEBCORE_EXPORT void setStateObject(RefPtr<SerializedScriptValue>&&);
+    RefPtr<SerializedScriptValue> stateObject() const { return m_stateObject; }
 
     void setItemSequenceNumber(long long number) { m_itemSequenceNumber = number; }
     long long itemSequenceNumber() const { return m_itemSequenceNumber; }
@@ -140,7 +140,7 @@ public:
     long long documentSequenceNumber() const { return m_documentSequenceNumber; }
 
     void setFormInfoFromRequest(const ResourceRequest&);
-    WEBCORE_EXPORT void setFormData(PassRefPtr<FormData>);
+    WEBCORE_EXPORT void setFormData(RefPtr<FormData>&&);
     WEBCORE_EXPORT void setFormContentType(const String&);
 
     void setLastVisitWasFailure(bool wasFailure) { m_lastVisitWasFailure = wasFailure; }
index ea9255c..44a6cb3 100644 (file)
@@ -67,7 +67,7 @@ class EmptyStorageNamespaceProvider final : public StorageNamespaceProvider {
     };
 
     struct EmptyStorageNamespace final : public StorageNamespace {
-        virtual RefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>) override { return adoptRef(new EmptyStorageArea); }
+        virtual RefPtr<StorageArea> storageArea(RefPtr<SecurityOrigin>&&) override { return adoptRef(new EmptyStorageArea); }
         virtual RefPtr<StorageNamespace> copy(Page*) override { return adoptRef(new EmptyStorageNamespace); }
     };
 
index 0f3d74b..994e626 100644 (file)
@@ -157,7 +157,7 @@ Page::Page(PageConfiguration& pageConfiguration)
 #endif
     , m_settings(Settings::create(this))
     , m_progress(std::make_unique<ProgressTracker>(*pageConfiguration.progressTrackerClient))
-    , m_backForwardController(std::make_unique<BackForwardController>(*this, pageConfiguration.backForwardClient))
+    , m_backForwardController(std::make_unique<BackForwardController>(*this, WTF::move(pageConfiguration.backForwardClient)))
     , m_mainFrame(MainFrame::create(*this, pageConfiguration))
     , m_theme(RenderTheme::themeForPage(this))
     , m_editorClient(*pageConfiguration.editorClient)
index 0fe31eb..dd7d6d0 100644 (file)
 #include "SchemeRegistry.h"
 #include "Settings.h"
 #include "StorageArea.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
-Ref<Storage> Storage::create(Frame* frame, PassRefPtr<StorageArea> storageArea)
+Ref<Storage> Storage::create(Frame* frame, RefPtr<StorageArea>&& storageArea)
 {
-    return adoptRef(*new Storage(frame, storageArea));
+    return adoptRef(*new Storage(frame, WTF::move(storageArea)));
 }
 
-Storage::Storage(Frame* frame, PassRefPtr<StorageArea> storageArea)
+Storage::Storage(Frame* frame, RefPtr<StorageArea>&& storageArea)
     : DOMWindowProperty(frame)
-    , m_storageArea(storageArea)
+    , m_storageArea(WTF::move(storageArea))
 {
     ASSERT(m_frame);
     ASSERT(m_storageArea);
index ceb9d0c..46f0267 100644 (file)
@@ -41,7 +41,7 @@ typedef int ExceptionCode;
 
 class Storage : public ScriptWrappable, public RefCounted<Storage>, public DOMWindowProperty {
 public:
-    static Ref<Storage> create(Frame*, PassRefPtr<StorageArea>);
+    static Ref<Storage> create(Frame*, RefPtr<StorageArea>&&);
     ~Storage();
 
     unsigned length(ExceptionCode&) const;
@@ -55,7 +55,7 @@ public:
     StorageArea& area() const { return *m_storageArea; }
 
 private:
-    Storage(Frame*, PassRefPtr<StorageArea>);
+    Storage(Frame*, RefPtr<StorageArea>&&);
 
     bool isDisabledByPrivateBrowsing() const;
 
index d5c05a6..fe1a128 100644 (file)
@@ -27,7 +27,6 @@
 #define StorageArea_h
 
 #include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
index 6eca29a..ae48b60 100644 (file)
@@ -43,12 +43,12 @@ StorageMap::StorageMap(unsigned quota)
 {
 }
 
-PassRefPtr<StorageMap> StorageMap::copy()
+Ref<StorageMap> StorageMap::copy()
 {
-    RefPtr<StorageMap> newMap = create(m_quotaSize);
+    Ref<StorageMap> newMap = create(m_quotaSize);
     newMap->m_map = m_map;
     newMap->m_currentLength = m_currentLength;
-    return newMap.release();
+    return newMap;
 }
 
 void StorageMap::invalidateIterator()
@@ -99,7 +99,7 @@ String StorageMap::getItem(const String& key) const
     return m_map.get(key);
 }
 
-PassRefPtr<StorageMap> StorageMap::setItem(const String& key, const String& value, String& oldValue, bool& quotaException)
+RefPtr<StorageMap> StorageMap::setItem(const String& key, const String& value, String& oldValue, bool& quotaException)
 {
     ASSERT(!value.isNull());
     quotaException = false;
@@ -109,7 +109,7 @@ PassRefPtr<StorageMap> StorageMap::setItem(const String& key, const String& valu
     if (refCount() > 1) {
         RefPtr<StorageMap> newStorageMap = copy();
         newStorageMap->setItem(key, value, oldValue, quotaException);
-        return newStorageMap.release();
+        return newStorageMap;
     }
 
     // Quota tracking.  This is done in a couple of steps to keep the overflow tracking simple.
@@ -129,7 +129,7 @@ PassRefPtr<StorageMap> StorageMap::setItem(const String& key, const String& valu
     bool overQuota = newLength > m_quotaSize / sizeof(UChar);
     if (m_quotaSize != noQuota && (overflow || overQuota)) {
         quotaException = true;
-        return 0;
+        return nullptr;
     }
     m_currentLength = newLength;
 
@@ -139,10 +139,10 @@ PassRefPtr<StorageMap> StorageMap::setItem(const String& key, const String& valu
 
     invalidateIterator();
 
-    return 0;
+    return nullptr;
 }
 
-PassRefPtr<StorageMap> StorageMap::setItemIgnoringQuota(const String& key, const String& value)
+RefPtr<StorageMap> StorageMap::setItemIgnoringQuota(const String& key, const String& value)
 {
     TemporaryChange<unsigned> quotaSizeChange(m_quotaSize, noQuota);
 
@@ -152,17 +152,17 @@ PassRefPtr<StorageMap> StorageMap::setItemIgnoringQuota(const String& key, const
     RefPtr<StorageMap> map = setItem(key, value, oldValue, quotaException);
     ASSERT(!quotaException);
 
-    return map.release();
+    return map;
 }
 
-PassRefPtr<StorageMap> StorageMap::removeItem(const String& key, String& oldValue)
+RefPtr<StorageMap> StorageMap::removeItem(const String& key, String& oldValue)
 {
     // Implement copy-on-write semantics here.  We're guaranteed that the only refs of StorageMaps belong to Storage objects
     // so if more than one Storage object refs this map, copy it before mutating it.
     if (refCount() > 1) {
         RefPtr<StorageMap> newStorage = copy();
         newStorage->removeItem(key, oldValue);
-        return newStorage.release();
+        return newStorage;
     }
 
     oldValue = m_map.take(key);
@@ -174,7 +174,7 @@ PassRefPtr<StorageMap> StorageMap::removeItem(const String& key, String& oldValu
     ASSERT(m_currentLength - oldValue.length() <= m_currentLength);
     m_currentLength -= oldValue.length();
 
-    return 0;
+    return nullptr;
 }
 
 bool StorageMap::contains(const String& key) const
index 5de1915..209e32f 100644 (file)
@@ -27,7 +27,6 @@
 #define StorageMap_h
 
 #include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
@@ -42,9 +41,9 @@ public:
     WEBCORE_EXPORT unsigned length() const;
     WEBCORE_EXPORT String key(unsigned index);
     WEBCORE_EXPORT String getItem(const String&) const;
-    WEBCORE_EXPORT PassRefPtr<StorageMap> setItem(const String& key, const String& value, String& oldValue, bool& quotaException);
-    WEBCORE_EXPORT PassRefPtr<StorageMap> setItemIgnoringQuota(const String& key, const String& value);
-    WEBCORE_EXPORT PassRefPtr<StorageMap> removeItem(const String&, String& oldValue);
+    WEBCORE_EXPORT RefPtr<StorageMap> setItem(const String& key, const String& value, String& oldValue, bool& quotaException);
+    WEBCORE_EXPORT RefPtr<StorageMap> setItemIgnoringQuota(const String& key, const String& value);
+    WEBCORE_EXPORT RefPtr<StorageMap> removeItem(const String&, String& oldValue);
 
     WEBCORE_EXPORT bool contains(const String& key) const;
 
@@ -57,7 +56,7 @@ public:
 
 private:
     explicit StorageMap(unsigned quota);
-    PassRefPtr<StorageMap> copy();
+    Ref<StorageMap> copy();
     void invalidateIterator();
     void setIteratorToIndex(unsigned);
 
index bde95f5..3f21d0b 100644 (file)
@@ -27,7 +27,6 @@
 #define StorageNamespace_h
 
 #include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
@@ -40,7 +39,7 @@ class StorageArea;
 class StorageNamespace : public RefCounted<StorageNamespace> {
 public:
     virtual ~StorageNamespace() { }
-    virtual RefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>) = 0;
+    virtual RefPtr<StorageArea> storageArea(RefPtr<SecurityOrigin>&&) = 0;
     virtual RefPtr<StorageNamespace> copy(Page* newPage) = 0;
 };
 
index cb934e8..4ace7b8 100644 (file)
@@ -1,3 +1,14 @@
+2015-09-13  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
+
+        Remove all uses of PassRefPtr in crypto, storage, and history
+        https://bugs.webkit.org/show_bug.cgi?id=149091
+
+        Reviewed by Andreas Kling.
+
+        * Storage/StorageNamespaceImpl.cpp:
+        (WebCore::StorageNamespaceImpl::storageArea):
+        * Storage/StorageNamespaceImpl.h:
+
 2015-08-27  Alex Christensen  <achristensen@webkit.org>
 
         Isolate Source directories in CMake build
index 6aa0f33..3b5a983 100644 (file)
@@ -99,18 +99,17 @@ RefPtr<StorageNamespace> StorageNamespaceImpl::copy(Page*)
     return newNamespace;
 }
 
-RefPtr<StorageArea> StorageNamespaceImpl::storageArea(PassRefPtr<SecurityOrigin> prpOrigin)
+RefPtr<StorageArea> StorageNamespaceImpl::storageArea(RefPtr<SecurityOrigin>&& origin)
 {
     ASSERT(isMainThread());
     ASSERT(!m_isShutdown);
 
-    RefPtr<SecurityOrigin> origin = prpOrigin;
     RefPtr<StorageAreaImpl> storageArea;
     if ((storageArea = m_storageAreaMap.get(origin)))
         return storageArea;
 
-    storageArea = StorageAreaImpl::create(m_storageType, origin, m_syncManager, m_quota);
-    m_storageAreaMap.set(origin.release(), storageArea);
+    storageArea = StorageAreaImpl::create(m_storageType, origin.copyRef(), m_syncManager, m_quota);
+    m_storageAreaMap.set(WTF::move(origin), storageArea);
     return storageArea;
 }
 
index 70c6b57..cb3736f 100644 (file)
@@ -57,7 +57,7 @@ public:
 private:
     StorageNamespaceImpl(StorageType, const String& path, unsigned quota);
 
-    virtual RefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>)  override;
+    virtual RefPtr<StorageArea> storageArea(RefPtr<SecurityOrigin>&&)  override;
     virtual RefPtr<StorageNamespace> copy(Page* newPage) override;
 
     typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageAreaImpl>> StorageAreaMap;
index c98a4fa..63f5898 100644 (file)
@@ -1,3 +1,14 @@
+2015-09-13  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
+
+        Remove all uses of PassRefPtr in crypto, storage, and history
+        https://bugs.webkit.org/show_bug.cgi?id=149091
+
+        Reviewed by Andreas Kling.
+
+        * WebProcess/Storage/StorageNamespaceImpl.cpp:
+        (WebKit::StorageNamespaceImpl::storageArea):
+        * WebProcess/Storage/StorageNamespaceImpl.h:
+
 2015-09-13  Dan Bernstein  <mitz@apple.com>
 
         Define HAVE_LINK_PREVIEW in WebKit2
index 35778f8..1b31c02 100644 (file)
@@ -72,7 +72,7 @@ void StorageNamespaceImpl::didDestroyStorageAreaMap(StorageAreaMap& map)
     m_storageAreaMaps.remove(&map.securityOrigin());
 }
 
-RefPtr<StorageArea> StorageNamespaceImpl::storageArea(PassRefPtr<SecurityOrigin> securityOrigin)
+RefPtr<StorageArea> StorageNamespaceImpl::storageArea(RefPtr<SecurityOrigin>&& securityOrigin)
 {
     RefPtr<StorageAreaMap> map;
 
index 3781717..688ec9a 100644 (file)
@@ -54,7 +54,7 @@ public:
 private:
     explicit StorageNamespaceImpl(WebCore::StorageType, uint64_t storageNamespaceID, WebCore::SecurityOrigin* topLevelOrigin, unsigned quotaInBytes);
 
-    virtual RefPtr<WebCore::StorageArea> storageArea(PassRefPtr<WebCore::SecurityOrigin>) override;
+    virtual RefPtr<WebCore::StorageArea> storageArea(RefPtr<WebCore::SecurityOrigin>&&) override;
     virtual RefPtr<WebCore::StorageNamespace> copy(WebCore::Page*) override;
 
     const WebCore::StorageType m_storageType;