Title: [175349] trunk/Source/WebKit2
- Revision
- 175349
- Author
- [email protected]
- Date
- 2014-10-29 15:34:14 -0700 (Wed, 29 Oct 2014)
Log Message
Clear ViewSnapshots when back/forward list items are removed from their list
https://bugs.webkit.org/show_bug.cgi?id=138188
<rdar://problem/18817001>
Reviewed by Tim Horton.
Ideally we should remove the WebBackForwardListItem objects as well, but this is a somewhat safer fix.
Change all the "remove item" codepaths to call WebBackForwardList::didRemoveItem and have it clear out the snapshot.
* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::pageClosed):
(WebKit::WebBackForwardList::addItem):
(WebKit::WebBackForwardList::removeAllItems):
(WebKit::WebBackForwardList::clear):
(WebKit::WebBackForwardList::didRemoveItem):
* UIProcess/WebBackForwardList.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (175348 => 175349)
--- trunk/Source/WebKit2/ChangeLog 2014-10-29 22:01:21 UTC (rev 175348)
+++ trunk/Source/WebKit2/ChangeLog 2014-10-29 22:34:14 UTC (rev 175349)
@@ -1,3 +1,23 @@
+2014-10-29 Anders Carlsson <[email protected]>
+
+ Clear ViewSnapshots when back/forward list items are removed from their list
+ https://bugs.webkit.org/show_bug.cgi?id=138188
+ <rdar://problem/18817001>
+
+ Reviewed by Tim Horton.
+
+ Ideally we should remove the WebBackForwardListItem objects as well, but this is a somewhat safer fix.
+
+ Change all the "remove item" codepaths to call WebBackForwardList::didRemoveItem and have it clear out the snapshot.
+
+ * UIProcess/WebBackForwardList.cpp:
+ (WebKit::WebBackForwardList::pageClosed):
+ (WebKit::WebBackForwardList::addItem):
+ (WebKit::WebBackForwardList::removeAllItems):
+ (WebKit::WebBackForwardList::clear):
+ (WebKit::WebBackForwardList::didRemoveItem):
+ * UIProcess/WebBackForwardList.h:
+
2014-10-29 Tim Horton <[email protected]>
Hide the 'Add to Photos' item if it isn't available
Modified: trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp (175348 => 175349)
--- trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp 2014-10-29 22:01:21 UTC (rev 175348)
+++ trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp 2014-10-29 22:34:14 UTC (rev 175349)
@@ -72,7 +72,8 @@
ASSERT(m_entries[i]);
if (!m_entries[i])
continue;
- m_page->backForwardRemovedItem(m_entries[i]->itemID());
+
+ didRemoveItem(*m_entries[i]);
}
}
@@ -95,7 +96,7 @@
unsigned targetSize = m_currentIndex + 1;
removedItems.reserveCapacity(m_entries.size() - targetSize);
while (m_entries.size() > targetSize) {
- m_page->backForwardRemovedItem(m_entries.last()->itemID());
+ didRemoveItem(*m_entries.last());
removedItems.append(m_entries.last().release());
m_entries.removeLast();
}
@@ -103,7 +104,7 @@
// Toss the first item if the list is getting too big, as long as we're not using it
// (or even if we are, if we only want 1 entry).
if (m_entries.size() == m_capacity && (m_currentIndex || m_capacity == 1)) {
- m_page->backForwardRemovedItem(m_entries[0]->itemID());
+ didRemoveItem(*m_entries[0]);
removedItems.append(m_entries[0].release());
m_entries.remove(0);
@@ -122,7 +123,7 @@
ASSERT(m_entries[i]);
if (!m_entries[i])
continue;
- m_page->backForwardRemovedItem(m_entries[i]->itemID());
+ didRemoveItem(*m_entries[i]);
removedItems.append(m_entries[i].release());
}
m_entries.clear();
@@ -314,7 +315,7 @@
if (!entry)
continue;
- m_page->backForwardRemovedItem(entry->itemID());
+ didRemoveItem(*entry);
removedItems.append(WTF::move(entry));
}
@@ -344,7 +345,7 @@
if (!m_entries[i])
continue;
- m_page->backForwardRemovedItem(m_entries[i]->itemID());
+ didRemoveItem(*m_entries[i]);
removedItems.append(m_entries[i].release());
}
@@ -358,7 +359,7 @@
for (size_t i = 0; i < size; ++i) {
ASSERT(m_entries[i]);
if (m_entries[i] && m_entries[i] != currentItem)
- m_page->backForwardRemovedItem(m_entries[i]->itemID());
+ didRemoveItem(*m_entries[i]);
}
removedItems.reserveCapacity(size - 1);
@@ -429,4 +430,12 @@
return itemStates;
}
+void WebBackForwardList::didRemoveItem(WebBackForwardListItem& backForwardListItem)
+{
+ // FIXME: This should really also delete the item from the map.
+ m_page->backForwardRemovedItem(backForwardListItem.itemID());
+
+ backForwardListItem.setSnapshot(nullptr);
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebBackForwardList.h (175348 => 175349)
--- trunk/Source/WebKit2/UIProcess/WebBackForwardList.h 2014-10-29 22:01:21 UTC (rev 175348)
+++ trunk/Source/WebKit2/UIProcess/WebBackForwardList.h 2014-10-29 22:34:14 UTC (rev 175349)
@@ -80,6 +80,8 @@
private:
explicit WebBackForwardList(WebPageProxy&);
+ void didRemoveItem(WebBackForwardListItem&);
+
WebPageProxy* m_page;
BackForwardListItemVector m_entries;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes