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

ap at apple.com ap at apple.com
Wed Dec 22 12:40:05 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e10b7aecebd69f2e8b88a8f3f1ce6c92fb7add85
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 26 23:03:26 2010 +0000

            Reviewed by Sam Weinig.
    
            https://bugs.webkit.org/show_bug.cgi?id=44726
            <rdar://problem/7935518> WebFrameProxies aren't destroyed until a page is destroyed
    
            Since frames can be moved across documents, they are not really a Page level concept.
            Moved frame tracking to WebProcess/WebProcessProxy.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66146 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1feb607..ef4c128 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-26  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=44726
+        <rdar://problem/7935518> WebFrameProxies aren't destroyed until a page is destroyed
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::closeAndRemoveChild):
+        (WebCore::FrameLoader::detachFromParent):
+        Added a few FIXME comments. The logic we have to track frames is extremely convoluted.
+
 2010-08-26  Ryosuke Niwa  <rniwa at webkit.org>
 
         Unreviewed; build fix.
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index a0cc2ee..c40f76a 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -2504,6 +2504,7 @@ void FrameLoader::closeAndRemoveChild(Frame* child)
     child->setView(0);
     if (child->ownerElement() && child->page())
         child->page()->decrementFrameCount();
+    // FIXME: The page isn't being destroyed, so it's not right to call a function named pageDestroyed().
     child->pageDestroyed();
 
     m_frame->tree()->removeChild(child);
@@ -2592,6 +2593,7 @@ void FrameLoader::detachFromParent()
         parent->loader()->scheduleCheckCompleted();
     } else {
         m_frame->setView(0);
+        // FIXME: The page isn't being destroyed, so it's not right to call a function named pageDestroyed().
         m_frame->pageDestroyed();
     }
 }
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 92f8694..51e275c 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,46 @@
+2010-08-26  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=44726
+        <rdar://problem/7935518> WebFrameProxies aren't destroyed until a page is destroyed
+
+        Since frames can be moved across documents, they are not really a Page level concept.
+        Moved frame tracking to WebProcess/WebProcessProxy.
+
+        * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h:
+        (WebProcessProxyMessage::):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::close):
+        (WebKit::WebPageProxy::getStatistics):
+        (WebKit::WebPageProxy::didReceiveMessage):
+        (WebKit::WebPageProxy::didReceiveSyncMessage):
+        (WebKit::WebPageProxy::didCreateMainFrame):
+        (WebKit::WebPageProxy::didCreateSubFrame):
+        (WebKit::WebPageProxy::processDidExit):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::didReceiveMessage):
+        (WebKit::WebProcessProxy::didReceiveSyncMessage):
+        (WebKit::WebProcessProxy::didClose):
+        (WebKit::WebProcessProxy::webFrame):
+        (WebKit::WebProcessProxy::frameCreated):
+        (WebKit::WebProcessProxy::frameDestroyed):
+        (WebKit::WebProcessProxy::disconnectFramesFromPage):
+        (WebKit::WebProcessProxy::frameCountInPage):
+        * UIProcess/WebProcessProxy.h:
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::WebFrame):
+        (WebKit::WebFrame::invalidate):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didReceiveMessage):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::webFrame):
+        (WebKit::WebProcess::addWebFrame):
+        (WebKit::WebProcess::removeWebFrame):
+        * WebProcess/WebProcess.h:
+
 2010-08-26  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h
index f6863d7..3b8e3c4 100644
--- a/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h
+++ b/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h
@@ -39,6 +39,7 @@ enum Kind {
     DidPerformClientRedirect,
     DidPerformServerRedirect,
     DidUpdateHistoryTitle,
+    DidDestroyFrame,
     GetPluginHostConnection,
     GetPlugins
 };
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index f1c7547..0517a69 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -167,11 +167,7 @@ void WebPageProxy::close()
 
     m_closed = true;
 
-    Vector<RefPtr<WebFrameProxy> > frames;
-    copyValuesToVector(m_frameMap, frames);
-    for (size_t i = 0, size = frames.size(); i < size; ++i)
-        frames[i]->disconnect();
-    m_frameMap.clear();
+    process()->disconnectFramesFromPage(this);
     m_mainFrame = 0;
 
     m_pageTitle = String();
