[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 11:11:42 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7b77c6b9b7423df3af2af06c59c988d502075fb6
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 14 22:44:08 2010 +0000

    Patch for https://bugs.webkit.org/show_bug.cgi?id=42297
    <rdar://problem/8187355>
    Make titles in WebBackForwardListItems work.
    
    Reviewed by Darin Adler.
    
    - Make WebBackForwardListItemMap per WebProcessProxy to allow updating
      them separate from a page. They are conceptually per process anyway.
    - Add a message to add or update a WebBackForwardListItemMap triggered
      by the WebCore::notifyHistoryItemChanged mechanism.
    
    * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h:
    (WebProcessProxyMessage::):
    Add AddOrUpdateBackForwardItem message.
    
    * UIProcess/WebBackForwardListItem.h:
    (WebKit::WebBackForwardListItem::setOriginalURL):
    (WebKit::WebBackForwardListItem::setURL):
    (WebKit::WebBackForwardListItem::setTitle):
    Add setters.
    
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::didReceiveMessage):
    BackForwardAddItem now assumes the item has already been created, so
    now just forwards the add message onto the WebBackForwardList.
    
    (WebKit::WebPageProxy::addItemToBackForwardList): Take a WebBackForwardList instead of an ID.
    (WebKit::WebPageProxy::goToItemInBackForwardList): Ditto.
    * UIProcess/WebPageProxy.h: Ditto.
    
    * UIProcess/WebProcessProxy.cpp:
    (WebKit::WebProcessProxy::webBackForwardItem):
    (WebKit::WebProcessProxy::addOrUpdateBackForwardListItem):
    (WebKit::WebProcessProxy::didReceiveMessage):
    (WebKit::WebProcessProxy::didReceiveSyncMessage):
    * UIProcess/WebProcessProxy.h:
    Have the WebProcessProxy manage the WebBackForwardListItems.
    
    * WebProcess/WebPage/WebBackForwardListProxy.cpp:
    (WebKit::updateBackForwardItem):
    (WebKit::WK2NotifyHistoryItemChanged): Use this to notify UIProcess
    of HistoryItem changes (such as the title being added).
    (WebKit::WebBackForwardListProxy::WebBackForwardListProxy):
    Register the notifyHistoryItemChanged function.
    (WebKit::WebBackForwardListProxy::addItem):
    Just send the ID as the updateBackForwardItem is already going to have
    been called by this time.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63362 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 80011a8..5265d19 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,53 @@
+2010-07-14  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        Patch for https://bugs.webkit.org/show_bug.cgi?id=42297
+        <rdar://problem/8187355>
+        Make titles in WebBackForwardListItems work.
+
+        - Make WebBackForwardListItemMap per WebProcessProxy to allow updating
+          them separate from a page. They are conceptually per process anyway.
+        - Add a message to add or update a WebBackForwardListItemMap triggered
+          by the WebCore::notifyHistoryItemChanged mechanism.
+
+        * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h:
+        (WebProcessProxyMessage::):
+        Add AddOrUpdateBackForwardItem message.
+
+        * UIProcess/WebBackForwardListItem.h:
+        (WebKit::WebBackForwardListItem::setOriginalURL):
+        (WebKit::WebBackForwardListItem::setURL):
+        (WebKit::WebBackForwardListItem::setTitle):
+        Add setters.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveMessage):
+        BackForwardAddItem now assumes the item has already been created, so
+        now just forwards the add message onto the WebBackForwardList.
+
+        (WebKit::WebPageProxy::addItemToBackForwardList): Take a WebBackForwardList instead of an ID.
+        (WebKit::WebPageProxy::goToItemInBackForwardList): Ditto.
+        * UIProcess/WebPageProxy.h: Ditto.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::webBackForwardItem):
+        (WebKit::WebProcessProxy::addOrUpdateBackForwardListItem):
+        (WebKit::WebProcessProxy::didReceiveMessage):
+        (WebKit::WebProcessProxy::didReceiveSyncMessage):
+        * UIProcess/WebProcessProxy.h:
+        Have the WebProcessProxy manage the WebBackForwardListItems.
+
+        * WebProcess/WebPage/WebBackForwardListProxy.cpp:
+        (WebKit::updateBackForwardItem):
+        (WebKit::WK2NotifyHistoryItemChanged): Use this to notify UIProcess
+        of HistoryItem changes (such as the title being added).
+        (WebKit::WebBackForwardListProxy::WebBackForwardListProxy):
+        Register the notifyHistoryItemChanged function.
+        (WebKit::WebBackForwardListProxy::addItem):
+        Just send the ID as the updateBackForwardItem is already going to have
+        been called by this time.
+
 2010-07-14  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h
