#include "core/svg/SVGFontElement.h"
#endif
-namespace WebCore {
+namespace blink {
static const double fontLoadWaitLimitSec = 3.0;
FontResource::FontResource(const ResourceRequest& resourceRequest)
: Resource(resourceRequest, Font)
- , m_loadInitiated(false)
+ , m_state(Unloaded)
, m_exceedsFontLoadWaitLimit(false)
+ , m_corsFailed(false)
, m_fontLoadWaitLimitTimer(this, &FontResource::fontLoadWaitLimitCallback)
{
}
{
}
+void FontResource::trace(Visitor* visitor)
+{
+#if ENABLE(SVG_FONTS)
+ visitor->trace(m_externalSVGDocument);
+#endif
+ Resource::trace(visitor);
+}
+
+void FontResource::didScheduleLoad()
+{
+ if (m_state == Unloaded)
+ m_state = LoadScheduled;
+}
+
+void FontResource::didUnscheduleLoad()
+{
+ if (m_state == LoadScheduled)
+ m_state = Unloaded;
+}
+
void FontResource::load(ResourceFetcher*, const ResourceLoaderOptions& options)
{
// Don't load the file yet. Wait for an access before triggering the load.
void FontResource::beginLoadIfNeeded(ResourceFetcher* dl)
{
- if (!m_loadInitiated) {
- m_loadInitiated = true;
+ if (m_state != LoadInitiated) {
+ m_state = LoadInitiated;
Resource::load(dl, m_options);
m_fontLoadWaitLimitTimer.startOneShot(fontLoadWaitLimitSec, FROM_HERE);
if (!collectionLength)
return 0;
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
for (unsigned i = 0; i < collectionLength; ++i) {
ASSERT(collection->item(i));
ASSERT(isSVGFontElement(collection->item(i)));