@@ -403,15 +399,10 @@ void WebPageProxy::preferencesDidChange()
 
 void WebPageProxy::getStatistics(WKContextStatistics* statistics)
 {
-    statistics->numberOfWKFrames += m_frameMap.size();
+    statistics->numberOfWKFrames += process()->frameCountInPage(this);
 }
 
 
-WebFrameProxy* WebPageProxy::webFrame(uint64_t frameID) const
-{
-    return m_frameMap.get(frameID).get();
-}
-
 void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
 {
     if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
@@ -439,42 +430,42 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             String url;
             if (!arguments->decode(CoreIPC::Out(frameID, url)))
                 return;
-            didStartProvisionalLoadForFrame(webFrame(frameID), url);
+            didStartProvisionalLoadForFrame(process()->webFrame(frameID), url);
             break;
         }
         case WebPageProxyMessage::DidReceiveServerRedirectForProvisionalLoadForFrame: {
             uint64_t frameID;
             if (!arguments->decode(frameID))
                 return;
-            didReceiveServerRedirectForProvisionalLoadForFrame(webFrame(frameID));
+            didReceiveServerRedirectForProvisionalLoadForFrame(process()->webFrame(frameID));
             break;
         }
         case WebPageProxyMessage::DidFailProvisionalLoadForFrame: {
             uint64_t frameID;
             if (!arguments->decode(frameID))
                 return;
-            didFailProvisionalLoadForFrame(webFrame(frameID));
+            didFailProvisionalLoadForFrame(process()->webFrame(frameID));
             break;
         }
         case WebPageProxyMessage::DidCommitLoadForFrame: {
             uint64_t frameID;
             if (!arguments->decode(frameID))
                 return;
-            didCommitLoadForFrame(webFrame(frameID));
+            didCommitLoadForFrame(process()->webFrame(frameID));
             break;
         }
         case WebPageProxyMessage::DidFinishLoadForFrame: {
             uint64_t frameID;
             if (!arguments->decode(frameID))
                 return;
-            didFinishLoadForFrame(webFrame(frameID));
+            didFinishLoadForFrame(process()->webFrame(frameID));
             break;
         }
         case WebPageProxyMessage::DidFailLoadForFrame: {
             uint64_t frameID;
             if (!arguments->decode(frameID))
                 return;
-            didFailLoadForFrame(webFrame(frameID));
+            didFailLoadForFrame(process()->webFrame(frameID));
             break;
         }
         case WebPageProxyMessage::DidReceiveTitleForFrame: {
@@ -482,21 +473,21 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             String title;
             if (!arguments->decode(CoreIPC::Out(frameID, title)))
                 return;
-            didReceiveTitleForFrame(webFrame(frameID), title);
+            didReceiveTitleForFrame(process()->webFrame(frameID), title);
             break;
         }
         case WebPageProxyMessage::DidFirstLayoutForFrame: {
             uint64_t frameID;
             if (!arguments->decode(frameID))
                 return;
-            didFirstLayoutForFrame(webFrame(frameID));
+            didFirstLayoutForFrame(process()->webFrame(frameID));
             break;
         }
         case WebPageProxyMessage::DidFirstVisuallyNonEmptyLayoutForFrame: {
             uint64_t frameID;
             if (!arguments->decode(frameID))
                 return;
-            didFirstVisuallyNonEmptyLayoutForFrame(webFrame(frameID));
+            didFirstVisuallyNonEmptyLayoutForFrame(process()->webFrame(frameID));
             break;
         }
         case WebPageProxyMessage::DidStartProgress:
@@ -535,7 +526,7 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             uint64_t listenerID;
             if (!arguments->decode(CoreIPC::Out(frameID, navigationType, modifiers, url, listenerID)))
                 return;
