[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

beidson at apple.com beidson at apple.com
Fri Jan 21 14:59:32 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit aa40cae6c8f4c1b3d3d0af2f975d602d629c45b3
Author: beidson at apple.com <beidson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 6 01:26:16 2011 +0000

    Part of <rdar://problem/8261624> and https://bugs.webkit.org/show_bug.cgi?id=47355
    Change WebKit2 session restoring to restore the full back/forward list
    
    Reviewed by Sam Weinig.
    
    Add a new message to tell the WebProcess to restore a session state:
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::restoreSession):
    * WebProcess/WebPage/WebPage.h:
    * WebProcess/WebPage/WebPage.messages.in: Add the new message, AND fix the intentional misspellings.
    
    Also, Sam sucks.
    
    Change WebProcess back/forward list item ids to be odd (UIProcess's will be even):
    * WebProcess/WebPage/WebBackForwardListProxy.cpp:
    (WebKit::generateHistoryItemID):
    
    Provide accessors to the entries in the list to pass to the WebProcess:
    * UIProcess/WebBackForwardList.h:
    (WebKit::WebBackForwardList::entries):
    (WebKit::WebBackForwardList::currentIndex):
    
    Add decoding of the saved back/forward list itmes (we already encode them):
    * UIProcess/cf/WebBackForwardListCF.cpp:
    (WebKit::generateWebBackForwardItemID):
    (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation):
    
    Instead of loading the current URL, pass the entire last back to the WebProcess:
    * UIProcess/cf/WebPageProxyCF.cpp:
    (WebKit::WebPageProxy::restoreFromSessionStateData):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75121 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 15a7545..23f5a7a 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,38 @@
 2011-01-05  Brady Eidson  <beidson at apple.com>
 
+        Reviewed by Sam Weinig.
+
+        Part of <rdar://problem/8261624> and https://bugs.webkit.org/show_bug.cgi?id=47355
+        Change WebKit2 session restoring to restore the full back/forward list
+
+        Add a new message to tell the WebProcess to restore a session state:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::restoreSession):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in: Add the new message, AND fix the intentional misspellings.
+        
+        Also, Sam sucks.
+
+        Change WebProcess back/forward list item ids to be odd (UIProcess's will be even):
+        * WebProcess/WebPage/WebBackForwardListProxy.cpp:
+        (WebKit::generateHistoryItemID):
+
+        Provide accessors to the entries in the list to pass to the WebProcess:
+        * UIProcess/WebBackForwardList.h:
+        (WebKit::WebBackForwardList::entries):
+        (WebKit::WebBackForwardList::currentIndex):
+
+        Add decoding of the saved back/forward list itmes (we already encode them):
+        * UIProcess/cf/WebBackForwardListCF.cpp:
+        (WebKit::generateWebBackForwardItemID):
+        (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation):
+
+        Instead of loading the current URL, pass the entire last back to the WebProcess:
+        * UIProcess/cf/WebPageProxyCF.cpp:
+        (WebKit::WebPageProxy::restoreFromSessionStateData):
+
+2011-01-05  Brady Eidson  <beidson at apple.com>
+
         Reviewed by Darin Adler.
 
         https://bugs.webkit.org/show_bug.cgi?id=51953
diff --git a/WebKit2/UIProcess/WebBackForwardList.h b/WebKit2/UIProcess/WebBackForwardList.h
index 48b7498..0e4a33c 100644
--- a/WebKit2/UIProcess/WebBackForwardList.h
+++ b/WebKit2/UIProcess/WebBackForwardList.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -66,7 +66,10 @@ public:
     WebBackForwardListItem* backItem();
     WebBackForwardListItem* forwardItem();
     WebBackForwardListItem* itemAtIndex(int);
+    
+    const BackForwardListItemVector& entries() const { return m_entries; }
 
+    uint32_t currentIndex() { return m_current; }
     int backListCount();
     int forwardListCount();
 
@@ -85,18 +88,10 @@ private:
 
     WebPageProxy* m_page;
     BackForwardListItemVector m_entries;
-    unsigned m_current;
-    unsigned m_capacity;
+    uint32_t m_current;
+    uint32_t m_capacity;
     bool m_closed;
     bool m_enabled;
-    
-// FIXME - <rdar://problem/8261624> and https://bugs.webkit.org/show_bug.cgi?id=47355 - 
-// When we have a solution for restoring the full back/forward list 
-// then causing a load of the current item, we will no longer need this.
-public:
-    const WTF::String& restoredCurrentURL() const { return m_restoredCurrentURL; }
-private:
-    WTF::String m_restoredCurrentURL;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp b/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
index 9b0a437..3f03980 100644
--- a/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
+++ b/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,6 +32,16 @@ using namespace WebCore;
 
 namespace WebKit {
 
+static uint64_t generateWebBackForwardItemID()
+{
+    // These IDs exist in the UIProcess for items created by the UIProcess.
+    // The IDs generated here need to never collide with the IDs created in WebBackForwardListProxy in the WebProcess.
+    // We accomplish this by starting from 2, and only ever using even ids.
+    static uint64_t uniqueHistoryItemID = 0;
+    uniqueHistoryItemID += 2;
+    return uniqueHistoryItemID;
+}
+
 DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryCurrentIndexKey, (CFSTR("SessionHistoryCurrentIndex")));
 DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntriesKey, (CFSTR("SessionHistoryEntries")));
 DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryTitleKey, (CFSTR("SessionHistoryEntryTitle")));
