Changeset 72122 in webkit
- Timestamp:
- Nov 16, 2010 11:00:58 AM (13 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r72100 r72122 1 2010-11-16 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Make WebPageProxy::decidePolicyForMIMEType a tad synchronous 6 https://bugs.webkit.org/show_bug.cgi?id=49605 7 8 Change the DecidePolicyForMIMEType message to be synchronous, and if the policy listener is 9 invoked from within the decidePolicyForMIMEType callback return the policy information as out 10 parameters. This is needed in order to convert a loading connection to a download. 11 12 * Platform/CoreIPC/HandleMessage.h: 13 (CoreIPC::callMemberFunction): 14 * UIProcess/WebPageProxy.cpp: 15 (WebKit::WebPageProxy::WebPageProxy): 16 (WebKit::WebPageProxy::receivedPolicyDecision): 17 (WebKit::WebPageProxy::decidePolicyForMIMEType): 18 * UIProcess/WebPageProxy.h: 19 * UIProcess/WebPageProxy.messages.in: 20 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 21 (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForMIMEType): 22 1 23 2010-11-16 Kenneth Rohde Christiansen <kenneth@webkit.org>, Zalan Bujtas <zbujtas@gmail.com> 2 24 -
trunk/WebKit2/Platform/CoreIPC/HandleMessage.h
r71270 r72122 133 133 (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1, replyArgs.argument2); 134 134 } 135 135 136 template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename R1, typename R2, typename R3> 137 void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments3<R1, R2, R3>& replyArgs, C* object, MF function) 138 { 139 (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3); 140 } 141 136 142 // Variadic dispatch functions. 137 143 -
trunk/WebKit2/UIProcess/WebPageProxy.cpp
r72100 r72122 98 98 , m_isValid(true) 99 99 , m_isClosed(false) 100 , m_inDecidePolicyForMIMEType(false) 101 , m_syncMimeTypePolicyActionIsValid(false) 102 , m_syncMimeTypePolicyAction(PolicyUse) 103 , m_syncMimeTypePolicyDownloadID(0) 100 104 , m_pageID(pageID) 101 105 { … … 475 479 // Create a download proxy. 476 480 downloadID = pageNamespace()->context()->createDownloadProxy(); 481 } 482 483 // If we received a policy decision while in decidePolicyForMIMEType the decision will 484 // be sent back to the web process by decidePolicyForMIMEType. 485 if (m_inDecidePolicyForMIMEType) { 486 m_syncMimeTypePolicyActionIsValid = true; 487 m_syncMimeTypePolicyAction = action; 488 m_syncMimeTypePolicyDownloadID = downloadID; 489 return; 477 490 } 478 491 … … 913 926 } 914 927 915 void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID )928 void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID) 916 929 { 917 930 WebFrameProxy* frame = process()->webFrame(frameID); 918 931 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID); 932 933 ASSERT(!m_inDecidePolicyForMIMEType); 934 935 m_inDecidePolicyForMIMEType = true; 936 m_syncMimeTypePolicyActionIsValid = false; 937 919 938 if (!m_policyClient.decidePolicyForMIMEType(this, MIMEType, url, frame, listener.get())) 920 939 listener->use(); 940 941 m_inDecidePolicyForMIMEType = false; 942 943 // Check if we received a policy decision already. If we did, we can just pass it back. 944 if (m_syncMimeTypePolicyActionIsValid) { 945 receivedPolicyAction = true; 946 policyAction = m_syncMimeTypePolicyAction; 947 downloadID = m_syncMimeTypePolicyDownloadID; 948 } 921 949 } 922 950 -
trunk/WebKit2/UIProcess/WebPageProxy.h
r72100 r72122 289 289 void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const String& url, uint64_t listenerID); 290 290 void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const String& url, uint64_t listenerID); 291 void decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID );291 void decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID); 292 292 293 293 void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*); … … 424 424 bool m_isClosed; 425 425 426 bool m_inDecidePolicyForMIMEType; 427 bool m_syncMimeTypePolicyActionIsValid; 428 WebCore::PolicyAction m_syncMimeTypePolicyAction; 429 uint64_t m_syncMimeTypePolicyDownloadID; 430 426 431 uint64_t m_pageID; 427 432 -
trunk/WebKit2/UIProcess/WebPageProxy.messages.in
r72100 r72122 60 60 61 61 # Policy messages. 62 DecidePolicyForMIMEType(uint64_t frameID, WTF::String MIMEType, WTF::String url, uint64_t listenerID) 62 DecidePolicyForMIMEType(uint64_t frameID, WTF::String MIMEType, WTF::String url, uint64_t listenerID) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID) 63 63 DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WTF::String url, uint64_t listenerID) 64 64 DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WTF::String url, uint64_t listenerID) -
trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r72086 r72122 524 524 const String& url = request.url().string(); // FIXME: Pass entire request. 525 525 526 webPage->send(Messages::WebPageProxy::DecidePolicyForMIMEType(m_frame->frameID(), MIMEType, url, listenerID)); 526 bool receivedPolicyAction; 527 uint64_t policyAction; 528 uint64_t downloadID; 529 if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForMIMEType(m_frame->frameID(), MIMEType, url, listenerID), Messages::WebPageProxy::DecidePolicyForMIMEType::Reply(receivedPolicyAction, policyAction, downloadID))) 530 return; 531 532 // We call this synchronously because CFNetwork can only convert a loading connection to a download from its didReceiveResponse callback. 533 if (receivedPolicyAction) 534 m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), downloadID); 527 535 } 528 536
Note: See TracChangeset
for help on using the changeset viewer.