-            decidePolicyForNavigationAction(webFrame(frameID), static_cast<NavigationType>(navigationType), static_cast<WebEvent::Modifiers>(modifiers), url, listenerID);
+            decidePolicyForNavigationAction(process()->webFrame(frameID), static_cast<NavigationType>(navigationType), static_cast<WebEvent::Modifiers>(modifiers), url, listenerID);
             break;
         }
         case WebPageProxyMessage::DecidePolicyForNewWindowAction: {
@@ -546,7 +537,7 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             uint64_t listenerID;
             if (!arguments->decode(CoreIPC::Out(frameID, navigationType, modifiers, url, listenerID)))
                 return;
-            decidePolicyForNewWindowAction(webFrame(frameID), static_cast<NavigationType>(navigationType), static_cast<WebEvent::Modifiers>(modifiers), url, listenerID);
+            decidePolicyForNewWindowAction(process()->webFrame(frameID), static_cast<NavigationType>(navigationType), static_cast<WebEvent::Modifiers>(modifiers), url, listenerID);
             break;
         }
         case WebPageProxyMessage::DecidePolicyForMIMEType: {
@@ -556,7 +547,7 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             uint64_t listenerID;
             if (!arguments->decode(CoreIPC::Out(frameID, MIMEType, url, listenerID)))
                 return;
-            decidePolicyForMIMEType(webFrame(frameID), MIMEType, url, listenerID);
+            decidePolicyForMIMEType(process()->webFrame(frameID), MIMEType, url, listenerID);
             break;
         }
         case WebPageProxyMessage::WillSubmitForm: {
@@ -566,7 +557,7 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             uint64_t listenerID;
             if (!arguments->decode(CoreIPC::Out(frameID, sourceFrameID, textFieldValues, listenerID)))
                 return;
-            willSubmitForm(webFrame(frameID), webFrame(sourceFrameID), textFieldValues, listenerID);
+            willSubmitForm(process()->webFrame(frameID), process()->webFrame(sourceFrameID), textFieldValues, listenerID);
             break;
         }
         
@@ -629,7 +620,7 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             uint64_t frameID;
             if (!arguments->decode(CoreIPC::Out(frameID, size)))
                 return;
-            contentsSizeChanged(webFrame(frameID), size);
+            contentsSizeChanged(process()->webFrame(frameID), size);
             break;
         }
         default:
@@ -663,7 +654,7 @@ void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIP
             String message;
             if (!arguments->decode(CoreIPC::Out(frameID, message)))
                 return;
-            runJavaScriptAlert(webFrame(frameID), message);
+            runJavaScriptAlert(process()->webFrame(frameID), message);
             break;
         }
         case WebPageProxyMessage::RunJavaScriptConfirm: {
@@ -673,7 +664,7 @@ void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIP
             if (!arguments->decode(CoreIPC::Out(frameID, message)))
                 return;
 
-            bool result = runJavaScriptConfirm(webFrame(frameID), message);
+            bool result = runJavaScriptConfirm(process()->webFrame(frameID), message);
             reply->encode(CoreIPC::In(result));
             break;
         }
@@ -685,7 +676,7 @@ void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIP
             if (!arguments->decode(CoreIPC::Out(frameID, message, defaultValue)))
                 return;
 
-            String result = runJavaScriptPrompt(webFrame(frameID), message, defaultValue);
+            String result = runJavaScriptPrompt(process()->webFrame(frameID), message, defaultValue);
             reply->encode(CoreIPC::In(result));
             break;
         }
@@ -749,19 +740,15 @@ void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIP
 void WebPageProxy::didCreateMainFrame(uint64_t frameID)
 {
     ASSERT(!m_mainFrame);
-    ASSERT(m_frameMap.isEmpty());
 
     m_mainFrame = WebFrameProxy::create(this, frameID);
-    m_frameMap.set(frameID, m_mainFrame);
+    process()->frameCreated(frameID, m_mainFrame.get());
 }
 
 void WebPageProxy::didCreateSubFrame(uint64_t frameID)
 {
     ASSERT(m_mainFrame);
-    ASSERT(!m_frameMap.isEmpty());
-    ASSERT(!m_frameMap.contains(frameID));
-
-    m_frameMap.set(frameID, WebFrameProxy::create(this, frameID));
+    process()->frameCreated(frameID, WebFrameProxy::create(this, frameID).get());
 }
 
 void WebPageProxy::didStartProgress()
@@ -1008,11 +995,6 @@ void WebPageProxy::processDidExit()
     if (m_mainFrame)
         m_urlAtProcessExit = m_mainFrame->url();
 
