Title: [210666] trunk/Source/WebKit2
Revision
210666
Author
[email protected]
Date
2017-01-12 09:52:59 -0800 (Thu, 12 Jan 2017)

Log Message

WebBackForwardListProxy should remove restored session history items from PageCache on close.
<https://webkit.org/b/166972>
<rdar://problem/28904157>

Reviewed by Brady Eidson.

Register history item ID's from the UIProcess with the associated-items map
so that we can remove any PageCache entries associated with them immediately
when closing a WebPage.

Otherwise they might not get removed until the next PageCache pruning happens.
This patch is a speculative fix for what looks like it might be weirdness
related to a PageCache entry outliving its originating Page.

* WebProcess/WebPage/WebBackForwardListProxy.cpp:
(WebKit::WebBackForwardListProxy::addItemFromUIProcess):
* WebProcess/WebPage/WebBackForwardListProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::restoreSessionInternal):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (210665 => 210666)


--- trunk/Source/WebKit2/ChangeLog	2017-01-12 17:49:32 UTC (rev 210665)
+++ trunk/Source/WebKit2/ChangeLog	2017-01-12 17:52:59 UTC (rev 210666)
@@ -1,3 +1,25 @@
+2017-01-12  Andreas Kling  <[email protected]>
+
+        WebBackForwardListProxy should remove restored session history items from PageCache on close.
+        <https://webkit.org/b/166972>
+        <rdar://problem/28904157>
+
+        Reviewed by Brady Eidson.
+
+        Register history item ID's from the UIProcess with the associated-items map
+        so that we can remove any PageCache entries associated with them immediately
+        when closing a WebPage.
+
+        Otherwise they might not get removed until the next PageCache pruning happens.
+        This patch is a speculative fix for what looks like it might be weirdness
+        related to a PageCache entry outliving its originating Page.
+
+        * WebProcess/WebPage/WebBackForwardListProxy.cpp:
+        (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
+        * WebProcess/WebPage/WebBackForwardListProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::restoreSessionInternal):
+
 2017-01-12  Michael Catanzaro  <[email protected]>
 
         [GTK] Correct license on WebKitSecurityOrigin headers

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp (210665 => 210666)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp	2017-01-12 17:49:32 UTC (rev 210665)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp	2017-01-12 17:52:59 UTC (rev 210666)
@@ -100,6 +100,8 @@
     ASSERT(!historyItemToIDMap().contains(item.ptr()));
     ASSERT(!idToHistoryItemMap().contains(itemID));
 
+    m_associatedItemIDs.add(itemID);
+
     historyItemToIDMap().set<ItemAndPageID>(item.ptr(), { .itemID = itemID, .pageID = pageID });
     idToHistoryItemMap().set(itemID, item.ptr());
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h (210665 => 210666)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h	2017-01-12 17:49:32 UTC (rev 210665)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h	2017-01-12 17:52:59 UTC (rev 210666)
@@ -41,7 +41,7 @@
     static uint64_t idForItem(WebCore::HistoryItem*);
     static void removeItem(uint64_t itemID);
 
-    static void addItemFromUIProcess(uint64_t itemID, Ref<WebCore::HistoryItem>&&, uint64_t pageID);
+    void addItemFromUIProcess(uint64_t itemID, Ref<WebCore::HistoryItem>&&, uint64_t pageID);
     static void setHighestItemIDFromUIProcess(uint64_t itemID);
     
     void clear();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (210665 => 210666)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-01-12 17:49:32 UTC (rev 210665)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-01-12 17:52:59 UTC (rev 210666)
@@ -115,6 +115,7 @@
 #include <_javascript_Core/APICast.h>
 #include <WebCore/ApplicationCacheStorage.h>
 #include <WebCore/ArchiveResource.h>
+#include <WebCore/BackForwardController.h>
 #include <WebCore/Chrome.h>
 #include <WebCore/CommonVM.h>
 #include <WebCore/ContextMenuController.h>
@@ -2330,7 +2331,7 @@
     for (const auto& itemState : itemStates) {
         auto historyItem = toHistoryItem(itemState.pageState);
         historyItem->setWasRestoredFromSession(restoredByAPIRequest == WasRestoredByAPIRequest::Yes);
-        WebBackForwardListProxy::addItemFromUIProcess(itemState.identifier, WTFMove(historyItem), m_pageID);
+        static_cast<WebBackForwardListProxy*>(corePage()->backForward().client())->addItemFromUIProcess(itemState.identifier, WTFMove(historyItem), m_pageID);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to