ApplicationCacheResource.h [plain text]
#pragma once
#include "SubstituteResource.h"
namespace WebCore {
class ApplicationCacheResource : public SubstituteResource {
public:
enum Type {
Master = 1 << 0,
Manifest = 1 << 1,
Explicit = 1 << 2,
Foreign = 1 << 3,
Fallback = 1 << 4
};
static Ref<ApplicationCacheResource> create(const URL& url, const ResourceResponse& response, unsigned type, RefPtr<SharedBuffer> buffer = SharedBuffer::create(), const String& path = String())
{
ASSERT(!url.hasFragmentIdentifier());
if (!buffer)
buffer = SharedBuffer::create();
return adoptRef(*new ApplicationCacheResource(url, response, type, buffer.releaseNonNull(), path));
}
unsigned type() const { return m_type; }
void addType(unsigned type);
void setStorageID(unsigned storageID) { m_storageID = storageID; }
unsigned storageID() const { return m_storageID; }
void clearStorageID() { m_storageID = 0; }
int64_t estimatedSizeInStorage();
const String& path() const { return m_path; }
void setPath(const String& path) { m_path = path; }
#ifndef NDEBUG
static void dumpType(unsigned type);
#endif
private:
ApplicationCacheResource(const URL&, const ResourceResponse&, unsigned type, Ref<SharedBuffer>&&, const String& path);
void deliver(ResourceLoader&) override;
unsigned m_type;
unsigned m_storageID;
int64_t m_estimatedSizeInStorage;
String m_path;
};
}