-    Vector<RefPtr<WebFrameProxy> > frames;
-    copyValuesToVector(m_frameMap, frames);
-    for (size_t i = 0, size = frames.size(); i < size; ++i)
-        frames[i]->disconnect();
-    m_frameMap.clear();
     m_mainFrame = 0;
 
     m_pageTitle = String();
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 24f1f23..6e41822 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -84,7 +84,6 @@ public:
 
     uint64_t pageID() const { return m_pageID; }
 
-    WebFrameProxy* webFrame(uint64_t) const;
     WebFrameProxy* mainFrame() const { return m_mainFrame.get(); }
 
     DrawingAreaProxy* drawingArea() { return m_drawingArea.get(); }
@@ -231,7 +230,6 @@ private:
     OwnPtr<DrawingAreaProxy> m_drawingArea;
     RefPtr<WebPageNamespace> m_pageNamespace;
     RefPtr<WebFrameProxy> m_mainFrame;
-    HashMap<uint64_t, RefPtr<WebFrameProxy> > m_frameMap;
     WTF::String m_pageTitle;
 
     HashMap<uint64_t, RefPtr<ScriptReturnValueCallback> > m_scriptReturnValueCallbacks;
diff --git a/WebKit2/UIProcess/WebProcessProxy.cpp b/WebKit2/UIProcess/WebProcessProxy.cpp
index 18d0e74..bf3647a 100644
--- a/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -253,11 +253,7 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
                 if (!arguments->decode(CoreIPC::Out(pageID, store, frameID)))
                     return;
 
-                WebPageProxy* page = webPage(pageID);
-                if (!page)
-                    return;
-                
-                m_context->didNavigateWithNavigationData(page->webFrame(frameID), store);
+                m_context->didNavigateWithNavigationData(webFrame(frameID), store);
                 break;
             }
             case WebProcessProxyMessage::DidPerformClientRedirect: {
@@ -268,11 +264,7 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
                 if (!arguments->decode(CoreIPC::Out(pageID, sourceURLString, destinationURLString, frameID)))
                     return;
 
-                WebPageProxy* page = webPage(pageID);
-                if (!page)
-                    return;
-
-                m_context->didPerformClientRedirect(page->webFrame(frameID), sourceURLString, destinationURLString);
+                m_context->didPerformClientRedirect(webFrame(frameID), sourceURLString, destinationURLString);
                 break;
             }
             case WebProcessProxyMessage::DidPerformServerRedirect: {
@@ -283,11 +275,7 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
                 if (!arguments->decode(CoreIPC::Out(pageID, sourceURLString, destinationURLString, frameID)))
                     return;
 
-                WebPageProxy* page = webPage(pageID);
-                if (!page)
-                    return;
-
-                m_context->didPerformServerRedirect(page->webFrame(frameID), sourceURLString, destinationURLString);
+                m_context->didPerformServerRedirect(webFrame(frameID), sourceURLString, destinationURLString);
                 break;
             }
             case WebProcessProxyMessage::DidUpdateHistoryTitle: {
@@ -298,11 +286,15 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
                 if (!arguments->decode(CoreIPC::Out(pageID, title, url, frameID)))
                     return;
 
-                WebPageProxy* page = webPage(pageID);
-                if (!page)
+                m_context->didUpdateHistoryTitle(webFrame(frameID), title, url);
+                break;
+            }
+            case WebProcessProxyMessage::DidDestroyFrame: {
+                uint64_t frameID;
+                if (!arguments->decode(CoreIPC::Out(frameID)))
                     return;
 
-                m_context->didUpdateHistoryTitle(page->webFrame(frameID), title, url);
+                frameDestroyed(frameID);
                 break;
             }
 
@@ -367,6 +359,7 @@ void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, Cor
             case WebProcessProxyMessage::DidUpdateHistoryTitle:
             case WebProcessProxyMessage::AddBackForwardItem:
             case WebProcessProxyMessage::AddVisitedLink:
+            case WebProcessProxyMessage::DidDestroyFrame:
                 ASSERT_NOT_REACHED();
                 break;
         }
@@ -388,6 +381,13 @@ void WebProcessProxy::didClose(CoreIPC::Connection*)
     m_connection = 0;
     m_responsivenessTimer.stop();
 
