<!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>[170378] trunk/Source</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/170378">170378</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-06-24 12:18:49 -0700 (Tue, 24 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add PageState to HistoryItem conversion code
https://bugs.webkit.org/show_bug.cgi?id=134259

Reviewed by Andreas Kling.

Source/WebKit2:
* Shared/SessionState.h:
* UIProcess/mac/LegacySessionStateCoding.cpp:
(WebKit::decodeBackForwardTreeNode):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/SessionStateConversion.cpp: Added.
(WebKit::toFormData):
(WebKit::applyFrameState):
(WebKit::toHistoryItem):
* WebProcess/WebCoreSupport/SessionStateConversion.h: Added.

Source/WTF:
* wtf/Optional.h:
(WTF::Optional::valueOr):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfOptionalh">trunk/Source/WTF/wtf/Optional.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedSessionStateh">trunk/Source/WebKit2/Shared/SessionState.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacLegacySessionStateCodingcpp">trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportSessionStateConversioncpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportSessionStateConversionh">trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (170377 => 170378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-06-24 19:09:11 UTC (rev 170377)
+++ trunk/Source/WTF/ChangeLog        2014-06-24 19:18:49 UTC (rev 170378)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-06-24  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Add PageState to HistoryItem conversion code
+        https://bugs.webkit.org/show_bug.cgi?id=134259
+
+        Reviewed by Andreas Kling.
+
+        * wtf/Optional.h:
+        (WTF::Optional::valueOr):
+
</ins><span class="cx"> 2014-06-24  László Langó  &lt;llango.u-szeged@partner.samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [JavaScriptCore] Enable concurrent JIT on EFL.
</span></span></pre></div>
<a id="trunkSourceWTFwtfOptionalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Optional.h (170377 => 170378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Optional.h        2014-06-24 19:09:11 UTC (rev 170377)
+++ trunk/Source/WTF/wtf/Optional.h        2014-06-24 19:18:49 UTC (rev 170378)
</span><span class="lines">@@ -161,6 +161,15 @@
</span><span class="cx">         return m_value;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    template&lt;typename U&gt;
+    T valueOr(U&amp;&amp; value) const
+    {
+        if (m_isEngaged)
+            return m_value;
+
+        return std::forward&lt;U&gt;(value);
+    }
+
</ins><span class="cx"> private:
</span><span class="cx">     bool m_isEngaged;
</span><span class="cx">     union {
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170377 => 170378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-24 19:09:11 UTC (rev 170377)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-24 19:18:49 UTC (rev 170378)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-06-24  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Add PageState to HistoryItem conversion code
+        https://bugs.webkit.org/show_bug.cgi?id=134259
+
+        Reviewed by Andreas Kling.
+
+        * Shared/SessionState.h:
+        * UIProcess/mac/LegacySessionStateCoding.cpp:
+        (WebKit::decodeBackForwardTreeNode):
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/SessionStateConversion.cpp: Added.
+        (WebKit::toFormData):
+        (WebKit::applyFrameState):
+        (WebKit::toHistoryItem):
+        * WebProcess/WebCoreSupport/SessionStateConversion.h: Added.
+
</ins><span class="cx"> 2014-06-24  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Only flush layers when the exposed rect actually changes
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedSessionStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/SessionState.h (170377 => 170378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/SessionState.h        2014-06-24 19:09:11 UTC (rev 170377)
+++ trunk/Source/WebKit2/Shared/SessionState.h        2014-06-24 19:18:49 UTC (rev 170378)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx">     String target;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;String&gt; documentState;
</span><del>-    Vector&lt;uint8_t&gt; stateObjectData;
</del><ins>+    Optional&lt;Vector&lt;uint8_t&gt;&gt; stateObjectData;
</ins><span class="cx"> 
</span><span class="cx">     int64_t documentSequenceNumber;
</span><span class="cx">     int64_t itemSequenceNumber;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacLegacySessionStateCodingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp (170377 => 170378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp        2014-06-24 19:09:11 UTC (rev 170377)
+++ trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp        2014-06-24 19:18:49 UTC (rev 170378)
</span><span class="lines">@@ -552,9 +552,13 @@
</span><span class="cx">     bool hasStateObject;
</span><span class="cx">     decoder &gt;&gt; hasStateObject;
</span><span class="cx"> 
</span><del>-    if (hasStateObject)
-        decoder &gt;&gt; frameState.stateObjectData;
</del><ins>+    if (hasStateObject) {
+        Vector&lt;uint8_t&gt; stateObjectData;
+        decoder &gt;&gt; stateObjectData;
</ins><span class="cx"> 
</span><ins>+        frameState.stateObjectData = std::move(stateObjectData);
+    }
+
</ins><span class="cx">     decoder &gt;&gt; frameState.target;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (170377 => 170378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-06-24 19:09:11 UTC (rev 170377)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-06-24 19:18:49 UTC (rev 170378)
</span><span class="lines">@@ -263,6 +263,8 @@
</span><span class="cx">                 1A6FBA2B11E6862700DB1371 /* NetscapeBrowserFuncs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FBA2911E6862700DB1371 /* NetscapeBrowserFuncs.cpp */; };
</span><span class="cx">                 1A6FBD2811E69BC200DB1371 /* NetscapePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FBD2611E69BC200DB1371 /* NetscapePlugin.h */; };
</span><span class="cx">                 1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FBD2711E69BC200DB1371 /* NetscapePlugin.cpp */; };
</span><ins>+                1A7284471959ED100007BCE5 /* SessionStateConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7284451959ED100007BCE5 /* SessionStateConversion.h */; };
+                1A7284481959F8040007BCE5 /* SessionStateConversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7284441959ED100007BCE5 /* SessionStateConversion.cpp */; };
</ins><span class="cx">                 1A7865B916CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7865B716CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp */; };
</span><span class="cx">                 1A7865BA16CAC71500ACE83A /* PluginProcessConnectionManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7865B816CAC71500ACE83A /* PluginProcessConnectionManagerMessages.h */; };
</span><span class="cx">                 1A7C6CDA1378950800B9C04D /* EnvironmentVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7C6CD81378950800B9C04D /* EnvironmentVariables.cpp */; };
</span><span class="lines">@@ -2212,6 +2214,8 @@
</span><span class="cx">                 1A6FBA2911E6862700DB1371 /* NetscapeBrowserFuncs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapeBrowserFuncs.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A6FBD2611E69BC200DB1371 /* NetscapePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapePlugin.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A6FBD2711E69BC200DB1371 /* NetscapePlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePlugin.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                1A7284441959ED100007BCE5 /* SessionStateConversion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SessionStateConversion.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1A7284451959ED100007BCE5 /* SessionStateConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionStateConversion.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1A7865B616CAC6FD00ACE83A /* PluginProcessConnectionManager.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = PluginProcessConnectionManager.messages.in; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A7865B716CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessConnectionManagerMessageReceiver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A7865B816CAC71500ACE83A /* PluginProcessConnectionManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessConnectionManagerMessages.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5631,6 +5635,8 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 2D28F3DF1885CCB4004B9EAE /* ios */,
</span><span class="cx">                                 BC111ADE112F5B9A00337BAB /* mac */,
</span><ins>+                                1A7284441959ED100007BCE5 /* SessionStateConversion.cpp */,
+                                1A7284451959ED100007BCE5 /* SessionStateConversion.h */,
</ins><span class="cx">                                 CEDA12DE152CCAE800D9E08D /* WebAlternativeTextClient.h */,
</span><span class="cx">                                 BC111A53112F4FBB00337BAB /* WebChromeClient.cpp */,
</span><span class="cx">                                 BC032D6010F4378D0058C15A /* WebChromeClient.h */,
</span><span class="lines">@@ -6995,6 +7001,7 @@
</span><span class="cx">                                 1AF459321946559500F9D4A2 /* WKError.h in Headers */,
</span><span class="cx">                                 E19BDA8A193686A400B97F57 /* SandboxUtilities.h in Headers */,
</span><span class="cx">                                 1A9F28111958F478008CAC72 /* WKBackForwardListPrivate.h in Headers */,
</span><ins>+                                1A7284471959ED100007BCE5 /* SessionStateConversion.h in Headers */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span><span class="lines">@@ -9096,6 +9103,7 @@
</span><span class="cx">                                 C5237F6012441CA300780472 /* WebEditorClientMac.mm in Sources */,
</span><span class="cx">                                 BC575613126E0138006F0F12 /* APIError.cpp in Sources */,
</span><span class="cx">                                 BC111AE0112F5BC200337BAB /* WebErrorsMac.mm in Sources */,
</span><ins>+                                1A7284481959F8040007BCE5 /* SessionStateConversion.cpp in Sources */,
</ins><span class="cx">                                 1AFA3AC818E61C61003CCBAE /* WKUserContentController.mm in Sources */,
</span><span class="cx">                                 C0337DAE127A24FE008FF4F4 /* WebEvent.cpp in Sources */,
</span><span class="cx">                                 BC032DBA10F4380F0058C15A /* WebEventConversion.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportSessionStateConversioncpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp (0 => 170378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp        2014-06-24 19:18:49 UTC (rev 170378)
</span><span class="lines">@@ -0,0 +1,103 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;SessionStateConversion.h&quot;
+
+#include &quot;SessionState.h&quot;
+#include &lt;WebCore/BlobData.h&gt;
+#include &lt;WebCore/FormData.h&gt;
+#include &lt;WebCore/HistoryItem.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static PassRefPtr&lt;FormData&gt; toFormData(const HTTPBody&amp; httpBody)
+{
+    RefPtr&lt;FormData&gt; formData = FormData::create();
+
+    for (const auto&amp; element : httpBody.elements) {
+        switch (element.type) {
+        case HTTPBody::Element::Type::Data:
+            formData-&gt;appendData(element.data.data(), element.data.size());
+            break;
+
+        case HTTPBody::Element::Type::File:
+            formData-&gt;appendFileRange(element.filePath, element.fileStart, element.fileLength.valueOr(BlobDataItem::toEndOfFile), element.expectedFileModificationTime.valueOr(invalidFileTime()));
+            break;
+
+        case HTTPBody::Element::Type::Blob:
+            formData-&gt;appendBlob(URL(URL(), element.blobURLString));
+            break;
+        }
+    }
+
+    return formData.release();
+}
+
+static void applyFrameState(HistoryItem&amp; historyItem, const FrameState&amp; frameState)
+{
+    historyItem.setOriginalURLString(frameState.originalURLString);
+    historyItem.setReferrer(frameState.referrer);
+    historyItem.setTarget(frameState.target);
+
+    historyItem.setDocumentState(frameState.documentState);
+
+    if (frameState.stateObjectData) {
+        Vector&lt;uint8_t&gt; stateObjectData = frameState.stateObjectData.value();
+        historyItem.setStateObject(SerializedScriptValue::adopt(stateObjectData));
+    }
+
+    historyItem.setDocumentSequenceNumber(frameState.documentSequenceNumber);
+    historyItem.setItemSequenceNumber(frameState.itemSequenceNumber);
+
+    historyItem.setScrollPoint(frameState.scrollPoint);
+    historyItem.setPageScaleFactor(frameState.pageScaleFactor);
+
+    if (frameState.httpBody) {
+        const auto&amp; httpBody = frameState.httpBody.value();
+        historyItem.setFormContentType(httpBody.contentType);
+
+        historyItem.setFormData(toFormData(httpBody));
+    }
+
+    for (const auto&amp; childFrameState : frameState.children) {
+        RefPtr&lt;HistoryItem&gt; childHistoryItem = HistoryItem::create(childFrameState.urlString, String());
+        applyFrameState(*childHistoryItem, childFrameState);
+
+        historyItem.addChildItem(childHistoryItem.release());
+    }
+}
+
+PassRefPtr&lt;HistoryItem&gt; toHistoryItem(const PageState&amp; pageState)
+{
+    RefPtr&lt;HistoryItem&gt; historyItem = HistoryItem::create(pageState.mainFrameState.urlString, pageState.title);
+    applyFrameState(*historyItem, pageState.mainFrameState);
+
+    return historyItem.release();
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportSessionStateConversionh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.h (0 => 170378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.h        2014-06-24 19:18:49 UTC (rev 170378)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SessionStateConversion_h
+#define SessionStateConversion_h
+
+#include &lt;wtf/Forward.h&gt;
+
+namespace WebCore {
+class HistoryItem;
+};
+
+namespace WebKit {
+
+struct PageState;
+
+PassRefPtr&lt;WebCore::HistoryItem&gt; toHistoryItem(const PageState&amp;);
+
+} // namespace WebKit
+
+#endif // SessionStateConversion_h
</ins></span></pre>
</div>
</div>

</body>
</html>