CachedResourceRequest.cpp [plain text]
#include "config.h"
#include "CachedResourceRequest.h"
#include "CachedResourceLoader.h"
#include "Document.h"
#include "Element.h"
namespace WebCore {
CachedResourceRequest::CachedResourceRequest(const ResourceRequest& resourceRequest, const String& charset, Optional<ResourceLoadPriority> priority)
: m_resourceRequest(resourceRequest)
, m_charset(charset)
, m_options(CachedResourceLoader::defaultCachedResourceOptions())
, m_priority(priority)
, m_forPreload(false)
, m_defer(NoDefer)
{
}
CachedResourceRequest::CachedResourceRequest(const ResourceRequest& resourceRequest, const ResourceLoaderOptions& options)
: m_resourceRequest(resourceRequest)
, m_options(options)
, m_forPreload(false)
, m_defer(NoDefer)
{
}
CachedResourceRequest::CachedResourceRequest(const ResourceRequest& resourceRequest, Optional<ResourceLoadPriority> priority)
: m_resourceRequest(resourceRequest)
, m_options(CachedResourceLoader::defaultCachedResourceOptions())
, m_priority(priority)
, m_forPreload(false)
, m_defer(NoDefer)
{
}
CachedResourceRequest::~CachedResourceRequest()
{
}
void CachedResourceRequest::setInitiator(PassRefPtr<Element> element)
{
ASSERT(!m_initiatorElement && m_initiatorName.isEmpty());
m_initiatorElement = element;
}
void CachedResourceRequest::setInitiator(const AtomicString& name)
{
ASSERT(!m_initiatorElement && m_initiatorName.isEmpty());
m_initiatorName = name;
}
void CachedResourceRequest::setInitiator(DocumentLoader& documentLoader)
{
m_initiatingDocumentLoader = &documentLoader;
}
const AtomicString& CachedResourceRequest::initiatorName() const
{
if (m_initiatorElement)
return m_initiatorElement->localName();
if (!m_initiatorName.isEmpty())
return m_initiatorName;
DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, defaultName, ("resource", AtomicString::ConstructFromLiteral));
return defaultName;
}
}