+    Vector<RefPtr<WebFrameProxy> > frames;
+    copyValuesToVector(m_frameMap, frames);
+
+    for (size_t i = 0, size = frames.size(); i < size; ++i)
+        frames[i]->disconnect();
+    m_frameMap.clear();
+
     Vector<RefPtr<WebPageProxy> > pages;
     copyValuesToVector(m_pageMap, pages);
 
@@ -440,4 +440,41 @@ void WebProcessProxy::didFinishLaunching(ProcessLauncher*, const CoreIPC::Connec
     m_context->processDidFinishLaunching(this);
 }
 
+WebFrameProxy* WebProcessProxy::webFrame(uint64_t frameID) const
+{
+    return m_frameMap.get(frameID).get();
+}
+
+void WebProcessProxy::frameCreated(uint64_t frameID, WebFrameProxy* frameProxy)
+{
+    ASSERT(!m_frameMap.contains(frameID));
+    m_frameMap.set(frameID, frameProxy);
+}
+
+void WebProcessProxy::frameDestroyed(uint64_t frameID)
+{
+    ASSERT(m_frameMap.contains(frameID));
+    m_frameMap.remove(frameID);
+}
+
+void WebProcessProxy::disconnectFramesFromPage(WebPageProxy* page)
+{
+    Vector<RefPtr<WebFrameProxy> > frames;
+    copyValuesToVector(m_frameMap, frames);
+    for (size_t i = 0, size = frames.size(); i < size; ++i) {
+        if (frames[i]->page() == page)
+            frames[i]->disconnect();
+    }
+}
+
+size_t WebProcessProxy::frameCountInPage(WebPageProxy* page) const
+{
+    size_t result = 0;
+    for (HashMap<uint64_t, RefPtr<WebFrameProxy> >::const_iterator iter = m_frameMap.begin(); iter != m_frameMap.end(); ++iter) {
+        if (iter->second->page() == page)
+            ++result;
+    }
+    return result;
+}
+
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebProcessProxy.h b/WebKit2/UIProcess/WebProcessProxy.h
index 8f682a9..5128626 100644
--- a/WebKit2/UIProcess/WebProcessProxy.h
+++ b/WebKit2/UIProcess/WebProcessProxy.h
@@ -87,6 +87,12 @@ public:
     bool isValid() const { return m_connection; }
     bool isLaunching() const { return m_processLauncher && m_processLauncher->isLaunching(); }
 
+    WebFrameProxy* webFrame(uint64_t) const;
+    void frameCreated(uint64_t, WebFrameProxy*);
+    void frameDestroyed(uint64_t);
+    void disconnectFramesFromPage(WebPageProxy*); // Including main frame.
+    size_t frameCountInPage(WebPageProxy*) const; // Including main frame.
+
 private:
     explicit WebProcessProxy(WebContext*);
 
@@ -129,6 +135,8 @@ private:
 
     // NOTE: This map is for WebBackForwardListItems in all WebPageNamespaces and WebPageProxies that use this process.
     WebBackForwardListItemMap m_backForwardListItemMap;
+
+    HashMap<uint64_t, RefPtr<WebFrameProxy> > m_frameMap;
 };
 
 template<typename E, typename T>
diff --git a/WebKit2/WebProcess/WebPage/WebFrame.cpp b/WebKit2/WebProcess/WebPage/WebFrame.cpp
index 6415a45..276e4ce 100644
--- a/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -29,6 +29,7 @@
 #include "InjectedBundleScriptWorld.h"
 #include "WebChromeClient.h"
 #include "WebPage.h"
+#include "WebProcess.h"
 #include <JavaScriptCore/APICast.h>
 #include <JavaScriptCore/JSLock.h>
 #include <WebCore/AnimationController.h>
