Changeset 206732 in webkit


Ignore:
Timestamp:
Oct 3, 2016 3:42:11 AM (8 years ago)
Author:
Carlos Garcia Campos
Message:

[SOUP] Simplify AuthenticationChallenge
https://bugs.webkit.org/show_bug.cgi?id=162784

Reviewed by Alex Christensen.

We don't really need to keep references to the SoupSession and SoupMessage in AuthenticationChallenge, the
SoupNetworkSession callback already forwards the challenge to the right ResourceHandle.

  • platform/network/soup/AuthenticationChallenge.h:

(WebCore::AuthenticationChallenge::authenticationClient):
(WebCore::AuthenticationChallenge::soupSession): Deleted.
(WebCore::AuthenticationChallenge::soupMessage): Deleted.

  • platform/network/soup/AuthenticationChallengeSoup.cpp:

(WebCore::AuthenticationChallenge::AuthenticationChallenge):
(WebCore::AuthenticationChallenge::platformCompare):

  • platform/network/soup/ResourceHandleSoup.cpp:

(WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::receivedCancellation):

  • platform/network/soup/SoupNetworkSession.cpp:

(WebCore::authenticateCallback):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r206731 r206732  
     12016-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [SOUP] Simplify AuthenticationChallenge
     4        https://bugs.webkit.org/show_bug.cgi?id=162784
     5
     6        Reviewed by Alex Christensen.
     7
     8        We don't really need to keep references to the SoupSession and SoupMessage in AuthenticationChallenge, the
     9        SoupNetworkSession callback already forwards the challenge to the right ResourceHandle.
     10
     11        * platform/network/soup/AuthenticationChallenge.h:
     12        (WebCore::AuthenticationChallenge::authenticationClient):
     13        (WebCore::AuthenticationChallenge::soupSession): Deleted.
     14        (WebCore::AuthenticationChallenge::soupMessage): Deleted.
     15        * platform/network/soup/AuthenticationChallengeSoup.cpp:
     16        (WebCore::AuthenticationChallenge::AuthenticationChallenge):
     17        (WebCore::AuthenticationChallenge::platformCompare):
     18        * platform/network/soup/ResourceHandleSoup.cpp:
     19        (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
     20        (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
     21        (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
     22        (WebCore::ResourceHandle::receivedCredential):
     23        (WebCore::ResourceHandle::receivedCancellation):
     24        * platform/network/soup/SoupNetworkSession.cpp:
     25        (WebCore::authenticateCallback):
     26
    1272016-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
    228
  • trunk/Source/WebCore/platform/network/soup/AuthenticationChallenge.h

    r165676 r206732  
    4545    }
    4646
    47     AuthenticationChallenge(SoupSession*, SoupMessage*, SoupAuth*, bool retrying, AuthenticationClient*);
     47    AuthenticationChallenge(SoupMessage*, SoupAuth*, bool retrying, AuthenticationClient* = nullptr);
    4848    AuthenticationClient* authenticationClient() const { return m_authenticationClient.get(); }
    49     SoupSession* soupSession() const { return m_soupSession.get(); }
    50     SoupMessage* soupMessage() const { return m_soupMessage.get(); }
    5149    SoupAuth* soupAuth() const { return m_soupAuth.get(); }
    5250    void setProposedCredential(const Credential& credential) { m_proposedCredential = credential; }
     
    5654    static bool platformCompare(const AuthenticationChallenge&, const AuthenticationChallenge&);
    5755
    58     GRefPtr<SoupSession> m_soupSession;
    59     GRefPtr<SoupMessage> m_soupMessage;
    6056    GRefPtr<SoupAuth> m_soupAuth;
    6157    RefPtr<AuthenticationClient> m_authenticationClient;
  • trunk/Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp

    r166001 r206732  
    6767}
    6868
    69 AuthenticationChallenge::AuthenticationChallenge(SoupSession* soupSession, SoupMessage* soupMessage, SoupAuth* soupAuth, bool retrying, AuthenticationClient* client)
     69AuthenticationChallenge::AuthenticationChallenge(SoupMessage* soupMessage, SoupAuth* soupAuth, bool retrying, AuthenticationClient* client)
    7070    : AuthenticationChallengeBase(protectionSpaceFromSoupAuthAndMessage(soupAuth, soupMessage),
    7171        Credential(), // proposedCredentials
     
    7373        soupMessage, // failureResponse
    7474        ResourceError::authenticationError(soupMessage))
    75     , m_soupSession(soupSession)
    76     , m_soupMessage(soupMessage)
    7775    , m_soupAuth(soupAuth)
    7876    , m_authenticationClient(client)
     
    8280bool AuthenticationChallenge::platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
    8381{
    84     return a.soupSession() == b.soupSession()
    85         && a.soupMessage() == b.soupMessage()
    86         && a.soupAuth() == b.soupAuth();
     82    return a.soupAuth() == b.soupAuth();
    8783}
    8884
  • trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r206731 r206732  
    970970    AuthenticationChallenge& challenge = d->m_currentWebChallenge;
    971971
    972     ASSERT(challenge.soupSession());
    973     ASSERT(challenge.soupMessage());
     972    ASSERT(d->m_soupMessage);
    974973    if (!credentialFromPersistentStorage.isEmpty())
    975974        challenge.setProposedCredential(credentialFromPersistentStorage);
    976975
    977976    if (!client()) {
    978         soup_session_unpause_message(challenge.soupSession(), challenge.soupMessage());
     977        soup_session_unpause_message(d->soupSession(), d->m_soupMessage.get());
    979978        clearAuthentication();
    980979        return;
    981980    }
    982981
    983     ASSERT(challenge.soupSession());
    984     ASSERT(challenge.soupMessage());
    985982    client()->didReceiveAuthenticationChallenge(this, challenge);
    986983}
     
    10161013
    10171014    d->m_currentWebChallenge = challenge;
    1018     soup_session_pause_message(challenge.soupSession(), challenge.soupMessage());
     1015    soup_session_pause_message(d->soupSession(), d->m_soupMessage.get());
    10191016
    10201017    // We could also do this before we even start the request, but that would be at the expense
     
    10371034    if (challenge != d->m_currentWebChallenge)
    10381035        return;
    1039     soup_session_unpause_message(challenge.soupSession(), challenge.soupMessage());
     1036    soup_session_unpause_message(d->soupSession(), d->m_soupMessage.get());
    10401037
    10411038    clearAuthentication();
     
    10681065    }
    10691066
    1070     ASSERT(challenge.soupSession());
    1071     ASSERT(challenge.soupMessage());
     1067    ASSERT(d->m_soupMessage);
    10721068    soup_auth_authenticate(challenge.soupAuth(), credential.user().utf8().data(), credential.password().utf8().data());
    1073     soup_session_unpause_message(challenge.soupSession(), challenge.soupMessage());
     1069    soup_session_unpause_message(d->soupSession(), d->m_soupMessage.get());
    10741070
    10751071    clearAuthentication();
     
    10871083    }
    10881084
    1089     ASSERT(challenge.soupSession());
    1090     ASSERT(challenge.soupMessage());
    1091     soup_session_unpause_message(challenge.soupSession(), challenge.soupMessage());
     1085    ASSERT(d->m_soupMessage);
     1086    soup_session_unpause_message(d->soupSession(), d->m_soupMessage.get());
    10921087
    10931088    if (client())
  • trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp

    r206431 r206732  
    7676}
    7777
    78 static void authenticateCallback(SoupSession* session, SoupMessage* soupMessage, SoupAuth* soupAuth, gboolean retrying)
     78static void authenticateCallback(SoupSession*, SoupMessage* soupMessage, SoupAuth* soupAuth, gboolean retrying)
    7979{
    8080    RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(G_OBJECT(soupMessage), "handle"));
    8181    if (!handle)
    8282        return;
    83     handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(session, soupMessage, soupAuth, retrying, handle.get()));
     83    handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(soupMessage, soupAuth, retrying, handle.get()));
    8484}
    8585
Note: See TracChangeset for help on using the changeset viewer.