[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 15:07:39 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit fc699e24b99f2d2ed4593375a624693405178213
Author: beidson at apple.com <beidson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 7 16:56:49 2011 +0000

    <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 Darin Adler.
    
    * UIProcess/WebProcessProxy.cpp:
    (WebKit::WebProcessProxy::registerNewWebBackForwardListItem): Let the UIProcess register its own
      WebBackForwardListItems in its ID map upon creation.
    * UIProcess/WebProcessProxy.h:
    
    * UIProcess/cf/WebPageProxyCF.cpp:
    (WebKit::WebPageProxy::restoreFromSessionStateData): Register each new list entry in the
      UIProcess ID map.
    
    * WebProcess/WebPage/WebBackForwardListProxy.cpp:
    (WebKit::WebBackForwardListProxy::addItemFromUIProcess): Add this method to register UIProcess
      created items without doing any of the other work normally associated with adding a new back/forward item
      (such as notifying the UIProcess).
    * WebProcess/WebPage/WebBackForwardListProxy.h:
    
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::restoreSession): Map all of the back/forward list entries from the UIProcess then
      cause a load of the current entry.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75246 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index aba09a3..fc28907 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,29 @@
+2011-01-06  Brady Eidson  <beidson at apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/8261624> and https://bugs.webkit.org/show_bug.cgi?id=47355
+        Change WebKit2 session restoring to restore the full back/forward list.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::registerNewWebBackForwardListItem): Let the UIProcess register its own
+          WebBackForwardListItems in its ID map upon creation.
+        * UIProcess/WebProcessProxy.h:
+
+        * UIProcess/cf/WebPageProxyCF.cpp:
+        (WebKit::WebPageProxy::restoreFromSessionStateData): Register each new list entry in the
+          UIProcess ID map.
+
+        * WebProcess/WebPage/WebBackForwardListProxy.cpp:
+        (WebKit::WebBackForwardListProxy::addItemFromUIProcess): Add this method to register UIProcess
+          created items without doing any of the other work normally associated with adding a new back/forward item
+          (such as notifying the UIProcess).
+        * WebProcess/WebPage/WebBackForwardListProxy.h:
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::restoreSession): Map all of the back/forward list entries from the UIProcess then
+          cause a load of the current entry.
+
 2011-01-06  Adam Roben  <aroben at apple.com>
 
         Always show the arrow cursor when the web process has crashed
diff --git a/WebKit2/UIProcess/WebProcessProxy.cpp b/WebKit2/UIProcess/WebProcessProxy.cpp
index ab8fa78..dcc66aa 100644
--- a/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -184,6 +184,15 @@ WebBackForwardListItem* WebProcessProxy::webBackForwardItem(uint64_t itemID) con
     return m_backForwardListItemMap.get(itemID).get();
 }
 
+void WebProcessProxy::registerNewWebBackForwardListItem(WebBackForwardListItem* item)
+{
+    // This item was just created by the UIProcess and is being added to the map for the first time
+    // so we should not already have an item for this ID.
+    ASSERT(!m_backForwardListItemMap.contains(item->itemID()));
+
+    m_backForwardListItemMap.set(item->itemID(), item);
+}
+
 void WebProcessProxy::addBackForwardItem(uint64_t itemID, const String& originalURL, const String& url, const String& title, const CoreIPC::DataReference& backForwardData)
 {
     std::pair<WebBackForwardListItemMap::iterator, bool> result = m_backForwardListItemMap.add(itemID, 0);
diff --git a/WebKit2/UIProcess/WebProcessProxy.h b/WebKit2/UIProcess/WebProcessProxy.h
index 133f7e9..44ab918 100644
--- a/WebKit2/UIProcess/WebProcessProxy.h
+++ b/WebKit2/UIProcess/WebProcessProxy.h
@@ -104,6 +104,8 @@ public:
 
     void updateTextCheckerState();
 
+    void registerNewWebBackForwardListItem(WebBackForwardListItem*);
+    
 private:
     explicit WebProcessProxy(WebContext*);
 
diff --git a/WebKit2/UIProcess/cf/WebPageProxyCF.cpp b/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
index 90c5ceb..424c56e 100644
--- a/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
+++ b/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
@@ -25,6 +25,7 @@
 
 #include "WebPageProxy.h"
 
+#include "DataReference.h"
 #include "Logging.h"
 #include "SessionState.h"
 #include "WebBackForwardList.h"
@@ -126,6 +127,11 @@ void WebPageProxy::restoreFromSessionStateData(WebData* webData)
         return;
     }
     
