ThreadableLoader.h [plain text]
#ifndef ThreadableLoader_h
#define ThreadableLoader_h
#include "ResourceLoaderOptions.h"
#include <wtf/Noncopyable.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
#include <wtf/text/AtomicString.h>
namespace WebCore {
class ResourceError;
class ResourceRequest;
class ResourceResponse;
class ScriptExecutionContext;
class SecurityOrigin;
class ThreadableLoaderClient;
enum CrossOriginRequestPolicy {
DenyCrossOriginRequests,
UseAccessControl,
AllowCrossOriginRequests
};
enum PreflightPolicy {
ConsiderPreflight,
ForcePreflight,
PreventPreflight
};
enum class ContentSecurityPolicyEnforcement {
DoNotEnforce,
EnforceChildSrcDirective,
EnforceConnectSrcDirective,
EnforceScriptSrcDirective,
};
struct ThreadableLoaderOptions : ResourceLoaderOptions {
ThreadableLoaderOptions();
ThreadableLoaderOptions(const ResourceLoaderOptions&, PreflightPolicy, CrossOriginRequestPolicy, ContentSecurityPolicyEnforcement, String&& initiator);
~ThreadableLoaderOptions();
PreflightPolicy preflightPolicy { ConsiderPreflight };
CrossOriginRequestPolicy crossOriginRequestPolicy { DenyCrossOriginRequests };
ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement { ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective };
String initiator; };
class ThreadableLoader {
WTF_MAKE_NONCOPYABLE(ThreadableLoader);
public:
static void loadResourceSynchronously(ScriptExecutionContext*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
static RefPtr<ThreadableLoader> create(ScriptExecutionContext*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&);
virtual void cancel() = 0;
void ref() { refThreadableLoader(); }
void deref() { derefThreadableLoader(); }
protected:
ThreadableLoader() { }
virtual ~ThreadableLoader() { }
virtual void refThreadableLoader() = 0;
virtual void derefThreadableLoader() = 0;
};
}
#endif // ThreadableLoader_h