Changeset 137810 in webkit


Ignore:
Timestamp:
Dec 15, 2012, 2:04:12 PM (13 years ago)
Author:
andersca@apple.com
Message:

DownloadProxy should keep a strong reference to its associated web context
https://bugs.webkit.org/show_bug.cgi?id=105107

Reviewed by Alexey Proskuryakov.

While this does create a ref-cycle, it's broken when the download completes, fails, is canceled or
if the process that's doing the download crashes.

  • UIProcess/Downloads/DownloadProxy.cpp:

(WebKit::DownloadProxy::processDidClose):
(WebKit::DownloadProxy::didStart):
(WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
(WebKit::DownloadProxy::didReceiveResponse):
(WebKit::DownloadProxy::didReceiveData):
(WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType):
(WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
(WebKit::DownloadProxy::didCreateDestination):
(WebKit::DownloadProxy::didFinish):
(WebKit::DownloadProxy::didFail):
(WebKit::DownloadProxy::didCancel):

  • UIProcess/Downloads/DownloadProxy.h:

(DownloadProxy):

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r137809 r137810  
     12012-12-15  Anders Carlsson  <andersca@apple.com>
     2
     3        DownloadProxy should keep a strong reference to its associated web context
     4        https://bugs.webkit.org/show_bug.cgi?id=105107
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        While this does create a ref-cycle, it's broken when the download completes, fails, is canceled or
     9        if the process that's doing the download crashes.
     10
     11        * UIProcess/Downloads/DownloadProxy.cpp:
     12        (WebKit::DownloadProxy::processDidClose):
     13        (WebKit::DownloadProxy::didStart):
     14        (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
     15        (WebKit::DownloadProxy::didReceiveResponse):
     16        (WebKit::DownloadProxy::didReceiveData):
     17        (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType):
     18        (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
     19        (WebKit::DownloadProxy::didCreateDestination):
     20        (WebKit::DownloadProxy::didFinish):
     21        (WebKit::DownloadProxy::didFail):
     22        (WebKit::DownloadProxy::didCancel):
     23        * UIProcess/Downloads/DownloadProxy.h:
     24        (DownloadProxy):
     25
    1262012-12-15  Anders Carlsson  <andersca@apple.com>
    227
  • trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp

    r137809 r137810  
    8383        return;
    8484
    85     m_webContext->downloadClient().processDidCrash(m_webContext, this);
     85    m_webContext->downloadClient().processDidCrash(m_webContext.get(), this);
    8686}
    8787
     
    103103        return;
    104104
    105     m_webContext->downloadClient().didStart(m_webContext, this);
     105    m_webContext->downloadClient().didStart(m_webContext.get(), this);
    106106}
    107107
     
    114114    // Once this is fixed, remove WebContext::deprecatedSharedProcess().
    115115    RefPtr<AuthenticationChallengeProxy> authenticationChallengeProxy = AuthenticationChallengeProxy::create(authenticationChallenge, challengeID, m_webContext->deprecatedSharedProcess());
    116     m_webContext->downloadClient().didReceiveAuthenticationChallenge(m_webContext, this, authenticationChallengeProxy.get());
     116    m_webContext->downloadClient().didReceiveAuthenticationChallenge(m_webContext.get(), this, authenticationChallengeProxy.get());
    117117}
    118118
     
    122122        return;
    123123
    124     m_webContext->downloadClient().didReceiveResponse(m_webContext, this, response);
     124    m_webContext->downloadClient().didReceiveResponse(m_webContext.get(), this, response);
    125125}
    126126
     
    130130        return;
    131131
    132     m_webContext->downloadClient().didReceiveData(m_webContext, this, length);
     132    m_webContext->downloadClient().didReceiveData(m_webContext.get(), this, length);
    133133}
    134134
     
    138138        return;
    139139
    140     result = m_webContext->downloadClient().shouldDecodeSourceDataOfMIMEType(m_webContext, this, mimeType);
     140    result = m_webContext->downloadClient().shouldDecodeSourceDataOfMIMEType(m_webContext.get(), this, mimeType);
    141141}
    142142
     
    146146        return;
    147147
    148     destination = m_webContext->downloadClient().decideDestinationWithSuggestedFilename(m_webContext, this, filename, allowOverwrite);
     148    destination = m_webContext->downloadClient().decideDestinationWithSuggestedFilename(m_webContext.get(), this, filename, allowOverwrite);
    149149
    150150    if (!destination.isNull())
     
    157157        return;
    158158
    159     m_webContext->downloadClient().didCreateDestination(m_webContext, this, path);
     159    m_webContext->downloadClient().didCreateDestination(m_webContext.get(), this, path);
    160160}
    161161
     
    165165        return;
    166166
    167     m_webContext->downloadClient().didFinish(m_webContext, this);
     167    m_webContext->downloadClient().didFinish(m_webContext.get(), this);
    168168
    169169    // This can cause the DownloadProxy object to be deleted.
     
    186186    m_resumeData = createWebData(resumeData);
    187187
    188     m_webContext->downloadClient().didFail(m_webContext, this, error);
     188    m_webContext->downloadClient().didFail(m_webContext.get(), this, error);
    189189
    190190    // This can cause the DownloadProxy object to be deleted.
     
    196196    m_resumeData = createWebData(resumeData);
    197197
    198     m_webContext->downloadClient().didCancel(m_webContext, this);
     198    m_webContext->downloadClient().didCancel(m_webContext.get(), this);
    199199
    200200    // This can cause the DownloadProxy object to be deleted.
  • trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h

    r137807 r137810  
    9292
    9393    DownloadProxyMap& m_downloadProxyMap;
    94     WebContext* m_webContext;
     94    RefPtr<WebContext> m_webContext;
    9595    uint64_t m_downloadID;
    9696
Note: See TracChangeset for help on using the changeset viewer.