NetworkSession.cpp [plain text]
#include "config.h"
#include "NetworkSession.h"
#include "NetworkDataTask.h"
#include <WebCore/NetworkStorageSession.h>
#include <wtf/MainThread.h>
#include <wtf/RunLoop.h>
#if PLATFORM(COCOA)
#include "NetworkSessionCocoa.h"
#endif
#if USE(SOUP)
#include "NetworkSessionSoup.h"
#endif
#if USE(CURL)
#include "NetworkSessionCurl.h"
#endif
using namespace WebCore;
namespace WebKit {
Ref<NetworkSession> NetworkSession::create(NetworkSessionCreationParameters&& parameters)
{
#if PLATFORM(COCOA)
return NetworkSessionCocoa::create(WTFMove(parameters));
#endif
#if USE(SOUP)
return NetworkSessionSoup::create(WTFMove(parameters));
#endif
#if USE(CURL)
return NetworkSessionCurl::create(WTFMove(parameters));
#endif
}
NetworkStorageSession& NetworkSession::networkStorageSession() const
{
auto* storageSession = NetworkStorageSession::storageSession(m_sessionID);
RELEASE_ASSERT(storageSession);
return *storageSession;
}
NetworkSession::NetworkSession(PAL::SessionID sessionID)
: m_sessionID(sessionID)
{
}
NetworkSession::~NetworkSession()
{
}
void NetworkSession::invalidateAndCancel()
{
for (auto* task : m_dataTaskSet)
task->invalidateAndCancel();
}
bool NetworkSession::allowsSpecificHTTPSCertificateForHost(const WebCore::AuthenticationChallenge& challenge)
{
#if PLATFORM(COCOA)
return NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost(challenge);
#else
return false;
#endif
}
}