[Webkit-unassigned] [Bug 163777] NetworkSession: switch to use subclasses for NetworkSession and NetworkDataTask implementations

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Oct 23 02:18:36 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=163777

--- Comment #11 from Carlos Garcia Campos <cgarcia at igalia.com> ---
Comment on attachment 292471
  --> https://bugs.webkit.org/attachment.cgi?id=292471
Patch to be applied after the main patch

View in context: https://bugs.webkit.org/attachment.cgi?id=292471&action=review

> network_session/OpenSource/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.h:64
> +public:

This is not correct, I think, the problem is that NetworkSessionCocoa is using NetworkDataTaskCocoa::suggestedFilename() directly, so the solution would be to cast there to use NetworkDataTask::suggestedFilename() instead. I think these overrides should remain private.

> network_session/OpenSource/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:-95
> +    auto& cocoaSession = reinterpret_cast<NetworkSessionCocoa&>(m_session.get()); // downcast<NetworkSessionCocoa>(m_session.get());
>      if (storedCredentials == WebCore::AllowStoredCredentials) {
> -        m_task = [downcast<NetworkSessionCocoa>(m_session.get()).m_sessionWithCredentialStorage dataTaskWithRequest:nsRequest];
> -        ASSERT(!downcast<NetworkSessionCocoa>(m_session.get()).m_dataTaskMapWithCredentials.contains([m_task taskIdentifier]));
> -        downcast<NetworkSessionCocoa>(m_session.get()).m_dataTaskMapWithCredentials.add([m_task taskIdentifier], this);

I don't know why it worked for Soup, though. I guess we need to either add type traits (adding a pure virtual type() or several isFoo() methods to NetworkSession) or simply use reinterpret_cast since here the network session should always be NetworkSessionCocoa.

> network_session/OpenSource/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm:463
> -NetworkSessionCocoa::~NetworkSession()
> +NetworkSessionCocoa::~NetworkSessionCocoa()

Oops, I forgot this.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20161023/9830eb78/attachment.html>


More information about the webkit-unassigned mailing list