index bf15016..8d7a187 100644
--- a/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h
+++ b/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h
@@ -33,9 +33,10 @@
 namespace WebProcessProxyMessage {
 
 enum Kind {
-    PostMessage,
+    AddBackForwardItem,
+    GetPluginHostConnection,
     GetPlugins,
-    GetPluginHostConnection
+    PostMessage,
 };
 
 }
diff --git a/WebKit2/UIProcess/WebBackForwardListItem.h b/WebKit2/UIProcess/WebBackForwardListItem.h
index c4e4102..99bb95f 100644
--- a/WebKit2/UIProcess/WebBackForwardListItem.h
+++ b/WebKit2/UIProcess/WebBackForwardListItem.h
@@ -44,8 +44,13 @@ public:
 
     uint64_t itemID() const { return m_itemID; }
 
+    void setOriginalURL(const WebCore::String& originalURL) { m_originalURL = originalURL; }
     const WebCore::String& originalURL() const { return m_originalURL; }
+
+    void setURL(const WebCore::String& url) { m_url = url; }
     const WebCore::String& url() const { return m_url; }
+
+    void setTitle(const WebCore::String& title) { m_title = title; }
     const WebCore::String& title() const { return m_title; }
 
 private:
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 4070dcb..e1204dc 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -583,12 +583,9 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
         }
         case WebPageProxyMessage::BackForwardAddItem: {
             uint64_t itemID;
-            String originalURLString;
-            String urlString;
-            String title;
-            if (!arguments.decode(CoreIPC::Out(itemID, originalURLString, urlString, title)))
+            if (!arguments.decode(CoreIPC::Out(itemID)))
                 return;
-            addItemToBackForwardList(itemID, originalURLString, urlString, title);
+            addItemToBackForwardList(process()->webBackForwardItem(itemID));
             break;
         }
         default:
@@ -817,22 +814,13 @@ void WebPageProxy::didUpdateHistoryTitle(WebFrameProxy* frame, const String& tit
 
 // BackForwardList
 
-void WebPageProxy::addItemToBackForwardList(uint64_t itemID, const String& originalURLString, const String& urlString, const String& title)
+void WebPageProxy::addItemToBackForwardList(WebBackForwardListItem* item)
 {
-    std::pair<HashMap<uint64_t, RefPtr<WebBackForwardListItem> >::iterator, bool> result = m_backForwardListItemMap.add(itemID, 0);
-    if (result.second)
-        result.first->second = WebBackForwardListItem::create(originalURLString, urlString, title, itemID);
-
-    ASSERT(result.first->second->originalURL() == originalURLString);
-    ASSERT(result.first->second->url() == urlString);
-    ASSERT(result.first->second->title() == title);
-
-    m_backForwardList->addItem(result.first->second.get());
+    m_backForwardList->addItem(item);
 }
 
-void WebPageProxy::goToItemInBackForwardList(uint64_t itemID)
+void WebPageProxy::goToItemInBackForwardList(WebBackForwardListItem* item)
 {
-    WebBackForwardListItem* item = m_backForwardListItemMap.get(itemID).get();
     m_backForwardList->goToItem(item);
 }
 
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index ca88206..447626a 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -186,8 +186,8 @@ private:
     void didPerformServerRedirect(WebFrameProxy*, const WebCore::String& sourceURLString, const WebCore::String& destinationURLString);
     void didUpdateHistoryTitle(WebFrameProxy*, const WebCore::String& title, const WebCore::String& url);
 
-    void addItemToBackForwardList(uint64_t itemID, const WebCore::String& originalURLString, const WebCore::String& urlString, const WebCore::String& title);
-    void goToItemInBackForwardList(uint64_t itemID);
+    void addItemToBackForwardList(WebBackForwardListItem*);
+    void goToItemInBackForwardList(WebBackForwardListItem*);
 
     void takeFocus(bool direction);
     void setToolTip(const WebCore::String&);
@@ -227,7 +227,6 @@ private:
     bool m_canGoBack;
     bool m_canGoForward;
     RefPtr<WebBackForwardList> m_backForwardList;
-    HashMap<uint64_t, RefPtr<WebBackForwardListItem> > m_backForwardListItemMap;
 
     WebCore::String m_toolTip;
 
diff --git a/WebKit2/UIProcess/WebProcessProxy.cpp b/WebKit2/UIProcess/WebProcessProxy.cpp
index e924f82..da79393 100644
--- a/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -27,6 +27,7 @@
 
 #include "PluginInfoStore.h"
 #include "ProcessLauncher.h"
+#include "WebBackForwardListItem.h"
 #include "WebContext.h"
 #include "WebPageNamespace.h"
 #include "WebPageProxy.h"
@@ -156,6 +157,11 @@ size_t WebProcessProxy::numberOfPages()
     return m_pageMap.size();
 }
 
