Title: [170719] trunk/Source/WebKit2
Revision
170719
Author
[email protected]
Date
2014-07-02 13:43:17 -0700 (Wed, 02 Jul 2014)

Log Message

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:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (170718 => 170719)


--- 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)
@@ -1,5 +1,20 @@
 2014-07-02  Anders Carlsson  <[email protected]>
 
+        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  <[email protected]>
+
         Use legacy state coding directly in WKWebView
         https://bugs.webkit.org/show_bug.cgi?id=134553
 

Modified: trunk/Source/WebKit2/UIProcess/WebBackForwardList.h (170718 => 170719)


--- 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)
@@ -72,13 +72,6 @@
     PassRefPtr<API::Array> backListAsAPIArrayWithLimit(unsigned limit) const;
     PassRefPtr<API::Array> forwardListAsAPIArrayWithLimit(unsigned limit) const;
 
-#if USE(CF)
-    CFDictionaryRef createCFDictionaryRepresentation(std::function<bool (WebBackForwardListItem&)>) const;
-    bool restoreFromCFDictionaryRepresentation(CFDictionaryRef);
-    bool restoreFromV0CFDictionaryRepresentation(CFDictionaryRef);
-    bool restoreFromV1CFDictionaryRepresentation(CFDictionaryRef);
-#endif
-
     BackForwardListState backForwardListState(const std::function<bool (WebBackForwardListItem&)>&) const;
     void restoreFromState(BackForwardListState);
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (170718 => 170719)


--- 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)
@@ -551,8 +551,6 @@
     void terminateProcess();
 
     SessionState sessionState(const std::function<bool (WebBackForwardListItem&)>& = nullptr) const;
-    PassRefPtr<API::Data> sessionStateData(std::function<bool (WebBackForwardListItem&)>) const;
-    uint64_t restoreFromSessionStateData(API::Data*);
     uint64_t restoreFromSessionState(SessionState);
 
     bool supportsTextZoom() const;

Deleted: trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp (170718 => 170719)


--- 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)
@@ -1,323 +0,0 @@
-/*
- * 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 = ""
-        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

Modified: trunk/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp (170718 => 170719)


--- 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)
@@ -26,14 +26,6 @@
 #include "config.h"
 #include "WebPageProxy.h"
 
-#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>
 #include <wtf/RetainPtr.h>
 #include <wtf/cf/TypeCasts.h>
 
@@ -41,148 +33,6 @@
 
 namespace WebKit {
 
-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 = "" 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;
-}
-
 static RetainPtr<CFStringRef> autosaveKey(const String& name)
 {
     return String("com.apple.WebKit.searchField:" + name).createCFString();

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (170718 => 170719)


--- 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)
@@ -933,7 +933,6 @@
 		51ACBBA1127A8F2C00D203B9 /* WebContextMenuProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */; };
 		51B15A8413843A3900321AD8 /* EnvironmentUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B15A8213843A3900321AD8 /* EnvironmentUtilities.cpp */; };
 		51B15A8513843A3900321AD8 /* EnvironmentUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */; };
-		51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */; };
 		51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */; };
 		51BA24441858EE3000EA2811 /* AsyncTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BA24431858EE3000EA2811 /* AsyncTask.h */; };
 		51BA24461858F55D00EA2811 /* WebCrossThreadCopier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51BA24451858F41500EA2811 /* WebCrossThreadCopier.cpp */; };
@@ -2952,7 +2951,6 @@
 		51ACC9351628064800342550 /* NetworkProcessMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkProcessMessages.h; sourceTree = "<group>"; };
 		51B15A8213843A3900321AD8 /* EnvironmentUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EnvironmentUtilities.cpp; path = unix/EnvironmentUtilities.cpp; sourceTree = "<group>"; };
 		51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EnvironmentUtilities.h; path = unix/EnvironmentUtilities.h; sourceTree = "<group>"; };
-		51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebBackForwardListCF.cpp; path = cf/WebBackForwardListCF.cpp; sourceTree = "<group>"; };
 		51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPageProxyCF.cpp; path = cf/WebPageProxyCF.cpp; sourceTree = "<group>"; };
 		51BA24431858EE3000EA2811 /* AsyncTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncTask.h; sourceTree = "<group>"; };
 		51BA24451858F41500EA2811 /* WebCrossThreadCopier.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebCrossThreadCopier.cpp; sourceTree = "<group>"; };
@@ -5379,7 +5377,6 @@
 		51B3004D12529CF5000B5CA0 /* cf */ = {
 			isa = PBXGroup;
 			children = (
-				51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */,
 				51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */,
 			);
 			name = cf;
@@ -9065,7 +9062,6 @@
 				512A9769180E09B80039A149 /* DatabaseProcessProxyMessageReceiver.cpp in Sources */,
 				C5E1AFEE16B21025006CC1F2 /* APIWebArchiveResource.cpp in Sources */,
 				BC72BA1D11E64907001EB4EA /* WebBackForwardList.cpp in Sources */,
-				51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */,
 				1AC133741857C21E00F3EC05 /* APIGeometry.cpp in Sources */,
 				518D2CAD12D5153B003BB93B /* WebBackForwardListItem.cpp in Sources */,
 				BC72B9FA11E6476B001EB4EA /* WebBackForwardListProxy.cpp in Sources */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to