| Index: third_party/WebKit/Source/core/fetch/FontResource.cpp
|
| diff --git a/third_party/WebKit/Source/core/fetch/FontResource.cpp b/third_party/WebKit/Source/core/fetch/FontResource.cpp
|
| index 51d6faab1163d3bce06a2fd7e537647fe4ccc365..163cf4c2edf39f8d37c586f8fda8e933a5d65d37 100644
|
| --- a/third_party/WebKit/Source/core/fetch/FontResource.cpp
|
| +++ b/third_party/WebKit/Source/core/fetch/FontResource.cpp
|
| @@ -79,7 +79,7 @@ PassRefPtrWillBeRawPtr<FontResource> FontResource::fetch(FetchRequest& request,
|
|
|
| FontResource::FontResource(const ResourceRequest& resourceRequest)
|
| : Resource(resourceRequest, Font)
|
| - , m_state(Unloaded)
|
| + , m_loadLimitState(UnderLimit)
|
| , m_corsFailed(false)
|
| , m_fontLoadShortLimitTimer(this, &FontResource::fontLoadShortLimitCallback)
|
| , m_fontLoadLongLimitTimer(this, &FontResource::fontLoadLongLimitCallback)
|
| @@ -92,41 +92,39 @@ FontResource::~FontResource()
|
|
|
| void FontResource::didScheduleLoad()
|
| {
|
| - if (m_state == Unloaded)
|
| - m_state = LoadScheduled;
|
| + if (getStatus() == NotStarted)
|
| + setStatus(LoadStartScheduled);
|
| }
|
|
|
| void FontResource::didUnscheduleLoad()
|
| {
|
| - if (m_state == LoadScheduled)
|
| - m_state = Unloaded;
|
| + if (getStatus() == LoadStartScheduled)
|
| + setStatus(NotStarted);
|
| }
|
|
|
| void FontResource::load(ResourceFetcher*, const ResourceLoaderOptions& options)
|
| {
|
| // Don't load the file yet. Wait for an access before triggering the load.
|
| - setLoading(true);
|
| m_options = options;
|
| if (!m_revalidatingRequest.isNull())
|
| - m_state = Unloaded;
|
| + setStatus(NotStarted);
|
| }
|
|
|
| void FontResource::didAddClient(ResourceClient* c)
|
| {
|
| ASSERT(FontResourceClient::isExpectedType(c));
|
| Resource::didAddClient(c);
|
| - if (!isLoading())
|
| + if (isLoaded())
|
| static_cast<FontResourceClient*>(c)->fontLoaded(this);
|
| - if (m_state == ShortLimitExceeded || m_state == LongLimitExceeded)
|
| + if (m_loadLimitState == ShortLimitExceeded || m_loadLimitState == LongLimitExceeded)
|
| static_cast<FontResourceClient*>(c)->fontLoadShortLimitExceeded(this);
|
| - if (m_state == LongLimitExceeded)
|
| + if (m_loadLimitState == LongLimitExceeded)
|
| static_cast<FontResourceClient*>(c)->fontLoadLongLimitExceeded(this);
|
| }
|
|
|
| void FontResource::beginLoadIfNeeded(ResourceFetcher* dl)
|
| {
|
| if (stillNeedsLoad()) {
|
| - m_state = LoadInitiated;
|
| Resource::load(dl, m_options);
|
| m_fontLoadShortLimitTimer.startOneShot(fontLoadWaitShortLimitSec, BLINK_FROM_HERE);
|
| m_fontLoadLongLimitTimer.startOneShot(fontLoadWaitLongLimitSec, BLINK_FROM_HERE);
|
| @@ -168,8 +166,8 @@ void FontResource::fontLoadShortLimitCallback(Timer<FontResource>*)
|
| {
|
| if (!isLoading())
|
| return;
|
| - ASSERT(m_state == LoadInitiated);
|
| - m_state = ShortLimitExceeded;
|
| + ASSERT(m_loadLimitState == UnderLimit);
|
| + m_loadLimitState = ShortLimitExceeded;
|
| ResourceClientWalker<FontResourceClient> walker(m_clients);
|
| while (FontResourceClient* client = walker.next())
|
| client->fontLoadShortLimitExceeded(this);
|
| @@ -179,8 +177,8 @@ void FontResource::fontLoadLongLimitCallback(Timer<FontResource>*)
|
| {
|
| if (!isLoading())
|
| return;
|
| - ASSERT(m_state == ShortLimitExceeded);
|
| - m_state = LongLimitExceeded;
|
| + ASSERT(m_loadLimitState == ShortLimitExceeded);
|
| + m_loadLimitState = LongLimitExceeded;
|
| ResourceClientWalker<FontResourceClient> walker(m_clients);
|
| while (FontResourceClient* client = walker.next())
|
| client->fontLoadLongLimitExceeded(this);
|
|
|