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

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

Issue 2438033003: [NOT FOR COMMIT] Layout test for WebFonts cache-aware timeout adaption (Closed)
Patch Set: rebase Created 4 years, 1 month 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 dee2a22b3e9d2e469c0e347fc2c872d31b25f055..13b1112e5af1790b9e241975cb59ff7e25cd29e4 100644
--- a/third_party/WebKit/Source/core/fetch/FontResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/FontResource.cpp
@@ -88,6 +88,7 @@ FontResource::FontResource(const ResourceRequest& resourceRequest,
: Resource(resourceRequest, Font, options),
m_loadLimitState(LoadNotStarted),
m_corsFailed(false),
+ m_isCallbackDisabledForTesting(false),
m_fontLoadShortLimitTimer(this,
&FontResource::fontLoadShortLimitCallback),
m_fontLoadLongLimitTimer(this, &FontResource::fontLoadLongLimitCallback) {
@@ -153,8 +154,10 @@ FontPlatformData FontResource::platformDataFromCustomData(
}
void FontResource::willReloadAfterDiskCacheMiss() {
+ if (m_isCallbackDisabledForTesting)
+ return;
+
DCHECK(isLoading());
- DCHECK(loader()->isCacheAwareLoadingActivated());
if (m_loadLimitState == ShortLimitExceeded ||
m_loadLimitState == LongLimitExceeded)
@@ -173,6 +176,9 @@ void FontResource::fontLoadShortLimitCallback(TimerBase*) {
DCHECK_EQ(m_loadLimitState, UnderLimit);
m_loadLimitState = ShortLimitExceeded;
+ if (m_isCallbackDisabledForTesting)
+ return;
+
// Block client callbacks if currently loading from cache.
if (loader()->isCacheAwareLoadingActivated())
return;
@@ -184,6 +190,9 @@ void FontResource::fontLoadLongLimitCallback(TimerBase*) {
DCHECK_EQ(m_loadLimitState, ShortLimitExceeded);
m_loadLimitState = LongLimitExceeded;
+ if (m_isCallbackDisabledForTesting)
+ return;
+
// Block client callbacks if currently loading from cache.
if (loader()->isCacheAwareLoadingActivated())
return;

Powered by Google App Engine
This is Rietveld 408576698