@@ -90,6 +100,8 @@ bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef d
     }
 
     CFIndex size = CFArrayGetCount(cfEntries);
+    BackForwardListItemVector newEntries;
+    newEntries.reserveCapacity(size);
     for (CFIndex i = 0; i < size; ++i) {
         CFDictionaryRef entryDictionary = (CFDictionaryRef)CFArrayGetValueAtIndex(cfEntries, i);
         if (!entryDictionary || CFGetTypeID(entryDictionary) != CFDictionaryGetTypeID()) {
@@ -108,16 +120,24 @@ bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef d
             LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid title", (int)i);
             return false;
         }
-        
-        // FIXME <rdar://problem/8261624> and https://bugs.webkit.org/show_bug.cgi?id=47355 - 
-        // The data for the above entry needs to be added to the full back/forward list.
-        // When we have a solution that restores the full back/forwardlist then causes a load of the current item,
-        // we will no longer need this.
-        if (i == currentIndex) {
-            m_restoredCurrentURL = entryURL;
-            break;
+
+        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;
+        }
+        
+        newEntries.append(WebBackForwardListItem::create(originalURL, entryURL, entryTitle, CFDataGetBytePtr(backForwardData), CFDataGetLength(backForwardData), generateWebBackForwardItemID()));
     }
+    
+    m_current = currentIndex;
+    m_entries = newEntries;
     return true;
 }
 
diff --git a/WebKit2/UIProcess/cf/WebPageProxyCF.cpp b/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
index 72bf8fb..90c5ceb 100644
--- a/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
+++ b/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,8 +26,11 @@
 #include "WebPageProxy.h"
 
 #include "Logging.h"
+#include "SessionState.h"
 #include "WebBackForwardList.h"
 #include "WebData.h"
+#include "WebPageMessages.h"
+#include "WebProcessProxy.h"
 
 #include <wtf/RetainPtr.h>
 #include <CoreFoundation/CFPropertyList.h>
@@ -122,10 +125,8 @@ void WebPageProxy::restoreFromSessionStateData(WebData* webData)
         LOG(SessionState, "Failed to restore back/forward list from SessionHistoryDictionary");
         return;
     }
-
-    // FIXME: When we have a solution for restoring the full back/forward list then causing a load of the current item,
-    // we will trigger that load here.  Until then, we use the "restored current URL" which can later be removed.
-    loadURL(m_backForwardList->restoredCurrentURL());
+    
+    process()->send(Messages::WebPage::RestoreSession(SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex())), m_pageID);
 }
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp b/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
index 8257111..f56be00 100644
--- a/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
+++ b/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
@@ -62,8 +62,12 @@ static HistoryItemToIDMap& historyItemToIDMap()
 
 static uint64_t generateHistoryItemID()
 {
+    // These IDs exist in the WebProcess for items created by the WebProcess.
+    // The IDs generated here need to never collide with the IDs created in WebBackForwardList in the UIProcess.
+    // We accomplish this by starting from 3, and only ever using odd ids.
     static uint64_t uniqueHistoryItemID = 1;
-    return uniqueHistoryItemID++;
+    uniqueHistoryItemID += 2;
+    return uniqueHistoryItemID;
 }
 
 static uint64_t getIDForHistoryItem(HistoryItem* item)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 7b4ab46..938dddd 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -847,6 +847,11 @@ void WebPage::executeEditCommand(const String& commandName)
     executeEditingCommand(commandName, String());
 }
 
+void WebPage::restoreSession(const SessionState&)
+{
+    // FIXME: Implement
+}
+
 #if ENABLE(TOUCH_EVENTS)
 static bool handleTouchEvent(const WebTouchEvent& touchEvent, Page* page)
 {
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index bd6cebd..1c05840 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -81,6 +81,7 @@ class DrawingArea;
 class InjectedBundleBackForwardList;
 class PageOverlay;
 class PluginView;
+class SessionState;
 class WebContextMenu;
 class WebContextMenuItemData;
 class WebEvent;
@@ -336,6 +337,8 @@ private:
     void touchEvent(const WebTouchEvent&);
 #endif
 
+    void restoreSession(const SessionState&);
+
     void setDrawsBackground(bool);
     void setDrawsTransparentBackground(bool);
 
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index 103e3ba..cf65d69 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -46,6 +46,8 @@ messages -> WebPage {
     LoadURLRequest(WebCore::ResourceRequest request, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
     Reload(bool reloadFromOrigin)
     StopLoading()
+    
+    RestoreSession(WebKit::SessionState state)
 
     DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID)
 
@@ -100,7 +102,7 @@ messages -> WebPage {
     DidChooseFilesForOpenPanel(Vector<WTF::String> fileURLs)
     DidCancelForOpenPanel()
 
-    # Speling and grammer.
+    # Spelling and grammar.
     AdvanceToNextMisspelling(bool startBeforeSelection)
     ChangeSpellingToWord(WTF::String word)
     UnmarkAllMisspellings()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list