<!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>[170722] 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/170722">170722</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-07-02 14:13:23 -0700 (Wed, 02 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Store the back forward list item id inside BackForwardListItemState
https://bugs.webkit.org/show_bug.cgi?id=134557

Reviewed by Tim Horton.

* Shared/SessionState.cpp:
(WebKit::BackForwardListItemState::encode):
(WebKit::BackForwardListItemState::decode):
* Shared/SessionState.h:
* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::create):
(WebKit::WebBackForwardListItem::WebBackForwardListItem):
(WebKit::WebBackForwardListItem::encode):
* Shared/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::itemID):
* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::restoreFromState):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::addBackForwardItem):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedSessionStatecpp">trunk/Source/WebKit2/Shared/SessionState.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedSessionStateh">trunk/Source/WebKit2/Shared/SessionState.h</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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170721 => 170722)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-02 21:05:14 UTC (rev 170721)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-02 21:13:23 UTC (rev 170722)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-07-02  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Store the back forward list item id inside BackForwardListItemState
+        https://bugs.webkit.org/show_bug.cgi?id=134557
+
+        Reviewed by Tim Horton.
+
+        * Shared/SessionState.cpp:
+        (WebKit::BackForwardListItemState::encode):
+        (WebKit::BackForwardListItemState::decode):
+        * Shared/SessionState.h:
+        * Shared/WebBackForwardListItem.cpp:
+        (WebKit::WebBackForwardListItem::create):
+        (WebKit::WebBackForwardListItem::WebBackForwardListItem):
+        (WebKit::WebBackForwardListItem::encode):
+        * Shared/WebBackForwardListItem.h:
+        (WebKit::WebBackForwardListItem::itemID):
+        * UIProcess/WebBackForwardList.cpp:
+        (WebKit::WebBackForwardList::restoreFromState):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::addBackForwardItem):
+
</ins><span class="cx"> 2014-07-02  Manuel Rego Casasnovas  &lt;rego@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed. EFL and GTK build fix after r170716.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedSessionStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/SessionState.cpp (170721 => 170722)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/SessionState.cpp        2014-07-02 21:05:14 UTC (rev 170721)
+++ trunk/Source/WebKit2/Shared/SessionState.cpp        2014-07-02 21:13:23 UTC (rev 170722)
</span><span class="lines">@@ -184,11 +184,15 @@
</span><span class="cx"> 
</span><span class="cx"> void BackForwardListItemState::encode(IPC::ArgumentEncoder&amp; encoder) const
</span><span class="cx"> {
</span><ins>+    encoder &lt;&lt; identifier;
</ins><span class="cx">     encoder &lt;&lt; pageState;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool BackForwardListItemState::decode(IPC::ArgumentDecoder&amp; decoder, BackForwardListItemState&amp; result)
</span><span class="cx"> {
</span><ins>+    if (!decoder.decode(result.identifier))
+        return false;
+
</ins><span class="cx">     if (!decoder.decode(result.pageState))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedSessionStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/SessionState.h (170721 => 170722)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/SessionState.h        2014-07-02 21:05:14 UTC (rev 170721)
+++ trunk/Source/WebKit2/Shared/SessionState.h        2014-07-02 21:13:23 UTC (rev 170722)
</span><span class="lines">@@ -117,6 +117,8 @@
</span><span class="cx">     void encode(IPC::ArgumentEncoder&amp;) const;
</span><span class="cx">     static bool decode(IPC::ArgumentDecoder&amp;, BackForwardListItemState&amp;);
</span><span class="cx"> 
</span><ins>+    uint64_t identifier;
+
</ins><span class="cx">     PageState pageState;
</span><span class="cx">     // FIXME: This should hold the snapshot itself, not its UUID.
</span><span class="cx">     String snapshotUUID;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebBackForwardListItemcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebBackForwardListItem.cpp (170721 => 170722)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebBackForwardListItem.cpp        2014-07-02 21:05:14 UTC (rev 170721)
+++ trunk/Source/WebKit2/Shared/WebBackForwardListItem.cpp        2014-07-02 21:13:23 UTC (rev 170722)
</span><span class="lines">@@ -35,28 +35,27 @@
</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(uint64_t itemID, BackForwardListItemState backForwardListItemState)
</del><ins>+PassRefPtr&lt;WebBackForwardListItem&gt; WebBackForwardListItem::create(BackForwardListItemState backForwardListItemState)
</ins><span class="cx"> {
</span><del>-    return adoptRef(new WebBackForwardListItem(itemID, std::move(backForwardListItemState)));
</del><ins>+    return adoptRef(new WebBackForwardListItem(std::move(backForwardListItemState)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebBackForwardListItem::WebBackForwardListItem(uint64_t itemID, BackForwardListItemState backForwardListItemState)
-    : m_itemID(itemID)
-    , m_itemState(std::move(backForwardListItemState))
</del><ins>+WebBackForwardListItem::WebBackForwardListItem(BackForwardListItemState backForwardListItemState)
+    : m_itemState(std::move(backForwardListItemState))
</ins><span class="cx"> {
</span><del>-    if (m_itemID &gt; highestUsedItemID)
-        highestUsedItemID = m_itemID;
</del><ins>+    if (m_itemState.identifier &gt; highestUsedItemID)
+        highestUsedItemID = m_itemState.identifier;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebBackForwardListItem::WebBackForwardListItem(const String&amp; originalURL, const String&amp; url, const String&amp; title, const uint8_t* backForwardData, size_t backForwardDataSize, uint64_t itemID)
</span><del>-    : m_itemID(itemID)
</del><span class="cx"> {
</span><span class="cx">     m_itemState.pageState.mainFrameState.originalURLString = originalURL;
</span><span class="cx">     m_itemState.pageState.mainFrameState.urlString = url;
</span><span class="cx">     m_itemState.pageState.title = title;
</span><ins>+    m_itemState.identifier = itemID;
</ins><span class="cx"> 
</span><del>-    if (m_itemID &gt; highestUsedItemID)
-        highestUsedItemID = m_itemID;
</del><ins>+    if (m_itemState.identifier &gt; highestUsedItemID)
+        highestUsedItemID = m_itemState.identifier;
</ins><span class="cx"> 
</span><span class="cx">     setBackForwardData(backForwardData, backForwardDataSize);
</span><span class="cx"> }
</span><span class="lines">@@ -85,7 +84,7 @@
</span><span class="cx">     encoder &lt;&lt; m_itemState.pageState.mainFrameState.originalURLString;
</span><span class="cx">     encoder &lt;&lt; m_itemState.pageState.mainFrameState.urlString;
</span><span class="cx">     encoder &lt;&lt; m_itemState.pageState.title;
</span><del>-    encoder &lt;&lt; m_itemID;
</del><ins>+    encoder &lt;&lt; m_itemState.identifier;
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;API::Data&gt; backForwardData = this-&gt;backForwardData();
</span><span class="cx">     encoder &lt;&lt; IPC::DataReference(backForwardData-&gt;bytes(), backForwardData-&gt;size());
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebBackForwardListItemh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebBackForwardListItem.h (170721 => 170722)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebBackForwardListItem.h        2014-07-02 21:05:14 UTC (rev 170721)
+++ trunk/Source/WebKit2/Shared/WebBackForwardListItem.h        2014-07-02 21:13:23 UTC (rev 170722)
</span><span class="lines">@@ -44,7 +44,7 @@
</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(uint64_t itemID, BackForwardListItemState);
</del><ins>+    static PassRefPtr&lt;WebBackForwardListItem&gt; create(BackForwardListItemState);
</ins><span class="cx"> 
</span><span class="cx">     static PassRefPtr&lt;WebBackForwardListItem&gt; create(const String&amp; originalURL, const String&amp; url, const String&amp; title, const uint8_t* backForwardData, size_t backForwardDataSize, uint64_t itemID)
</span><span class="cx">     {
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual ~WebBackForwardListItem();
</span><span class="cx"> 
</span><del>-    uint64_t itemID() const { return m_itemID; }
</del><ins>+    uint64_t itemID() const { return m_itemState.identifier; }
</ins><span class="cx">     const BackForwardListItemState&amp; itemState() { return m_itemState; }
</span><span class="cx"> 
</span><span class="cx">     void setPageState(PageState pageState) { m_itemState.pageState = std::move(pageState); }
</span><span class="lines">@@ -79,11 +79,10 @@
</span><span class="cx">     static uint64_t highedUsedItemID();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    WebBackForwardListItem(uint64_t itemID, BackForwardListItemState);
</del><ins>+    explicit WebBackForwardListItem(BackForwardListItemState);
</ins><span class="cx"> 
</span><span class="cx">     WebBackForwardListItem(const String&amp; originalURL, const String&amp; url, const String&amp; title, const uint8_t* backForwardData, size_t backForwardDataSize, uint64_t itemID);
</span><span class="cx"> 
</span><del>-    uint64_t m_itemID;
</del><span class="cx">     BackForwardListItemState m_itemState;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebBackForwardListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp (170721 => 170722)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp        2014-07-02 21:05:14 UTC (rev 170721)
+++ trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp        2014-07-02 21:13:23 UTC (rev 170722)
</span><span class="lines">@@ -409,9 +409,10 @@
</span><span class="cx">     Vector&lt;RefPtr&lt;WebBackForwardListItem&gt;&gt; items;
</span><span class="cx">     items.reserveInitialCapacity(backForwardListState.items.size());
</span><span class="cx"> 
</span><del>-    for (auto&amp; backForwardListItemState : backForwardListState.items)
-        items.uncheckedAppend(WebBackForwardListItem::create(generateWebBackForwardItemID(), std::move(backForwardListItemState)));
-
</del><ins>+    for (auto&amp; backForwardListItemState : backForwardListState.items) {
+        backForwardListItemState.identifier = generateWebBackForwardItemID();
+        items.uncheckedAppend(WebBackForwardListItem::create(std::move(backForwardListItemState)));
+    }
</ins><span class="cx">     m_hasCurrentIndex = !!backForwardListState.currentIndex;
</span><span class="cx">     m_currentIndex = backForwardListState.currentIndex.valueOr(0);
</span><span class="cx">     m_entries = std::move(items);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (170721 => 170722)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2014-07-02 21:05:14 UTC (rev 170721)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2014-07-02 21:13:23 UTC (rev 170722)
</span><span class="lines">@@ -318,8 +318,9 @@
</span><span class="cx">     auto&amp; backForwardListItem = m_backForwardListItemMap.add(itemID, nullptr).iterator-&gt;value;
</span><span class="cx">     if (!backForwardListItem) {
</span><span class="cx">         BackForwardListItemState backForwardListItemState;
</span><ins>+        backForwardListItemState.identifier = itemID;
</ins><span class="cx">         backForwardListItemState.pageState = pageState;
</span><del>-        backForwardListItem = WebBackForwardListItem::create(itemID, std::move(backForwardListItemState));
</del><ins>+        backForwardListItem = WebBackForwardListItem::create(std::move(backForwardListItemState));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>