<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170902] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170902">170902</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2014-07-08 16:17:26 -0700 (Tue, 08 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove WebBackForwardListItems when their owning page goes away
https://bugs.webkit.org/show_bug.cgi?id=134709
&lt;rdar://problem/17584645&gt;

Reviewed by Dan Bernstein.

* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::create):
(WebKit::WebBackForwardListItem::WebBackForwardListItem):
* Shared/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::pageID):
Add the associated PageID to the WebBackForwardListItem.

* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::restoreFromState):
Push the current PageID onto the WebBackForwardListItem.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::removeWebPage):
Remove all of the WebBackForwardListItems from m_backForwardListItemMap when
the page they are associated with is removed.

(WebKit::WebProcessProxy::addBackForwardItem):
Push the PageID from the WebProcess onto the WebBackForwardListItem.

* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.messages.in:
* WebProcess/WebPage/WebBackForwardListProxy.cpp:
(WebKit::idToHistoryItemMap):
(WebKit::historyItemToIDMap):
(WebKit::updateBackForwardItem):
(WebKit::WebBackForwardListProxy::addItemFromUIProcess):
(WebKit::WK2NotifyHistoryItemChanged):
(WebKit::WebBackForwardListProxy::idForItem):
(WebKit::WebBackForwardListProxy::addItem):
(WebKit::WebBackForwardListProxy::goToItem):
(WebKit::WebBackForwardListProxy::close):
* WebProcess/WebPage/WebBackForwardListProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::restoreSession):
Keep track of the PageID that back-forward items were created by.
Pass the PageID along when registering WebBackForwardListItems.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebBackForwardListItemcpp">trunk/Source/WebKit2/Shared/WebBackForwardListItem.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebBackForwardListItemh">trunk/Source/WebKit2/Shared/WebBackForwardListItem.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebBackForwardListcpp">trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessProxycpp">trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessProxyh">trunk/Source/WebKit2/UIProcess/WebProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessProxymessagesin">trunk/Source/WebKit2/UIProcess/WebProcessProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebBackForwardListProxycpp">trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebBackForwardListProxyh">trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170901 => 170902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-08 23:11:07 UTC (rev 170901)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-08 23:17:26 UTC (rev 170902)
</span><span class="lines">@@ -1,5 +1,50 @@
</span><span class="cx"> 2014-07-08  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Remove WebBackForwardListItems when their owning page goes away
+        https://bugs.webkit.org/show_bug.cgi?id=134709
+        &lt;rdar://problem/17584645&gt;
+
+        Reviewed by Dan Bernstein.
+
+        * Shared/WebBackForwardListItem.cpp:
+        (WebKit::WebBackForwardListItem::create):
+        (WebKit::WebBackForwardListItem::WebBackForwardListItem):
+        * Shared/WebBackForwardListItem.h:
+        (WebKit::WebBackForwardListItem::pageID):
+        Add the associated PageID to the WebBackForwardListItem.
+
+        * UIProcess/WebBackForwardList.cpp:
+        (WebKit::WebBackForwardList::restoreFromState):
+        Push the current PageID onto the WebBackForwardListItem.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::removeWebPage):
+        Remove all of the WebBackForwardListItems from m_backForwardListItemMap when
+        the page they are associated with is removed.
+
+        (WebKit::WebProcessProxy::addBackForwardItem):
+        Push the PageID from the WebProcess onto the WebBackForwardListItem.
+
+        * UIProcess/WebProcessProxy.h:
+        * UIProcess/WebProcessProxy.messages.in:
+        * WebProcess/WebPage/WebBackForwardListProxy.cpp:
+        (WebKit::idToHistoryItemMap):
+        (WebKit::historyItemToIDMap):
+        (WebKit::updateBackForwardItem):
+        (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
+        (WebKit::WK2NotifyHistoryItemChanged):
+        (WebKit::WebBackForwardListProxy::idForItem):
+        (WebKit::WebBackForwardListProxy::addItem):
+        (WebKit::WebBackForwardListProxy::goToItem):
+        (WebKit::WebBackForwardListProxy::close):
+        * WebProcess/WebPage/WebBackForwardListProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::restoreSession):
+        Keep track of the PageID that back-forward items were created by.
+        Pass the PageID along when registering WebBackForwardListItems.
+
+2014-07-08  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
</ins><span class="cx">         [WK2] Expose a few drawing/compositing settings on WKPreferences(Private)
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=134645
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebBackForwardListItemcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebBackForwardListItem.cpp (170901 => 170902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebBackForwardListItem.cpp        2014-07-08 23:11:07 UTC (rev 170901)
+++ trunk/Source/WebKit2/Shared/WebBackForwardListItem.cpp        2014-07-08 23:17:26 UTC (rev 170902)
</span><span class="lines">@@ -30,13 +30,14 @@
</span><span class="cx"> 
</span><span class="cx"> static uint64_t highestUsedItemID = 0;
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;WebBackForwardListItem&gt; WebBackForwardListItem::create(BackForwardListItemState backForwardListItemState)
</del><ins>+PassRefPtr&lt;WebBackForwardListItem&gt; WebBackForwardListItem::create(BackForwardListItemState backForwardListItemState, uint64_t pageID)
</ins><span class="cx"> {
</span><del>-    return adoptRef(new WebBackForwardListItem(WTF::move(backForwardListItemState)));
</del><ins>+    return adoptRef(new WebBackForwardListItem(WTF::move(backForwardListItemState), pageID));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebBackForwardListItem::WebBackForwardListItem(BackForwardListItemState backForwardListItemState)
</del><ins>+WebBackForwardListItem::WebBackForwardListItem(BackForwardListItemState backForwardListItemState, uint64_t pageID)
</ins><span class="cx">     : m_itemState(WTF::move(backForwardListItemState))
</span><ins>+    , m_pageID(pageID)
</ins><span class="cx"> {
</span><span class="cx">     if (m_itemState.identifier &gt; highestUsedItemID)
</span><span class="cx">         highestUsedItemID = m_itemState.identifier;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebBackForwardListItemh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebBackForwardListItem.h (170901 => 170902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebBackForwardListItem.h        2014-07-08 23:11:07 UTC (rev 170901)
+++ trunk/Source/WebKit2/Shared/WebBackForwardListItem.h        2014-07-08 23:17:26 UTC (rev 170902)
</span><span class="lines">@@ -44,11 +44,12 @@
</span><span class="cx"> 
</span><span class="cx"> class WebBackForwardListItem : public API::ObjectImpl&lt;API::Object::Type::BackForwardListItem&gt; {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;WebBackForwardListItem&gt; create(BackForwardListItemState);
</del><ins>+    static PassRefPtr&lt;WebBackForwardListItem&gt; create(BackForwardListItemState, uint64_t pageID);
</ins><span class="cx">     virtual ~WebBackForwardListItem();
</span><span class="cx"> 
</span><span class="cx">     uint64_t itemID() const { return m_itemState.identifier; }
</span><span class="cx">     const BackForwardListItemState&amp; itemState() { return m_itemState; }
</span><ins>+    uint64_t pageID() const { return m_pageID; }
</ins><span class="cx"> 
</span><span class="cx">     void setPageState(PageState pageState) { m_itemState.pageState = WTF::move(pageState); }
</span><span class="cx"> 
</span><span class="lines">@@ -62,9 +63,10 @@
</span><span class="cx">     static uint64_t highedUsedItemID();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    explicit WebBackForwardListItem(BackForwardListItemState);
</del><ins>+    explicit WebBackForwardListItem(BackForwardListItemState, uint64_t pageID);
</ins><span class="cx"> 
</span><span class="cx">     BackForwardListItemState m_itemState;
</span><ins>+    uint64_t m_pageID;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> typedef Vector&lt;RefPtr&lt;WebBackForwardListItem&gt;&gt; BackForwardListItemVector;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebBackForwardListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp (170901 => 170902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp        2014-07-08 23:11:07 UTC (rev 170901)
+++ trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp        2014-07-08 23:17:26 UTC (rev 170902)
</span><span class="lines">@@ -411,7 +411,7 @@
</span><span class="cx"> 
</span><span class="cx">     for (auto&amp; backForwardListItemState : backForwardListState.items) {
</span><span class="cx">         backForwardListItemState.identifier = generateWebBackForwardItemID();
</span><del>-        items.uncheckedAppend(WebBackForwardListItem::create(WTF::move(backForwardListItemState)));
</del><ins>+        items.uncheckedAppend(WebBackForwardListItem::create(WTF::move(backForwardListItemState), m_page-&gt;pageID()));
</ins><span class="cx">     }
</span><span class="cx">     m_hasCurrentIndex = !!backForwardListState.currentIndex;
</span><span class="cx">     m_currentIndex = backForwardListState.currentIndex.valueOr(0);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (170901 => 170902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2014-07-08 23:11:07 UTC (rev 170901)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2014-07-08 23:17:26 UTC (rev 170902)
</span><span class="lines">@@ -199,6 +199,14 @@
</span><span class="cx"> {
</span><span class="cx">     m_pageMap.remove(pageID);
</span><span class="cx">     globalPageMap().remove(pageID);
</span><ins>+    
+    Vector&lt;uint64_t&gt; itemIDsToRemove;
+    for (auto&amp; idAndItem : m_backForwardListItemMap) {
+        if (idAndItem.value-&gt;pageID() == pageID)
+            itemIDsToRemove.append(idAndItem.key);
+    }
+    for (auto itemID : itemIDsToRemove)
+        m_backForwardListItemMap.remove(itemID);
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     m_processSuppressiblePages.remove(pageID);
</span><span class="lines">@@ -310,7 +318,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-void WebProcessProxy::addBackForwardItem(uint64_t itemID, const PageState&amp; pageState)
</del><ins>+void WebProcessProxy::addBackForwardItem(uint64_t itemID, uint64_t pageID, const PageState&amp; pageState)
</ins><span class="cx"> {
</span><span class="cx">     MESSAGE_CHECK_URL(pageState.mainFrameState.originalURLString);
</span><span class="cx">     MESSAGE_CHECK_URL(pageState.mainFrameState.urlString);
</span><span class="lines">@@ -320,7 +328,7 @@
</span><span class="cx">         BackForwardListItemState backForwardListItemState;
</span><span class="cx">         backForwardListItemState.identifier = itemID;
</span><span class="cx">         backForwardListItemState.pageState = pageState;
</span><del>-        backForwardListItem = WebBackForwardListItem::create(WTF::move(backForwardListItemState));
</del><ins>+        backForwardListItem = WebBackForwardListItem::create(WTF::move(backForwardListItemState), pageID);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (170901 => 170902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h        2014-07-08 23:11:07 UTC (rev 170901)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h        2014-07-08 23:17:26 UTC (rev 170902)
</span><span class="lines">@@ -156,7 +156,7 @@
</span><span class="cx">     void disconnect();
</span><span class="cx"> 
</span><span class="cx">     // IPC message handlers.
</span><del>-    void addBackForwardItem(uint64_t itemID, const PageState&amp;);
</del><ins>+    void addBackForwardItem(uint64_t itemID, uint64_t pageID, const PageState&amp;);
</ins><span class="cx">     void didDestroyFrame(uint64_t);
</span><span class="cx">     
</span><span class="cx">     void shouldTerminate(bool&amp; shouldTerminate);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.messages.in (170901 => 170902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.messages.in        2014-07-08 23:11:07 UTC (rev 170901)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.messages.in        2014-07-08 23:17:26 UTC (rev 170902)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">     DidPerformServerRedirect(uint64_t pageID, String sourceURLString, String destinationURLString, uint64_t frameID)
</span><span class="cx">     DidUpdateHistoryTitle(uint64_t pageID, String title, String url, uint64_t frameID)
</span><span class="cx"> 
</span><del>-    AddBackForwardItem(uint64_t itemID, WebKit::PageState pageState)
</del><ins>+    AddBackForwardItem(uint64_t itemID, uint64_t pageID, WebKit::PageState pageState)
</ins><span class="cx">     DidDestroyFrame(uint64_t frameID) 
</span><span class="cx"> 
</span><span class="cx">     ShouldTerminate() -&gt; (bool shouldTerminate)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebBackForwardListProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp (170901 => 170902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp        2014-07-08 23:11:07 UTC (rev 170901)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp        2014-07-08 23:17:26 UTC (rev 170902)
</span><span class="lines">@@ -45,20 +45,25 @@
</span><span class="cx"> // FIXME &lt;rdar://problem/8819268&gt;: This leaks all HistoryItems that go into these maps.
</span><span class="cx"> // We need to clear up the life time of these objects.
</span><span class="cx"> 
</span><del>-typedef HashMap&lt;uint64_t, RefPtr&lt;HistoryItem&gt;&gt; IDToHistoryItemMap;
-typedef HashMap&lt;RefPtr&lt;HistoryItem&gt;, uint64_t&gt; HistoryItemToIDMap;
</del><ins>+typedef HashMap&lt;uint64_t, RefPtr&lt;HistoryItem&gt;&gt; IDToHistoryItemMap; // &quot;ID&quot; here is the item ID.
+    
+struct ItemAndPageID {
+    uint64_t itemID;
+    uint64_t pageID;
+};
+typedef HashMap&lt;RefPtr&lt;HistoryItem&gt;, ItemAndPageID&gt; HistoryItemToIDMap;
</ins><span class="cx"> 
</span><span class="cx"> static IDToHistoryItemMap&amp; idToHistoryItemMap()
</span><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;IDToHistoryItemMap&gt; map;;
</span><span class="cx">     return map;
</span><del>-} 
</del><ins>+}
</ins><span class="cx"> 
</span><span class="cx"> static HistoryItemToIDMap&amp; historyItemToIDMap()
</span><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;HistoryItemToIDMap&gt; map;
</span><span class="cx">     return map;
</span><del>-} 
</del><ins>+}
</ins><span class="cx"> 
</span><span class="cx"> static uint64_t uniqueHistoryItemID = 1;
</span><span class="cx"> 
</span><span class="lines">@@ -82,30 +87,30 @@
</span><span class="cx">          uniqueHistoryItemID = itemID + 1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void updateBackForwardItem(uint64_t itemID, HistoryItem* item)
</del><ins>+static void updateBackForwardItem(uint64_t itemID, uint64_t pageID, HistoryItem* item)
</ins><span class="cx"> {
</span><del>-    WebProcess::shared().parentProcessConnection()-&gt;send(Messages::WebProcessProxy::AddBackForwardItem(itemID, toPageState(*item)), 0);
</del><ins>+    WebProcess::shared().parentProcessConnection()-&gt;send(Messages::WebProcessProxy::AddBackForwardItem(itemID, pageID, toPageState(*item)), 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebBackForwardListProxy::addItemFromUIProcess(uint64_t itemID, PassRefPtr&lt;WebCore::HistoryItem&gt; prpItem)
</del><ins>+void WebBackForwardListProxy::addItemFromUIProcess(uint64_t itemID, PassRefPtr&lt;WebCore::HistoryItem&gt; prpItem, uint64_t pageID)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;HistoryItem&gt; item = prpItem;
</span><span class="cx">     
</span><span class="cx">     // This item/itemID pair should not already exist in our maps.
</span><span class="cx">     ASSERT(!historyItemToIDMap().contains(item.get()));
</span><span class="cx">     ASSERT(!idToHistoryItemMap().contains(itemID));
</span><del>-        
-    historyItemToIDMap().set(item, itemID);
</del><ins>+
+    historyItemToIDMap().set&lt;ItemAndPageID&gt;(item, { .itemID = itemID, .pageID = pageID });
</ins><span class="cx">     idToHistoryItemMap().set(itemID, item);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void WK2NotifyHistoryItemChanged(HistoryItem* item)
</span><span class="cx"> {
</span><del>-    uint64_t itemID = historyItemToIDMap().get(item);
-    if (!itemID)
</del><ins>+    ItemAndPageID ids = historyItemToIDMap().get(item);
+    if (!ids.itemID)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    updateBackForwardItem(itemID, item);
</del><ins>+    updateBackForwardItem(ids.itemID, ids.pageID, item);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HistoryItem* WebBackForwardListProxy::itemForID(uint64_t itemID)
</span><span class="lines">@@ -116,7 +121,7 @@
</span><span class="cx"> uint64_t WebBackForwardListProxy::idForItem(HistoryItem* item)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(item);
</span><del>-    return historyItemToIDMap().get(item);
</del><ins>+    return historyItemToIDMap().get(item).itemID;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebBackForwardListProxy::removeItem(uint64_t itemID)
</span><span class="lines">@@ -150,10 +155,10 @@
</span><span class="cx"> 
</span><span class="cx">     m_associatedItemIDs.add(itemID);
</span><span class="cx"> 
</span><del>-    historyItemToIDMap().set(item, itemID);
</del><ins>+    historyItemToIDMap().set&lt;ItemAndPageID&gt;(item, { .itemID = itemID, .pageID = m_page-&gt;pageID() });
</ins><span class="cx">     idToHistoryItemMap().set(itemID, item);
</span><span class="cx"> 
</span><del>-    updateBackForwardItem(itemID, item.get());
</del><ins>+    updateBackForwardItem(itemID, m_page-&gt;pageID(), item.get());
</ins><span class="cx">     m_page-&gt;send(Messages::WebPageProxy::BackForwardAddItem(itemID));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -163,7 +168,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     SandboxExtension::Handle sandboxExtensionHandle;
</span><del>-    m_page-&gt;sendSync(Messages::WebPageProxy::BackForwardGoToItem(historyItemToIDMap().get(item)), Messages::WebPageProxy::BackForwardGoToItem::Reply(sandboxExtensionHandle));
</del><ins>+    m_page-&gt;sendSync(Messages::WebPageProxy::BackForwardGoToItem(historyItemToIDMap().get(item).itemID), Messages::WebPageProxy::BackForwardGoToItem::Reply(sandboxExtensionHandle));
</ins><span class="cx">     m_page-&gt;sandboxExtensionTracker().beginLoad(m_page-&gt;mainWebFrame(), sandboxExtensionHandle);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -214,7 +219,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_associatedItemIDs.clear();
</span><span class="cx"> 
</span><del>-    m_page = 0;
</del><ins>+    m_page = nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool WebBackForwardListProxy::isActive()
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebBackForwardListProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h (170901 => 170902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h        2014-07-08 23:11:07 UTC (rev 170901)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h        2014-07-08 23:17:26 UTC (rev 170902)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx">     static uint64_t idForItem(WebCore::HistoryItem*);
</span><span class="cx">     static void removeItem(uint64_t itemID);
</span><span class="cx"> 
</span><del>-    static void addItemFromUIProcess(uint64_t itemID, PassRefPtr&lt;WebCore::HistoryItem&gt;);
</del><ins>+    static void addItemFromUIProcess(uint64_t itemID, PassRefPtr&lt;WebCore::HistoryItem&gt;, uint64_t pageID);
</ins><span class="cx">     static void setHighestItemIDFromUIProcess(uint64_t itemID);
</span><span class="cx">     
</span><span class="cx">     void clear();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (170901 => 170902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-07-08 23:11:07 UTC (rev 170901)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-07-08 23:17:26 UTC (rev 170902)
</span><span class="lines">@@ -1964,7 +1964,7 @@
</span><span class="cx"> void WebPage::restoreSession(const Vector&lt;BackForwardListItemState&gt;&amp; itemStates)
</span><span class="cx"> {
</span><span class="cx">     for (const auto&amp; itemState : itemStates)
</span><del>-        WebBackForwardListProxy::addItemFromUIProcess(itemState.identifier, toHistoryItem(itemState.pageState));
</del><ins>+        WebBackForwardListProxy::addItemFromUIProcess(itemState.identifier, toHistoryItem(itemState.pageState), m_pageID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span></span></pre>
</div>
</div>

</body>
</html>