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

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

Issue 457273002: Webfonts should not block load event for more than one frame (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merge flags into an enum Created 6 years, 4 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
« no previous file with comments | « Source/core/fetch/FontResource.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/FontResource.cpp
diff --git a/Source/core/fetch/FontResource.cpp b/Source/core/fetch/FontResource.cpp
index 52ab3a1a1157bced05ad972bd5de4a3eb810c12d..1e99662cdbb3e9131f258cefe5b562f10c87ccc1 100644
--- a/Source/core/fetch/FontResource.cpp
+++ b/Source/core/fetch/FontResource.cpp
@@ -76,7 +76,7 @@ static void recordPackageFormatHistogram(FontPackageFormat format)
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)
@@ -95,6 +95,18 @@ void FontResource::trace(Visitor* visitor)
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.
@@ -112,8 +124,8 @@ void FontResource::didAddClient(ResourceClient* c)
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);
« no previous file with comments | « Source/core/fetch/FontResource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698