Changeset 70585 in webkit


Ignore:
Timestamp:
Oct 26, 2010 4:05:31 PM (13 years ago)
Author:
andersca@apple.com
Message:

Pass a downloadID to the web process whenever a download is requested
https://bugs.webkit.org/show_bug.cgi?id=48380

Reviewed by Sam Weinig.

  • UIProcess/WebContext.cpp:

(WebKit::WebContext::generateDownloadID):
Generate a unique download ID.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::receivedPolicyDecision):
Pass along a download ID if needed.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::startDownload):
Call the web frame member function.

  • WebProcess/WebPage/WebFrame.cpp:

(WebKit::WebFrame::WebFrame):
Initialize m_policyDownloadID.

(WebKit::WebFrame::invalidatePolicyListener):
Reset m_policyDownloadID.

(WebKit::WebFrame::didReceivePolicyDecision):
Set m_policyDownloadID.

(WebKit::WebFrame::startDownload):
Assert that m_policyDownloadID is not zero.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::didReceivePolicyDecision):
Pass along the download ID.

  • WebProcess/WebPage/WebPage.messages.in:

Add the download ID.

Location:
trunk/WebKit2
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r70584 r70585  
     12010-10-26  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Pass a downloadID to the web process whenever a download is requested
     6        https://bugs.webkit.org/show_bug.cgi?id=48380
     7
     8        * UIProcess/WebContext.cpp:
     9        (WebKit::WebContext::generateDownloadID):
     10        Generate a unique download ID.
     11
     12        * UIProcess/WebPageProxy.cpp:
     13        (WebKit::WebPageProxy::receivedPolicyDecision):
     14        Pass along a download ID if needed.
     15
     16        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     17        (WebKit::WebFrameLoaderClient::startDownload):
     18        Call the web frame member function.
     19
     20        * WebProcess/WebPage/WebFrame.cpp:
     21        (WebKit::WebFrame::WebFrame):
     22        Initialize m_policyDownloadID.
     23
     24        (WebKit::WebFrame::invalidatePolicyListener):
     25        Reset m_policyDownloadID.
     26
     27        (WebKit::WebFrame::didReceivePolicyDecision):
     28        Set m_policyDownloadID.
     29
     30        (WebKit::WebFrame::startDownload):
     31        Assert that m_policyDownloadID is not zero.
     32
     33        * WebProcess/WebPage/WebPage.cpp:
     34        (WebKit::WebPage::didReceivePolicyDecision):
     35        Pass along the download ID.
     36
     37        * WebProcess/WebPage/WebPage.messages.in:
     38        Add the download ID.
     39
    1402010-10-26  Alexey Proskuryakov  <ap@apple.com>
    241
  • trunk/WebKit2/UIProcess/WebContext.cpp

    r70568 r70585  
    385385}
    386386
     387uint64_t WebContext::generateDownloadID()
     388{
     389    static uint64_t uniqueDownloadID = 0;
     390    return ++uniqueDownloadID;
     391}
     392
    387393void WebContext::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
    388394{
  • trunk/WebKit2/UIProcess/WebContext.h

    r70357 r70585  
    120120#endif
    121121
     122    // Downloads.
     123    uint64_t generateDownloadID();
     124
    122125private:
    123126    WebContext(ProcessModel, const String& injectedBundlePath);
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r70584 r70585  
    446446#endif
    447447
    448 void WebPageProxy::receivedPolicyDecision(WebCore::PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
    449 {
    450     if (!isValid())
    451         return;
    452 
    453     process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action), m_pageID);
     448void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
     449{
     450    if (!isValid())
     451        return;
     452
     453    uint64_t downloadID = 0;
     454    if (action == PolicyDownload)
     455        downloadID = pageNamespace()->context()->generateDownloadID();
     456
     457    process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
    454458}
    455459
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r70584 r70585  
    658658}
    659659
    660 void WebFrameLoaderClient::startDownload(const ResourceRequest&)
    661 {
    662     notImplemented();
     660void WebFrameLoaderClient::startDownload(const ResourceRequest& request)
     661{
     662    m_frame->startDownload(request);
    663663}
    664664
  • trunk/WebKit2/WebProcess/WebPage/WebFrame.cpp

    r70548 r70585  
    110110    , m_policyListenerID(0)
    111111    , m_policyFunction(0)
     112    , m_policyDownloadID(0)
    112113    , m_frameLoaderClient(this)
    113114    , m_loadListener(0)
     
    178179        return;
    179180
     181    m_policyDownloadID = 0;
    180182    m_policyListenerID = 0;
    181183    m_policyFunction = 0;
    182184}
    183185
    184 void WebFrame::didReceivePolicyDecision(uint64_t listenerID, PolicyAction action)
     186void WebFrame::didReceivePolicyDecision(uint64_t listenerID, PolicyAction action, uint64_t downloadID)
    185187{
    186188    if (!m_coreFrame)
     
    199201    invalidatePolicyListener();
    200202
     203    m_policyDownloadID = downloadID;
     204
    201205    (m_coreFrame->loader()->policyChecker()->*function)(action);
     206}
     207
     208void WebFrame::startDownload(const WebCore::ResourceRequest&)
     209{
     210    ASSERT(m_policyDownloadID);
     211
     212    m_policyDownloadID = 0;
    202213}
    203214
  • trunk/WebKit2/WebProcess/WebPage/WebFrame.h

    r70548 r70585  
    6868    uint64_t setUpPolicyListener(WebCore::FramePolicyFunction);
    6969    void invalidatePolicyListener();
    70     void didReceivePolicyDecision(uint64_t listenerID, WebCore::PolicyAction);
     70    void didReceivePolicyDecision(uint64_t listenerID, WebCore::PolicyAction, uint64_t downloadID);
     71
     72    void startDownload(const WebCore::ResourceRequest&);
    7173
    7274    String source() const;
     
    117119    uint64_t m_policyListenerID;
    118120    WebCore::FramePolicyFunction m_policyFunction;
     121    uint64_t m_policyDownloadID;
    119122
    120123    WebFrameLoaderClient m_frameLoaderClient;
  • trunk/WebKit2/WebProcess/WebPage/WebPage.cpp

    r70564 r70585  
    645645}
    646646
    647 void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction)
     647void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID)
    648648{
    649649    WebFrame* frame = WebProcess::shared().webFrame(frameID);
    650650    if (!frame)
    651651        return;
    652     frame->didReceivePolicyDecision(listenerID, static_cast<WebCore::PolicyAction>(policyAction));
     652    frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), downloadID);
    653653}
    654654
  • trunk/WebKit2/WebProcess/WebPage/WebPage.h

    r70504 r70585  
    221221    void updatePreferences(const WebPreferencesStore&);
    222222
    223     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction);
     223    void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID);
    224224    void setCustomUserAgent(const String&);
    225225
  • trunk/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r70097 r70585  
    4444    StopLoading()
    4545
    46     DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction)
     46    DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID)
    4747
    4848    GetRenderTreeExternalRepresentation(uint64_t callbackID)
Note: See TracChangeset for help on using the changeset viewer.