ResourceHandleCFURLConnectionDelegateWithOperationQueue.h [plain text]
#pragma once
#if USE(CFURLCONNECTION)
#include "ResourceHandleCFURLConnectionDelegate.h"
#include <CFNetwork/CFNetwork.h>
#include <dispatch/queue.h>
#include <wtf/Function.h>
#include <wtf/MessageQueue.h>
#include <wtf/threads/BinarySemaphore.h>
namespace WebCore {
class ResourceHandleCFURLConnectionDelegateWithOperationQueue final : public ResourceHandleCFURLConnectionDelegate {
public:
ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle*, MessageQueue<Function<void()>>*);
virtual ~ResourceHandleCFURLConnectionDelegateWithOperationQueue();
private:
bool hasHandle() const;
void setupRequest(CFMutableURLRequestRef) override;
void setupConnectionScheduling(CFURLConnectionRef) override;
void releaseHandle() override;
CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef) override;
void didReceiveResponse(CFURLConnectionRef, CFURLResponseRef) override;
void didReceiveData(CFDataRef, CFIndex originalLength) override;
void didFinishLoading() override;
void didFail(CFErrorRef) override;
CFCachedURLResponseRef willCacheResponse(CFCachedURLResponseRef) override;
void didReceiveChallenge(CFURLAuthChallengeRef) override;
void didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite) override;
Boolean shouldUseCredentialStorage() override;
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
Boolean canRespondToProtectionSpace(CFURLProtectionSpaceRef) override;
#endif
BinarySemaphore m_semaphore;
MessageQueue<Function<void()>>* m_messageQueue { nullptr };
RetainPtr<CFURLRequestRef> m_requestResult;
RetainPtr<CFCachedURLResponseRef> m_cachedResponseResult;
bool m_boolResult { false };
};
}
#endif // USE(CFURLCONNECTION)