<!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>[170719] 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/170719">170719</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-07-02 13:43:17 -0700 (Wed, 02 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Begin ripping out the old session state code
https://bugs.webkit.org/show_bug.cgi?id=134556
Reviewed by Andreas Kling.
* UIProcess/WebBackForwardList.h:
* UIProcess/WebPageProxy.h:
* UIProcess/cf/WebBackForwardListCF.cpp: Removed.
* UIProcess/cf/WebPageProxyCF.cpp:
(WebKit::WebPageProxy::sessionStateData): Deleted.
(WebKit::WebPageProxy::restoreFromSessionStateData): Deleted.
* WebKit2.xcodeproj/project.pbxproj:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebBackForwardListh">trunk/Source/WebKit2/UIProcess/WebBackForwardList.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcesscfWebPageProxyCFcpp">trunk/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcesscfWebBackForwardListCFcpp">trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170718 => 170719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-02 20:29:42 UTC (rev 170718)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-02 20:43:17 UTC (rev 170719)
</span><span class="lines">@@ -1,5 +1,20 @@
</span><span class="cx"> 2014-07-02 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><ins>+ Begin ripping out the old session state code
+ https://bugs.webkit.org/show_bug.cgi?id=134556
+
+ Reviewed by Andreas Kling.
+
+ * UIProcess/WebBackForwardList.h:
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/cf/WebBackForwardListCF.cpp: Removed.
+ * UIProcess/cf/WebPageProxyCF.cpp:
+ (WebKit::WebPageProxy::sessionStateData): Deleted.
+ (WebKit::WebPageProxy::restoreFromSessionStateData): Deleted.
+ * WebKit2.xcodeproj/project.pbxproj:
+
+2014-07-02 Anders Carlsson <andersca@apple.com>
+
</ins><span class="cx"> Use legacy state coding directly in WKWebView
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=134553
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebBackForwardListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebBackForwardList.h (170718 => 170719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebBackForwardList.h        2014-07-02 20:29:42 UTC (rev 170718)
+++ trunk/Source/WebKit2/UIProcess/WebBackForwardList.h        2014-07-02 20:43:17 UTC (rev 170719)
</span><span class="lines">@@ -72,13 +72,6 @@
</span><span class="cx"> PassRefPtr<API::Array> backListAsAPIArrayWithLimit(unsigned limit) const;
</span><span class="cx"> PassRefPtr<API::Array> forwardListAsAPIArrayWithLimit(unsigned limit) const;
</span><span class="cx">
</span><del>-#if USE(CF)
- CFDictionaryRef createCFDictionaryRepresentation(std::function<bool (WebBackForwardListItem&)>) const;
- bool restoreFromCFDictionaryRepresentation(CFDictionaryRef);
- bool restoreFromV0CFDictionaryRepresentation(CFDictionaryRef);
- bool restoreFromV1CFDictionaryRepresentation(CFDictionaryRef);
-#endif
-
</del><span class="cx"> BackForwardListState backForwardListState(const std::function<bool (WebBackForwardListItem&)>&) const;
</span><span class="cx"> void restoreFromState(BackForwardListState);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (170718 => 170719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-07-02 20:29:42 UTC (rev 170718)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-07-02 20:43:17 UTC (rev 170719)
</span><span class="lines">@@ -551,8 +551,6 @@
</span><span class="cx"> void terminateProcess();
</span><span class="cx">
</span><span class="cx"> SessionState sessionState(const std::function<bool (WebBackForwardListItem&)>& = nullptr) const;
</span><del>- PassRefPtr<API::Data> sessionStateData(std::function<bool (WebBackForwardListItem&)>) const;
- uint64_t restoreFromSessionStateData(API::Data*);
</del><span class="cx"> uint64_t restoreFromSessionState(SessionState);
</span><span class="cx">
</span><span class="cx"> bool supportsTextZoom() const;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcesscfWebBackForwardListCFcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp (170718 => 170719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp        2014-07-02 20:29:42 UTC (rev 170718)
+++ trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp        2014-07-02 20:43:17 UTC (rev 170719)
</span><span class="lines">@@ -1,323 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010, 2011, 2012, 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 "config.h"
-#include "WebBackForwardList.h"
-
-#include "APIData.h"
-#include "Logging.h"
-#include <CoreFoundation/CoreFoundation.h>
-#include <wtf/NeverDestroyed.h>
-#include <wtf/RetainPtr.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-uint64_t generateWebBackForwardItemID();
-
-static CFNumberRef sessionHistoryCurrentVersion()
-{
- static CFIndex currentVersionAsCFIndex = 1;
- return CFNumberCreate(0, kCFNumberCFIndexType, &currentVersionAsCFIndex);
-}
-
-static CFStringRef sessionHistoryVersionKey = CFSTR("SessionHistoryVersion");
-static CFStringRef sessionHistoryCurrentIndexKey = CFSTR("SessionHistoryCurrentIndex");
-static CFStringRef sessionHistoryEntriesKey = CFSTR("SessionHistoryEntries");
-static CFStringRef sessionHistoryEntryTitleKey = CFSTR("SessionHistoryEntryTitle");
-static CFStringRef sessionHistoryEntryURLKey = CFSTR("SessionHistoryEntryURL");
-static CFStringRef sessionHistoryEntryOriginalURLKey = CFSTR("SessionHistoryEntryOriginalURL");
-static CFStringRef sessionHistoryEntryDataKey = CFSTR("SessionHistoryEntryData");
-static CFStringRef sessionHistoryEntrySnapshotUUIDKey = CFSTR("SessionHistoryEntrySnapshotUUID");
-
-static bool extractBackForwardListEntriesFromArray(CFArrayRef, BackForwardListItemVector&);
-
-static CFDictionaryRef createEmptySessionHistoryDictionary()
-{
- static const void* keys[1] = { sessionHistoryVersionKey };
- static const void* values[1] = { sessionHistoryCurrentVersion() };
-
- return CFDictionaryCreate(0, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-}
-
-CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(std::function<bool (WebBackForwardListItem&)> filter) const
-{
- ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
-
- if (!m_hasCurrentIndex) {
- // We represent having no current index by writing out an empty dictionary (besides the version).
- return createEmptySessionHistoryDictionary();
- }
-
- RetainPtr<CFMutableArrayRef> entries = adoptCF(CFArrayCreateMutable(0, m_entries.size(), &kCFTypeArrayCallBacks));
-
- // We may need to update the current index to account for entries that are filtered by the callback.
- CFIndex currentIndex = m_currentIndex;
- bool hasCurrentIndex = true;
-
- for (size_t i = 0; i < m_entries.size(); ++i) {
- // If we somehow ended up with a null entry then we should consider the data invalid and not save session history at all.
- ASSERT(m_entries[i]);
- if (!m_entries[i]) {
- LOG(SessionState, "WebBackForwardList contained a null entry at index %lu", i);
- return 0;
- }
-
- if (filter && !filter(*m_entries[i])) {
- if (i <= m_currentIndex)
- currentIndex--;
- continue;
- }
-
- RetainPtr<CFStringRef> url = m_entries[i]->url().createCFString();
- RetainPtr<CFStringRef> title = m_entries[i]->title().createCFString();
- RetainPtr<CFStringRef> originalURL = m_entries[i]->originalURL().createCFString();
- RetainPtr<CFStringRef> uuid = m_entries[i]->snapshotUUID().createCFString();
-
- // FIXME: This uses the IPC data encoding format, which means that whenever we change the IPC encoding we need to bump the CurrentSessionStateDataVersion
- // constant in WebPageProxyCF.cpp. The IPC data format is meant to be an implementation detail, and not something that should be written to disk.
- RefPtr<API::Data> backForwardData = m_entries[i]->backForwardData();
- RetainPtr<CFDataRef> entryData = adoptCF(CFDataCreate(kCFAllocatorDefault, backForwardData->bytes(), backForwardData->size()));
-
- const void* keys[5] = { sessionHistoryEntryURLKey, sessionHistoryEntryTitleKey, sessionHistoryEntryOriginalURLKey, sessionHistoryEntryDataKey, sessionHistoryEntrySnapshotUUIDKey };
- const void* values[5] = { url.get(), title.get(), originalURL.get(), entryData.get(), uuid.get() };
-
- RetainPtr<CFDictionaryRef> entryDictionary = adoptCF(CFDictionaryCreate(0, keys, values, 5, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
- CFArrayAppendValue(entries.get(), entryDictionary.get());
- }
-
- ASSERT(currentIndex == -1 || (currentIndex > -1 && currentIndex < CFArrayGetCount(entries.get())));
- if (currentIndex < -1 || currentIndex >= CFArrayGetCount(entries.get())) {
- LOG(SessionState, "Filtering entries to be saved resulted in an inconsistent state that we cannot represent");
- return 0;
- }
-
- // If we have an index and all items before and including the current item were filtered then currentIndex will be -1.
- // In this case the new current index should point at the first item.
- // It's also possible that all items were filtered so we should represent not having a current index.
- if (currentIndex == -1) {
- if (CFArrayGetCount(entries.get()))
- currentIndex = 0;
- else
- hasCurrentIndex = false;
- }
-
- if (hasCurrentIndex) {
- RetainPtr<CFNumberRef> currentIndexNumber = adoptCF(CFNumberCreate(0, kCFNumberCFIndexType, &currentIndex));
- const void* keys[3] = { sessionHistoryVersionKey, sessionHistoryCurrentIndexKey, sessionHistoryEntriesKey };
- const void* values[3] = { sessionHistoryCurrentVersion(), currentIndexNumber.get(), entries.get() };
-
- return CFDictionaryCreate(0, keys, values, 3, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
- }
-
- // We represent having no current index by writing out an empty dictionary (besides the version).
- return createEmptySessionHistoryDictionary();
-}
-
-bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef dictionary)
-{
- CFNumberRef cfVersion = (CFNumberRef)CFDictionaryGetValue(dictionary, sessionHistoryVersionKey);
- if (!cfVersion) {
- // v0 session history dictionaries did not contain versioning
- return restoreFromV0CFDictionaryRepresentation(dictionary);
- }
-
- if (CFGetTypeID(cfVersion) != CFNumberGetTypeID()) {
- LOG(SessionState, "WebBackForwardList dictionary representation contains a version that is not a number");
- return false;
- }
-
- CFIndex version;
- if (!CFNumberGetValue(cfVersion, kCFNumberCFIndexType, &version)) {
- LOG(SessionState, "WebBackForwardList dictionary representation does not have a correctly typed current version");
- return false;
- }
-
- if (version == 1)
- return restoreFromV1CFDictionaryRepresentation(dictionary);
-
- LOG(SessionState, "WebBackForwardList dictionary representation has an invalid current version (%ld)", version);
- return false;
-}
-
-bool WebBackForwardList::restoreFromV0CFDictionaryRepresentation(CFDictionaryRef dictionary)
-{
- CFNumberRef cfIndex = (CFNumberRef)CFDictionaryGetValue(dictionary, sessionHistoryCurrentIndexKey);
- if (!cfIndex || CFGetTypeID(cfIndex) != CFNumberGetTypeID()) {
- LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid current index");
- return false;
- }
-
- CFIndex currentCFIndex;
- if (!CFNumberGetValue(cfIndex, kCFNumberCFIndexType, &currentCFIndex)) {
- LOG(SessionState, "WebBackForwardList dictionary representation does not have a correctly typed current index");
- return false;
- }
-
- if (currentCFIndex < -1) {
- LOG(SessionState, "WebBackForwardList dictionary representation contains an unexpected negative current index (%ld)", currentCFIndex);
- return false;
- }
-
- CFArrayRef cfEntries = (CFArrayRef)CFDictionaryGetValue(dictionary, sessionHistoryEntriesKey);
- if (!cfEntries || CFGetTypeID(cfEntries) != CFArrayGetTypeID()) {
- LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid list of entries");
- return false;
- }
-
- CFIndex size = CFArrayGetCount(cfEntries);
- if (size < 0 || currentCFIndex >= size) {
- LOG(SessionState, "WebBackForwardList dictionary representation contains an invalid current index (%ld) for the number of entries (%ld)", currentCFIndex, size);
- return false;
- }
-
- // Version 0 session history relied on currentIndex == -1 to represent the same thing as not having a current index.
- bool hasCurrentIndex = currentCFIndex != -1;
-
- if (!hasCurrentIndex && size) {
- LOG(SessionState, "WebBackForwardList dictionary representation says there is no current index, but there is a list of %ld entries", size);
- return false;
- }
-
- BackForwardListItemVector entries;
- if (!extractBackForwardListEntriesFromArray(cfEntries, entries)) {
- // extractBackForwardListEntriesFromArray has already logged the appropriate error message.
- return false;
- }
-
- ASSERT(entries.size() == static_cast<unsigned>(size));
-
- m_hasCurrentIndex = hasCurrentIndex;
- m_currentIndex = m_hasCurrentIndex ? static_cast<uint32_t>(currentCFIndex) : 0;
- m_entries = entries;
-
- return true;
-}
-
-bool WebBackForwardList::restoreFromV1CFDictionaryRepresentation(CFDictionaryRef dictionary)
-{
- CFNumberRef cfIndex = (CFNumberRef)CFDictionaryGetValue(dictionary, sessionHistoryCurrentIndexKey);
- if (!cfIndex) {
- // No current index means the dictionary represents an empty session.
- m_hasCurrentIndex = false;
- m_currentIndex = 0;
- m_entries.clear();
-
- return true;
- }
-
- if (CFGetTypeID(cfIndex) != CFNumberGetTypeID()) {
- LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid current index");
- return false;
- }
-
- CFIndex currentCFIndex;
- if (!CFNumberGetValue(cfIndex, kCFNumberCFIndexType, &currentCFIndex)) {
- LOG(SessionState, "WebBackForwardList dictionary representation does not have a correctly typed current index");
- return false;
- }
-
- if (currentCFIndex < 0) {
- LOG(SessionState, "WebBackForwardList dictionary representation contains an unexpected negative current index (%ld)", currentCFIndex);
- return false;
- }
-
- CFArrayRef cfEntries = (CFArrayRef)CFDictionaryGetValue(dictionary, sessionHistoryEntriesKey);
- if (!cfEntries || CFGetTypeID(cfEntries) != CFArrayGetTypeID()) {
- LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid list of entries");
- return false;
- }
-
- CFIndex size = CFArrayGetCount(cfEntries);
- if (currentCFIndex >= size) {
- LOG(SessionState, "WebBackForwardList dictionary representation contains an invalid current index (%ld) for the number of entries (%ld)", currentCFIndex, size);
- return false;
- }
-
- BackForwardListItemVector entries;
- if (!extractBackForwardListEntriesFromArray(cfEntries, entries)) {
- // extractBackForwardListEntriesFromArray has already logged the appropriate error message.
- return false;
- }
-
- ASSERT(entries.size() == static_cast<unsigned>(size));
-
- m_hasCurrentIndex = true;
- m_currentIndex = static_cast<uint32_t>(currentCFIndex);
- m_entries = entries;
-
- return true;
-}
-
-static bool extractBackForwardListEntriesFromArray(CFArrayRef cfEntries, BackForwardListItemVector& entries)
-{
- CFIndex size = CFArrayGetCount(cfEntries);
-
- entries.reserveCapacity(size);
- for (CFIndex i = 0; i < size; ++i) {
- CFDictionaryRef entryDictionary = (CFDictionaryRef)CFArrayGetValueAtIndex(cfEntries, i);
- if (!entryDictionary || CFGetTypeID(entryDictionary) != CFDictionaryGetTypeID()) {
- LOG(SessionState, "WebBackForwardList entry array does not have a valid entry at index %i", (int)i);
- return false;
- }
-
- CFStringRef entryURL = (CFStringRef)CFDictionaryGetValue(entryDictionary, sessionHistoryEntryURLKey);
- if (!entryURL || CFGetTypeID(entryURL) != CFStringGetTypeID()) {
- LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid URL", (int)i);
- return false;
- }
-
- CFStringRef entryTitle = (CFStringRef)CFDictionaryGetValue(entryDictionary, sessionHistoryEntryTitleKey);
- if (!entryTitle || CFGetTypeID(entryTitle) != CFStringGetTypeID()) {
- LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid title", (int)i);
- return false;
- }
-
- CFStringRef originalURL = (CFStringRef)CFDictionaryGetValue(entryDictionary, sessionHistoryEntryOriginalURLKey);
- if (!originalURL || CFGetTypeID(originalURL) != CFStringGetTypeID()) {
- LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid original URL", (int)i);
- return false;
- }
-
- CFDataRef backForwardData = (CFDataRef)CFDictionaryGetValue(entryDictionary, sessionHistoryEntryDataKey);
- if (!backForwardData || CFGetTypeID(backForwardData) != CFDataGetTypeID()) {
- LOG(SessionState, "WebBackForwardList entry at index %i does not have back/forward data", (int)i);
- return false;
- }
-
- auto item = WebBackForwardListItem::create(originalURL, entryURL, entryTitle, CFDataGetBytePtr(backForwardData), CFDataGetLength(backForwardData), generateWebBackForwardItemID());
-
- CFStringRef snapshotUUID = (CFStringRef)CFDictionaryGetValue(entryDictionary, sessionHistoryEntrySnapshotUUIDKey);
- if (snapshotUUID && CFGetTypeID(snapshotUUID) == CFStringGetTypeID())
- item->setSnapshotUUID(snapshotUUID);
-
- entries.append(item);
- }
-
- return true;
-}
-
-} // namespace WebKit
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcesscfWebPageProxyCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp (170718 => 170719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp        2014-07-02 20:29:42 UTC (rev 170718)
+++ trunk/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp        2014-07-02 20:43:17 UTC (rev 170719)
</span><span class="lines">@@ -26,14 +26,6 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "WebPageProxy.h"
</span><span class="cx">
</span><del>-#include "APIData.h"
-#include "DataReference.h"
-#include "LegacySessionState.h"
-#include "Logging.h"
-#include "WebBackForwardList.h"
-#include "WebPageMessages.h"
-#include "WebProcessProxy.h"
-#include <CoreFoundation/CFPropertyList.h>
</del><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="cx"> #include <wtf/cf/TypeCasts.h>
</span><span class="cx">
</span><span class="lines">@@ -41,148 +33,6 @@
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><del>-static CFStringRef sessionHistoryKey = CFSTR("SessionHistory");
-static CFStringRef provisionalURLKey = CFSTR("ProvisionalURL");
-
-static const UInt32 CurrentSessionStateDataVersion = 2;
-
-PassRefPtr<API::Data> WebPageProxy::sessionStateData(std::function<bool (WebBackForwardListItem&)> filter) const
-{
- const void* keys[2];
- const void* values[2];
- CFIndex numValues = 0;
-
- RetainPtr<CFDictionaryRef> sessionHistoryDictionary = adoptCF(m_backForwardList->createCFDictionaryRepresentation(std::move(filter)));
- if (sessionHistoryDictionary) {
- keys[numValues] = sessionHistoryKey;
- values[numValues] = sessionHistoryDictionary.get();
- ++numValues;
- }
-
- RetainPtr<CFStringRef> provisionalURLString;
- if (m_mainFrame) {
- String provisionalURL = m_pageLoadState.pendingAPIRequestURL();
- if (provisionalURL.isEmpty())
- provisionalURL = m_mainFrame->provisionalURL();
- if (!provisionalURL.isEmpty()) {
- provisionalURLString = provisionalURL.createCFString();
- keys[numValues] = provisionalURLKey;
- values[numValues] = provisionalURLString.get();
- ++numValues;
- }
- }
-
- if (!numValues)
- return 0;
-
- RetainPtr<CFDictionaryRef> stateDictionary = adoptCF(CFDictionaryCreate(0, keys, values, numValues, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
-
- RetainPtr<CFWriteStreamRef> writeStream = adoptCF(CFWriteStreamCreateWithAllocatedBuffers(0, 0));
- if (!writeStream)
- return 0;
-
- if (!CFWriteStreamOpen(writeStream.get()))
- return 0;
-
- if (!CFPropertyListWrite(stateDictionary.get(), writeStream.get(), kCFPropertyListBinaryFormat_v1_0, 0, 0))
- return 0;
-
- RetainPtr<CFDataRef> stateCFData = adoptCF((CFDataRef)CFWriteStreamCopyProperty(writeStream.get(), kCFStreamPropertyDataWritten));
-
- CFIndex length = CFDataGetLength(stateCFData.get());
- Vector<unsigned char> stateVector(length + sizeof(UInt32));
-
- // Put the session state version number at the start of the buffer
- stateVector.data()[0] = (CurrentSessionStateDataVersion & 0xFF000000) >> 24;
- stateVector.data()[1] = (CurrentSessionStateDataVersion & 0x00FF0000) >> 16;
- stateVector.data()[2] = (CurrentSessionStateDataVersion & 0x0000FF00) >> 8;
- stateVector.data()[3] = (CurrentSessionStateDataVersion & 0x000000FF);
-
- // Copy in the actual session state data
- CFDataGetBytes(stateCFData.get(), CFRangeMake(0, length), stateVector.data() + sizeof(UInt32));
-
- return API::Data::create(stateVector);
-}
-
-uint64_t WebPageProxy::restoreFromSessionStateData(API::Data* apiData)
-{
- if (!apiData || apiData->size() < sizeof(UInt32))
- return 0;
-
- const unsigned char* buffer = apiData->bytes();
- UInt32 versionHeader = (buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3];
-
- if (versionHeader != CurrentSessionStateDataVersion) {
- LOG(SessionState, "Unrecognized version header for session state data - cannot restore");
- return 0;
- }
-
- RetainPtr<CFDataRef> data = adoptCF(CFDataCreate(0, apiData->bytes() + sizeof(UInt32), apiData->size() - sizeof(UInt32)));
-
- CFErrorRef propertyListError = 0;
- auto propertyList = adoptCF(CFPropertyListCreateWithData(0, data.get(), kCFPropertyListImmutable, 0, &propertyListError));
- if (propertyListError) {
- CFRelease(propertyListError);
- LOG(SessionState, "Could not read session state property list");
- return 0;
- }
-
- if (!propertyList)
- return 0;
-
- if (CFGetTypeID(propertyList.get()) != CFDictionaryGetTypeID()) {
- LOG(SessionState, "SessionState property list is not a CFDictionaryRef (%i) - its CFTypeID is %i", (int)CFDictionaryGetTypeID(), (int)CFGetTypeID(propertyList.get()));
- return 0;
- }
-
- CFDictionaryRef backForwardListDictionary = 0;
- if (CFTypeRef value = CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), sessionHistoryKey)) {
- if (CFGetTypeID(value) != CFDictionaryGetTypeID())
- LOG(SessionState, "SessionState dictionary has a SessionHistory key, but the value is not a dictionary");
- else
- backForwardListDictionary = static_cast<CFDictionaryRef>(value);
- }
-
- CFStringRef provisionalURL = 0;
- if (CFTypeRef value = CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), provisionalURLKey)) {
- if (CFGetTypeID(value) != CFStringGetTypeID())
- LOG(SessionState, "SessionState dictionary has a ProvisionalValue key, but the value is not a string");
- else
- provisionalURL = static_cast<CFStringRef>(value);
- }
-
- auto transaction = m_pageLoadState.transaction();
-
- if (backForwardListDictionary) {
- if (!m_backForwardList->restoreFromCFDictionaryRepresentation(backForwardListDictionary))
- LOG(SessionState, "Failed to restore back/forward list from SessionHistory dictionary");
- else {
- const BackForwardListItemVector& entries = m_backForwardList->entries();
- if (size_t size = entries.size()) {
- for (size_t i = 0; i < size; ++i)
- process().registerNewWebBackForwardListItem(entries[i].get());
-
- LegacySessionState state(m_backForwardList->entries(), m_backForwardList->currentIndex());
- if (provisionalURL)
- process().send(Messages::WebPage::RestoreSession(state), m_pageID);
- else {
- if (WebBackForwardListItem* item = m_backForwardList->currentItem())
- m_pageLoadState.setPendingAPIRequestURL(transaction, item->url());
-
- uint64_t navigationID = generateNavigationID();
- process().send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem(navigationID, state), m_pageID);
- return navigationID;
- }
- }
- }
- }
-
- if (provisionalURL)
- return loadRequest(URL(URL(), provisionalURL));
-
- return 0;
-}
-
</del><span class="cx"> static RetainPtr<CFStringRef> autosaveKey(const String& name)
</span><span class="cx"> {
</span><span class="cx"> return String("com.apple.WebKit.searchField:" + name).createCFString();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (170718 => 170719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-07-02 20:29:42 UTC (rev 170718)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-07-02 20:43:17 UTC (rev 170719)
</span><span class="lines">@@ -933,7 +933,6 @@
</span><span class="cx">                 51ACBBA1127A8F2C00D203B9 /* WebContextMenuProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */; };
</span><span class="cx">                 51B15A8413843A3900321AD8 /* EnvironmentUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B15A8213843A3900321AD8 /* EnvironmentUtilities.cpp */; };
</span><span class="cx">                 51B15A8513843A3900321AD8 /* EnvironmentUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */; };
</span><del>-                51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */; };
</del><span class="cx">                 51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */; };
</span><span class="cx">                 51BA24441858EE3000EA2811 /* AsyncTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BA24431858EE3000EA2811 /* AsyncTask.h */; };
</span><span class="cx">                 51BA24461858F55D00EA2811 /* WebCrossThreadCopier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51BA24451858F41500EA2811 /* WebCrossThreadCopier.cpp */; };
</span><span class="lines">@@ -2952,7 +2951,6 @@
</span><span class="cx">                 51ACC9351628064800342550 /* NetworkProcessMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkProcessMessages.h; sourceTree = "<group>"; };
</span><span class="cx">                 51B15A8213843A3900321AD8 /* EnvironmentUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EnvironmentUtilities.cpp; path = unix/EnvironmentUtilities.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EnvironmentUtilities.h; path = unix/EnvironmentUtilities.h; sourceTree = "<group>"; };
</span><del>-                51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebBackForwardListCF.cpp; path = cf/WebBackForwardListCF.cpp; sourceTree = "<group>"; };
</del><span class="cx">                 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPageProxyCF.cpp; path = cf/WebPageProxyCF.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 51BA24431858EE3000EA2811 /* AsyncTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncTask.h; sourceTree = "<group>"; };
</span><span class="cx">                 51BA24451858F41500EA2811 /* WebCrossThreadCopier.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebCrossThreadCopier.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -5379,7 +5377,6 @@
</span><span class="cx">                 51B3004D12529CF5000B5CA0 /* cf */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */,
</del><span class="cx">                                 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */,
</span><span class="cx">                         );
</span><span class="cx">                         name = cf;
</span><span class="lines">@@ -9065,7 +9062,6 @@
</span><span class="cx">                                 512A9769180E09B80039A149 /* DatabaseProcessProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 C5E1AFEE16B21025006CC1F2 /* APIWebArchiveResource.cpp in Sources */,
</span><span class="cx">                                 BC72BA1D11E64907001EB4EA /* WebBackForwardList.cpp in Sources */,
</span><del>-                                51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */,
</del><span class="cx">                                 1AC133741857C21E00F3EC05 /* APIGeometry.cpp in Sources */,
</span><span class="cx">                                 518D2CAD12D5153B003BB93B /* WebBackForwardListItem.cpp in Sources */,
</span><span class="cx">                                 BC72B9FA11E6476B001EB4EA /* WebBackForwardListProxy.cpp in Sources */,
</span></span></pre>
</div>
</div>
</body>
</html>