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

andersca at apple.com andersca at apple.com
Wed Dec 22 15:55:38 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a24616e0cdc5626eb0963043d959b51e47931a7b
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 16 19:00:58 2010 +0000

    Make WebPageProxy::decidePolicyForMIMEType a tad synchronous
    https://bugs.webkit.org/show_bug.cgi?id=49605
    
    Reviewed by Sam Weinig.
    
    Change the DecidePolicyForMIMEType message to be synchronous, and if the policy listener is
    invoked from within the decidePolicyForMIMEType callback return the policy information as out
    parameters. This is needed in order to convert a loading connection to a download.
    
    * Platform/CoreIPC/HandleMessage.h:
    (CoreIPC::callMemberFunction):
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::WebPageProxy):
    (WebKit::WebPageProxy::receivedPolicyDecision):
    (WebKit::WebPageProxy::decidePolicyForMIMEType):
    * UIProcess/WebPageProxy.h:
    * UIProcess/WebPageProxy.messages.in:
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForMIMEType):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72122 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index dd29a26..e09c43c 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,25 @@
+2010-11-16  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Make WebPageProxy::decidePolicyForMIMEType a tad synchronous
+        https://bugs.webkit.org/show_bug.cgi?id=49605
+
+        Change the DecidePolicyForMIMEType message to be synchronous, and if the policy listener is
+        invoked from within the decidePolicyForMIMEType callback return the policy information as out
+        parameters. This is needed in order to convert a loading connection to a download.
+
+        * Platform/CoreIPC/HandleMessage.h:
+        (CoreIPC::callMemberFunction):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        (WebKit::WebPageProxy::receivedPolicyDecision):
+        (WebKit::WebPageProxy::decidePolicyForMIMEType):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForMIMEType):
+
 2010-11-16  Kenneth Rohde Christiansen  <kenneth at webkit.org>, Zalan Bujtas  <zbujtas at gmail.com>
 
         Reviewed by Andreas Kling.
diff --git a/WebKit2/Platform/CoreIPC/HandleMessage.h b/WebKit2/Platform/CoreIPC/HandleMessage.h
index e43cfda..f166e2b 100644
--- a/WebKit2/Platform/CoreIPC/HandleMessage.h
+++ b/WebKit2/Platform/CoreIPC/HandleMessage.h
@@ -132,7 +132,13 @@ void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments2<R1, R
 {
     (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1, replyArgs.argument2);
 }
-    
+
+template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename R1, typename R2, typename R3>
+void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments3<R1, R2, R3>& replyArgs, C* object, MF function)
+{
+    (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3);
+}
+
 // Variadic dispatch functions.
 
 template<typename C, typename MF>
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 4093da2..537ff89 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -97,6 +97,10 @@ WebPageProxy::WebPageProxy(WebPageNamespace* pageNamespace, uint64_t pageID)
     , m_viewScaleFactor(1)
     , m_isValid(true)
     , m_isClosed(false)
+    , m_inDecidePolicyForMIMEType(false)
+    , m_syncMimeTypePolicyActionIsValid(false)
+    , m_syncMimeTypePolicyAction(PolicyUse)
+    , m_syncMimeTypePolicyDownloadID(0)
     , m_pageID(pageID)
 {
 #ifndef NDEBUG
@@ -476,6 +480,15 @@ void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* fr
         downloadID = pageNamespace()->context()->createDownloadProxy();
     }
 
+    // If we received a policy decision while in decidePolicyForMIMEType the decision will 
+    // be sent back to the web process by decidePolicyForMIMEType. 
+    if (m_inDecidePolicyForMIMEType) {
+        m_syncMimeTypePolicyActionIsValid = true;
+        m_syncMimeTypePolicyAction = action;
+        m_syncMimeTypePolicyDownloadID = downloadID;
+        return;
+    }
+
     process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
 }
 
@@ -912,12 +925,27 @@ void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opa
         listener->use();
 }
 
-void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID)
+void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
 {
     WebFrameProxy* frame = process()->webFrame(frameID);
     RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
+
+    ASSERT(!m_inDecidePolicyForMIMEType);
+
+    m_inDecidePolicyForMIMEType = true;
+    m_syncMimeTypePolicyActionIsValid = false;
+
     if (!m_policyClient.decidePolicyForMIMEType(this, MIMEType, url, frame, listener.get()))
         listener->use();
+
+    m_inDecidePolicyForMIMEType = false;
+
+    // Check if we received a policy decision already. If we did, we can just pass it back.
+    if (m_syncMimeTypePolicyActionIsValid) {
+        receivedPolicyAction = true;
+        policyAction = m_syncMimeTypePolicyAction;
+        downloadID = m_syncMimeTypePolicyDownloadID;
+    }
 }
 
 // FormClient
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index a37c749..5b7dfd6 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -288,7 +288,7 @@ private:
     
     void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const String& url, uint64_t listenerID);
     void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const String& url, uint64_t listenerID);
-    void decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID);
+    void decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
 
     void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
 
@@ -423,6 +423,11 @@ private:
     // Whether WebPageProxy::close() has been called on this page.
     bool m_isClosed;
 
+    bool m_inDecidePolicyForMIMEType;
+    bool m_syncMimeTypePolicyActionIsValid;
+    WebCore::PolicyAction m_syncMimeTypePolicyAction;
+    uint64_t m_syncMimeTypePolicyDownloadID;
+
     uint64_t m_pageID;
 
     Deque<NativeWebKeyboardEvent> m_keyEventQueue;
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index d0da568..774371f 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -59,7 +59,7 @@ messages -> WebPageProxy {
 #endif
 
     # Policy messages.
-    DecidePolicyForMIMEType(uint64_t frameID, WTF::String MIMEType, WTF::String url, uint64_t listenerID)
+    DecidePolicyForMIMEType(uint64_t frameID, WTF::String MIMEType, WTF::String url, uint64_t listenerID) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID)
     DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WTF::String url, uint64_t listenerID)
     DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WTF::String url, uint64_t listenerID)
 
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index dab56dc..ec6ed98 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -523,7 +523,15 @@ void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction f
     uint64_t listenerID = m_frame->setUpPolicyListener(function);
     const String& url = request.url().string(); // FIXME: Pass entire request.
 
-    webPage->send(Messages::WebPageProxy::DecidePolicyForMIMEType(m_frame->frameID(), MIMEType, url, listenerID));
+    bool receivedPolicyAction;
+    uint64_t policyAction;
+    uint64_t downloadID;
+    if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForMIMEType(m_frame->frameID(), MIMEType, url, listenerID), Messages::WebPageProxy::DecidePolicyForMIMEType::Reply(receivedPolicyAction, policyAction, downloadID)))
+        return;
+
+    // We call this synchronously because CFNetwork can only convert a loading connection to a download from its didReceiveResponse callback.
+    if (receivedPolicyAction)
+        m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), downloadID);
 }
 
 void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState>, const String& frameName)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list