@@ -94,7 +95,7 @@ WebFrame::WebFrame(WebPage* page, const String& frameName, HTMLFrameOwnerElement
     , m_loadListener(0)
     , m_frameID(generateFrameID())
 {
-    page->addWebFrame(m_frameID, this);
+    WebProcess::shared().addWebFrame(m_frameID, this);
 
     RefPtr<Frame> frame = Frame::create(page->corePage(), ownerElement, &m_frameLoaderClient);
     m_coreFrame = frame.get();
@@ -135,8 +136,7 @@ WebPage* WebFrame::page() const
 
 void WebFrame::invalidate()
 {
-    if (WebPage* p = page())
-        p->removeWebFrame(m_frameID);
+    WebProcess::shared().removeWebFrame(m_frameID);
     m_coreFrame = 0;
 }
 
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 584da1b..8fbd032 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -208,21 +208,6 @@ void WebPage::exitAcceleratedCompositingMode()
 }
 #endif
 
-WebFrame* WebPage::webFrame(uint64_t frameID) const
-{
-    return m_frameMap.get(frameID);
-}
-
-void WebPage::addWebFrame(uint64_t frameID, WebFrame* frame)
-{
-    m_frameMap.set(frameID, frame);
-}
-
-void WebPage::removeWebFrame(uint64_t frameID)
-{
-    m_frameMap.remove(frameID);
-}
-
 void WebPage::close()
 {
     if (WebProcess::shared().injectedBundle())
@@ -656,7 +641,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
             uint32_t policyAction;
             if (!arguments->decode(CoreIPC::Out(frameID, listenerID, policyAction)))
                 return;
-            didReceivePolicyDecision(webFrame(frameID), listenerID, (WebCore::PolicyAction)policyAction);
+            didReceivePolicyDecision(WebProcess::shared().webFrame(frameID), listenerID, (WebCore::PolicyAction)policyAction);
             return;
         }
         case WebPageMessage::RunJavaScriptInMainFrame: {
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index b14077a..67671af 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -81,10 +81,6 @@ public:
     WebCore::Page* corePage() const { return m_page; }
     uint64_t pageID() const { return m_pageID; }
 
-    WebFrame* webFrame(uint64_t) const;
-    void addWebFrame(uint64_t, WebFrame*);
-    void removeWebFrame(uint64_t);
-
     void setSize(const WebCore::IntSize&);
     const WebCore::IntSize& size() const { return m_viewSize; }
 
@@ -170,7 +166,6 @@ private:
 
     WebCore::Page* m_page;
     RefPtr<WebFrame> m_mainFrame;
-    HashMap<uint64_t, WebFrame*> m_frameMap;
 
     String m_customUserAgent;
 
diff --git a/WebKit2/WebProcess/WebProcess.cpp b/WebKit2/WebProcess/WebProcess.cpp
index 61a27ac..d0d4211 100644
--- a/WebKit2/WebProcess/WebProcess.cpp
+++ b/WebKit2/WebProcess/WebProcess.cpp
@@ -350,4 +350,20 @@ void WebProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::Message
     // we'll let it slide.
 }
 
+WebFrame* WebProcess::webFrame(uint64_t frameID) const
+{
+    return m_frameMap.get(frameID);
+}
+
+void WebProcess::addWebFrame(uint64_t frameID, WebFrame* frame)
+{
+    m_frameMap.set(frameID, frame);
+}
+
+void WebProcess::removeWebFrame(uint64_t frameID)
+{
+    m_frameMap.remove(frameID);
+    m_connection->send(WebProcessProxyMessage::DidDestroyFrame, 0, CoreIPC::In(frameID));
+}
+
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebProcess.h b/WebKit2/WebProcess/WebProcess.h
index 74c2002..dfad394 100644
--- a/WebKit2/WebProcess/WebProcess.h
+++ b/WebKit2/WebProcess/WebProcess.h
@@ -41,6 +41,7 @@ namespace WebCore {
 namespace WebKit {
 
 class InjectedBundle;
+class WebFrame;
 class WebPage;
 struct WebPreferencesStore;
 
@@ -68,6 +69,10 @@ public:
     void addVisitedLink(WebCore::LinkHash);
     bool isLinkVisited(WebCore::LinkHash) const;
 
+    WebFrame* webFrame(uint64_t) const;
+    void addWebFrame(uint64_t, WebFrame*);
+    void removeWebFrame(uint64_t);
+
 private:
     WebProcess();
     void shutdown();
@@ -103,6 +108,8 @@ private:
 #if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC)
     mach_port_t m_compositingRenderServerPort;
 #endif
+
+    HashMap<uint64_t, WebFrame*> m_frameMap;
 };
 
 } // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list