Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3843)

Unified Diff: third_party/WebKit/Source/core/fetch/FontResource.cpp

Issue 1802123002: Unify Resource loading status tracking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 7610e639e6d883fe35fe57a9944a15e68f2cb491..73b1083a7af2f7e130790aa61428fd2b2113b962 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, const ResourceLoaderOptions& options)
: Resource(resourceRequest, Font, options)
- , m_state(Unloaded)
+ , m_loadLimitState(UnderLimit)
, m_corsFailed(false)
, m_fontLoadShortLimitTimer(this, &FontResource::fontLoadShortLimitCallback)
, m_fontLoadLongLimitTimer(this, &FontResource::fontLoadLongLimitCallback)
@@ -92,40 +92,38 @@ 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*)
{
// Don't load the file yet. Wait for an access before triggering the load.
- setLoading(true);
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_fontLoadShortLimitTimer.startOneShot(fontLoadWaitShortLimitSec, BLINK_FROM_HERE);
m_fontLoadLongLimitTimer.startOneShot(fontLoadWaitLongLimitSec, BLINK_FROM_HERE);
@@ -167,8 +165,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);
@@ -178,8 +176,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);

Powered by Google App Engine
This is Rietveld 408576698