+WebBackForwardListItem* WebProcessProxy::webBackForwardItem(uint64_t itemID) const
+{
+    return m_backForwardListItemMap.get(itemID).get();
+}
+
 void WebProcessProxy::forwardMessageToWebContext(const String& message)
 {
     m_context->didRecieveMessageFromInjectedBundle(message);
@@ -179,6 +185,21 @@ void WebProcessProxy::getPluginHostConnection(const String& mimeType, const KURL
     pluginPath = plugin.path;
 }
 
+void WebProcessProxy::addOrUpdateBackForwardListItem(uint64_t itemID, const String& originalURL, const String& url, const String& title)
+{
+    std::pair<WebBackForwardListItemMap::iterator, bool> result = m_backForwardListItemMap.add(itemID, 0);
+    if (result.second) {
+        // New item.
+        result.first->second = WebBackForwardListItem::create(originalURL, url, title, itemID);
+        return;
+    }
+
+    // Update existing item.
+    result.first->second->setOriginalURL(originalURL);
+    result.first->second->setURL(url);
+    result.first->second->setTitle(title);
+}
+
 void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
 {
     if (messageID.is<CoreIPC::MessageClassWebProcessProxy>()) {
@@ -191,7 +212,17 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
                 forwardMessageToWebContext(message);
                 return;
             }
-                
+            case WebProcessProxyMessage::AddBackForwardItem: {
+                uint64_t itemID;
+                String originalURL;
+                String url;
+                String title;
+                if (!arguments->decode(CoreIPC::Out(itemID, originalURL, url, title)))
+                    return;
+                addOrUpdateBackForwardListItem(itemID, originalURL, url, title);
+                return;
+            }
+
             // These are synchronous messages and should never be handled here.
             case WebProcessProxyMessage::GetPlugins:
             case WebProcessProxyMessage::GetPluginHostConnection:
@@ -245,6 +276,7 @@ void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, Cor
 
             // These are asynchronous messages and should never be handled here.
             case WebProcessProxyMessage::PostMessage:
+            case WebProcessProxyMessage::AddBackForwardItem:
                 ASSERT_NOT_REACHED();
                 break;
         }
diff --git a/WebKit2/UIProcess/WebProcessProxy.h b/WebKit2/UIProcess/WebProcessProxy.h
index 452bf6f..55435c3 100644
--- a/WebKit2/UIProcess/WebProcessProxy.h
+++ b/WebKit2/UIProcess/WebProcessProxy.h
@@ -43,6 +43,7 @@ namespace WebCore {
 
 namespace WebKit {
 
+class WebBackForwardListItem;
 class WebContext;
 class WebPageNamespace;
     
@@ -50,6 +51,7 @@ class WebProcessProxy : public RefCounted<WebProcessProxy>, CoreIPC::Connection:
 public:
     typedef HashMap<uint64_t, RefPtr<WebPageProxy> > WebPageProxyMap;
     typedef WebPageProxyMap::const_iterator::Values pages_const_iterator;
+    typedef HashMap<uint64_t, RefPtr<WebBackForwardListItem> > WebBackForwardListItemMap;
 
     static PassRefPtr<WebProcessProxy> create(WebContext*);
     ~WebProcessProxy();
@@ -76,6 +78,8 @@ public:
     pages_const_iterator pages_end();
     size_t numberOfPages();
 
+    WebBackForwardListItem* webBackForwardItem(uint64_t itemID) const;
+
     ResponsivenessTimer* responsivenessTimer() { return &m_responsivenessTimer; }
 
     bool isValid() const { return m_connection; }
@@ -95,6 +99,8 @@ private:
     void getPlugins(bool refresh, Vector<WebCore::PluginInfo>&);
     void getPluginHostConnection(const WebCore::String& mimeType, const WebCore::KURL& url, WebCore::String& pluginPath);
 
+    void addOrUpdateBackForwardListItem(uint64_t itemID, const WebCore::String& originalURLString, const WebCore::String& urlString, const WebCore::String& title);
+
     // CoreIPC::Connection::Client
     void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
@@ -115,8 +121,11 @@ private:
 
     WebContext* m_context;
 
-    // NOTE: This map is for pages in all WebPageNamespaces that use this process.
+    // NOTE: This map is for WebPageProxies in all WebPageNamespaces that use this process.
     WebPageProxyMap m_pageMap;
+
+    // NOTE: This map is for WebBackForwardListItems in all WebPageNamespaces and WebPageProxies that use this process.
+    WebBackForwardListItemMap m_backForwardListItemMap;
 };
 
 template<typename E, typename T>
diff --git a/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp b/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
index 9ae32e1..348c8d5 100644
--- a/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
+++ b/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
@@ -29,6 +29,7 @@
 #include "WebPage.h"
 #include "WebPageProxyMessageKinds.h"
 #include "WebProcess.h"
+#include "WebProcessProxyMessageKinds.h"
 #include <WebCore/HistoryItem.h>
 #include <wtf/HashMap.h>
 
@@ -79,6 +80,20 @@ static uint64_t getIDForHistoryItem(HistoryItem* item)
     return itemID;
 }
 
+static void updateBackForwardItem(HistoryItem* item)
+{
+    uint64_t itemID = getIDForHistoryItem(item);
+    const String& originalURLString = item->originalURLString();
+    const String& urlString = item->urlString();
+    const String& title = item->title();
+    WebProcess::shared().connection()->send(WebProcessProxyMessage::AddBackForwardItem, 0, CoreIPC::In(itemID, originalURLString, urlString, title));
+}
+
+static void WK2NotifyHistoryItemChanged(HistoryItem* item)
+{
+    updateBackForwardItem(item);
+}
+
 HistoryItem* WebBackForwardListProxy::itemForID(uint64_t itemID)
 {
     return idToHistoryItemMap().get(itemID).get();
@@ -90,6 +105,7 @@ WebBackForwardListProxy::WebBackForwardListProxy(WebPage* page)
     , m_closed(true)
     , m_enabled(true)
 {
+    WebCore::notifyHistoryItemChanged = WK2NotifyHistoryItemChanged;
 }
 
 WebBackForwardListProxy::~WebBackForwardListProxy()
@@ -102,13 +118,8 @@ void WebBackForwardListProxy::addItem(PassRefPtr<HistoryItem> prpItem)
         return;
 
     RefPtr<HistoryItem> item = prpItem;
-
-    uint64_t itemID = getIDForHistoryItem(item.get());
-    const String& originalURLString = item->originalURLString();
-    const String& urlString = item->urlString();
-    const String& title = item->title();
-
-    WebProcess::shared().connection()->send(WebPageProxyMessage::BackForwardAddItem, m_page->pageID(), CoreIPC::In(itemID, originalURLString, urlString, title));
+    uint64_t itemID = historyItemToIDMap().get(item);
+    WebProcess::shared().connection()->send(WebPageProxyMessage::BackForwardAddItem, m_page->pageID(), CoreIPC::In(itemID));
 }
 
 void WebBackForwardListProxy::goBack()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list