+    const BackForwardListItemVector& entries = m_backForwardList->entries();
+    size_t size = entries.size();
+    for (size_t i = 0; i < size; ++i)
+        process()->registerNewWebBackForwardListItem(entries[i].get());
+
     process()->send(Messages::WebPage::RestoreSession(SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex())), m_pageID);
 }
 
diff --git a/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp b/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
index 02bb9aa..d04c84a 100644
--- a/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
+++ b/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
@@ -79,6 +79,21 @@ static void updateBackForwardItem(uint64_t itemID, HistoryItem* item)
         item->originalURLString(), item->urlString(), item->title(), encoder.data()), 0);
 }
 
+void WebBackForwardListProxy::addItemFromUIProcess(uint64_t itemID, PassRefPtr<WebCore::HistoryItem> prpItem)
+{
+    RefPtr<HistoryItem> item = prpItem;
+
+    // UIProcess itemIDs should be even.
+    ASSERT(!(itemID % 2));
+    
+    // This item/itemID pair should not already exist in our maps.
+    ASSERT(!historyItemToIDMap().contains(item.get()));
+    ASSERT(!idToHistoryItemMap().contains(itemID));
+        
+    historyItemToIDMap().set(item, itemID);
+    idToHistoryItemMap().set(itemID, item);
+}
+
 static void WK2NotifyHistoryItemChanged(HistoryItem* item)
 {
     uint64_t itemID = historyItemToIDMap().get(item);
diff --git a/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h b/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h
index b96c761..25c2adb 100644
--- a/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h
+++ b/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.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
@@ -40,6 +40,8 @@ public:
     static WebCore::HistoryItem* itemForID(uint64_t);
     static void removeItem(uint64_t itemID);
 
+    static void addItemFromUIProcess(uint64_t itemID, PassRefPtr<WebCore::HistoryItem>);
+    
     void clear();
 
 private:
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 29a708d..01b6621 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -27,6 +27,7 @@
 
 #include "Arguments.h"
 #include "DataReference.h"
+#include "DecoderAdapter.h"
 #include "DrawingArea.h"
 #include "InjectedBundle.h"
 #include "InjectedBundleBackForwardList.h"
@@ -35,6 +36,9 @@
 #include "PageOverlay.h"
 #include "PluginProxy.h"
 #include "PluginView.h"
+#include "SessionState.h"
+#include "WebBackForwardList.h"
+#include "WebBackForwardListItem.h"
 #include "WebBackForwardListProxy.h"
 #include "WebChromeClient.h"
 #include "WebContextMenu.h"
@@ -850,9 +854,29 @@ void WebPage::executeEditCommand(const String& commandName)
     executeEditingCommand(commandName, String());
 }
 
-void WebPage::restoreSession(const SessionState&)
+void WebPage::restoreSession(const SessionState& sessionState)
 {
-    // FIXME: Implement
+    const BackForwardListItemVector& list = sessionState.list();
+    size_t size = list.size();
+    RefPtr<HistoryItem> currentItem;
+    for (size_t i = 0; i < size; ++i) {
+        WebBackForwardListItem* webItem = list[i].get();
+        DecoderAdapter decoder(webItem->backForwardData().data(), webItem->backForwardData().size());
+        
+        RefPtr<HistoryItem> item = HistoryItem::decodeBackForwardTree(webItem->url(), webItem->title(), webItem->originalURL(), decoder);
+        if (!item) {
+            LOG_ERROR("Failed to decode a HistoryItem from session state data.");
+            return;
+        }
+        
+        if (i == sessionState.currentIndex())
+            currentItem = item;
+        
+        WebBackForwardListProxy::addItemFromUIProcess(list[i]->itemID(), item.release());
+    }    
+    ASSERT(currentItem);
+
+    m_page->goToItem(currentItem.get(), FrameLoadTypeIndexedBackForward);
 }
 
 #if ENABLE(TOUCH_EVENTS)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list