Unreviewed, rolling out r241838.
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2019 00:12:44 +0000 (00:12 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2019 00:12:44 +0000 (00:12 +0000)
Broke API tests

Reverted changeset:

"Resolve WebsiteDataStore/HTTPCookieStore ref cycle"
https://bugs.webkit.org/show_bug.cgi?id=194868
https://trac.webkit.org/changeset/241838

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp
Source/WebKit/UIProcess/API/APIHTTPCookieStore.h

index f355f37..fb1bc47 100644 (file)
@@ -1,3 +1,15 @@
+2019-02-20  Alex Christensen  <achristensen@webkit.org>
+
+        Unreviewed, rolling out r241838.
+
+        Broke API tests
+
+        Reverted changeset:
+
+        "Resolve WebsiteDataStore/HTTPCookieStore ref cycle"
+        https://bugs.webkit.org/show_bug.cgi?id=194868
+        https://trac.webkit.org/changeset/241838
+
 2019-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         REGRESSION: [ iOS ] Layout Test editing/input/ios/rtl-keyboard-input-on-focus.html is a Timeout
index f4db501..e174ef6 100644 (file)
@@ -40,7 +40,7 @@ namespace API {
 HTTPCookieStore::HTTPCookieStore(WebKit::WebsiteDataStore& websiteDataStore)
     : m_owningDataStore(websiteDataStore)
 {
-    if (!m_owningDataStore.processPoolForCookieStorageOperations())
+    if (!m_owningDataStore->processPoolForCookieStorageOperations())
         registerForNewProcessPoolNotifications();
 }
 
@@ -55,12 +55,12 @@ HTTPCookieStore::~HTTPCookieStore()
 
 void HTTPCookieStore::cookies(CompletionHandler<void(const Vector<WebCore::Cookie>&)>&& completionHandler)
 {
-    auto* pool = m_owningDataStore.processPoolForCookieStorageOperations();
+    auto* pool = m_owningDataStore->processPoolForCookieStorageOperations();
     if (!pool) {
         Vector<WebCore::Cookie> allCookies;
-        if (m_owningDataStore.sessionID() == PAL::SessionID::defaultSessionID())
+        if (m_owningDataStore->sessionID() == PAL::SessionID::defaultSessionID())
             allCookies = getAllDefaultUIProcessCookieStoreCookies();
-        allCookies.appendVector(m_owningDataStore.pendingCookies());
+        allCookies.appendVector(m_owningDataStore->pendingCookies());
 
         callOnMainThread([completionHandler = WTFMove(completionHandler), allCookies] () mutable {
             completionHandler(allCookies);
@@ -69,20 +69,20 @@ void HTTPCookieStore::cookies(CompletionHandler<void(const Vector<WebCore::Cooki
     }
 
     auto* cookieManager = pool->supplement<WebKit::WebCookieManagerProxy>();
-    cookieManager->getAllCookies(m_owningDataStore.sessionID(), [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)] (const Vector<WebCore::Cookie>& cookies, CallbackBase::Error error) mutable {
+    cookieManager->getAllCookies(m_owningDataStore->sessionID(), [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)] (const Vector<WebCore::Cookie>& cookies, CallbackBase::Error error) mutable {
         completionHandler(cookies);
     });
 }
 
 void HTTPCookieStore::setCookie(const WebCore::Cookie& cookie, CompletionHandler<void()>&& completionHandler)
 {
-    auto* pool = m_owningDataStore.processPoolForCookieStorageOperations();
+    auto* pool = m_owningDataStore->processPoolForCookieStorageOperations();
     if (!pool) {
         // FIXME: pendingCookies used for defaultSession because session cookies cannot be propagated to Network Process with uiProcessCookieStorageIdentifier.
-        if (m_owningDataStore.sessionID() == PAL::SessionID::defaultSessionID() && !cookie.session)
+        if (m_owningDataStore->sessionID() == PAL::SessionID::defaultSessionID() && !cookie.session)
             setCookieInDefaultUIProcessCookieStore(cookie);
         else
-            m_owningDataStore.addPendingCookie(cookie);
+            m_owningDataStore->addPendingCookie(cookie);
 
         callOnMainThread([completionHandler = WTFMove(completionHandler)] () mutable {
             completionHandler();
@@ -91,19 +91,19 @@ void HTTPCookieStore::setCookie(const WebCore::Cookie& cookie, CompletionHandler
     }
 
     auto* cookieManager = pool->supplement<WebKit::WebCookieManagerProxy>();
-    cookieManager->setCookie(m_owningDataStore.sessionID(), cookie, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)] (CallbackBase::Error error) mutable {
+    cookieManager->setCookie(m_owningDataStore->sessionID(), cookie, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)] (CallbackBase::Error error) mutable {
         completionHandler();
     });
 }
 
 void HTTPCookieStore::deleteCookie(const WebCore::Cookie& cookie, CompletionHandler<void()>&& completionHandler)
 {
-    auto* pool = m_owningDataStore.processPoolForCookieStorageOperations();
+    auto* pool = m_owningDataStore->processPoolForCookieStorageOperations();
     if (!pool) {
-        if (m_owningDataStore.sessionID() == PAL::SessionID::defaultSessionID() && !cookie.session)
+        if (m_owningDataStore->sessionID() == PAL::SessionID::defaultSessionID() && !cookie.session)
             deleteCookieFromDefaultUIProcessCookieStore(cookie);
         else
-            m_owningDataStore.removePendingCookie(cookie);
+            m_owningDataStore->removePendingCookie(cookie);
 
         callOnMainThread([completionHandler = WTFMove(completionHandler)] () mutable {
             completionHandler();
@@ -112,7 +112,7 @@ void HTTPCookieStore::deleteCookie(const WebCore::Cookie& cookie, CompletionHand
     }
 
     auto* cookieManager = pool->supplement<WebKit::WebCookieManagerProxy>();
-    cookieManager->deleteCookie(m_owningDataStore.sessionID(), cookie, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](CallbackBase::Error error) mutable {
+    cookieManager->deleteCookie(m_owningDataStore->sessionID(), cookie, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](CallbackBase::Error error) mutable {
         completionHandler();
     });
 }
@@ -150,7 +150,7 @@ void HTTPCookieStore::registerObserver(Observer& observer)
 
     m_cookieManagerProxyObserver = std::make_unique<APIWebCookieManagerProxyObserver>(*this);
 
-    auto* pool = m_owningDataStore.processPoolForCookieStorageOperations();
+    auto* pool = m_owningDataStore->processPoolForCookieStorageOperations();
 
     if (!pool) {
         ASSERT(!m_observingUIProcessCookies);
@@ -165,7 +165,7 @@ void HTTPCookieStore::registerObserver(Observer& observer)
     }
 
     m_observedCookieManagerProxy = pool->supplement<WebKit::WebCookieManagerProxy>();
-    m_observedCookieManagerProxy->registerObserver(m_owningDataStore.sessionID(), *m_cookieManagerProxyObserver);
+    m_observedCookieManagerProxy->registerObserver(m_owningDataStore->sessionID(), *m_cookieManagerProxyObserver);
 }
 
 void HTTPCookieStore::unregisterObserver(Observer& observer)
@@ -176,7 +176,7 @@ void HTTPCookieStore::unregisterObserver(Observer& observer)
         return;
 
     if (m_observedCookieManagerProxy)
-        m_observedCookieManagerProxy->unregisterObserver(m_owningDataStore.sessionID(), *m_cookieManagerProxyObserver);
+        m_observedCookieManagerProxy->unregisterObserver(m_owningDataStore->sessionID(), *m_cookieManagerProxyObserver);
 
     if (m_observingUIProcessCookies)
         stopObservingChangesToDefaultUIProcessCookieStore();
@@ -198,16 +198,16 @@ void HTTPCookieStore::cookiesDidChange()
 
 void HTTPCookieStore::cookieManagerDestroyed()
 {
-    m_observedCookieManagerProxy->unregisterObserver(m_owningDataStore.sessionID(), *m_cookieManagerProxyObserver);
+    m_observedCookieManagerProxy->unregisterObserver(m_owningDataStore->sessionID(), *m_cookieManagerProxyObserver);
     m_observedCookieManagerProxy = nullptr;
 
-    auto* pool = m_owningDataStore.processPoolForCookieStorageOperations();
+    auto* pool = m_owningDataStore->processPoolForCookieStorageOperations();
 
     if (!pool)
         return;
 
     m_observedCookieManagerProxy = pool->supplement<WebKit::WebCookieManagerProxy>();
-    m_observedCookieManagerProxy->registerObserver(m_owningDataStore.sessionID(), *m_cookieManagerProxyObserver);
+    m_observedCookieManagerProxy->registerObserver(m_owningDataStore->sessionID(), *m_cookieManagerProxyObserver);
 }
 
 void HTTPCookieStore::registerForNewProcessPoolNotifications()
@@ -215,7 +215,7 @@ void HTTPCookieStore::registerForNewProcessPoolNotifications()
     ASSERT(!m_processPoolCreationListenerIdentifier);
 
     m_processPoolCreationListenerIdentifier = WebProcessPool::registerProcessPoolCreationListener([this](WebProcessPool& newProcessPool) {
-        if (!m_owningDataStore.isAssociatedProcessPool(newProcessPool))
+        if (!m_owningDataStore->isAssociatedProcessPool(newProcessPool))
             return;
 
         // Now that an associated process pool exists, we need to flush the UI process cookie store
@@ -225,7 +225,7 @@ void HTTPCookieStore::registerForNewProcessPoolNotifications()
 
         if (m_cookieManagerProxyObserver) {
             m_observedCookieManagerProxy = newProcessPool.supplement<WebKit::WebCookieManagerProxy>();
-            m_observedCookieManagerProxy->registerObserver(m_owningDataStore.sessionID(), *m_cookieManagerProxyObserver);
+            m_observedCookieManagerProxy->registerObserver(m_owningDataStore->sessionID(), *m_cookieManagerProxyObserver);
         }
         unregisterForNewProcessPoolNotifications();
     });
@@ -239,16 +239,6 @@ void HTTPCookieStore::unregisterForNewProcessPoolNotifications()
     m_processPoolCreationListenerIdentifier = 0;
 }
 
-void HTTPCookieStore::ref() const
-{
-    m_owningDataStore.ref();
-}
-
-void HTTPCookieStore::deref() const
-{
-    m_owningDataStore.deref();
-}
-
 #if !PLATFORM(COCOA)
 void HTTPCookieStore::flushDefaultUIProcessCookieStore() { }
 Vector<WebCore::Cookie> HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies() { return { }; }
index 7e723cf..df41125 100644 (file)
@@ -74,9 +74,6 @@ public:
     void cookiesDidChange();
     void cookieManagerDestroyed();
 
-    void ref() const;
-    void deref() const;
-    
 private:
     HTTPCookieStore(WebKit::WebsiteDataStore&);
 
@@ -90,7 +87,8 @@ private:
     void startObservingChangesToDefaultUIProcessCookieStore(Function<void()>&&);
     void stopObservingChangesToDefaultUIProcessCookieStore();
     
-    WebKit::WebsiteDataStore& m_owningDataStore;
+    // FIXME: This is a reference cycle.
+    Ref<WebKit::WebsiteDataStore> m_owningDataStore;
     HashSet<Observer*> m_observers;
 
     WebKit::WebCookieManagerProxy* m_observedCookieManagerProxy { nullptr };