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

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

Issue 2419753002: Prevent FontResource load limit timers from restarting during loading (Closed)
Patch Set: Created 4 years, 2 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 a5314e845fb10fa6267466f8558e4ad47ea417ab..74fee35c0facafba08596d25617cd59050aa96f2 100644
--- a/third_party/WebKit/Source/core/fetch/FontResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/FontResource.cpp
@@ -85,6 +85,7 @@ FontResource::FontResource(const ResourceRequest& resourceRequest,
: Resource(resourceRequest, Font, options),
m_loadLimitState(UnderLimit),
m_corsFailed(false),
+ m_isLoadLimitTimersStarted(false),
m_fontLoadShortLimitTimer(this,
&FontResource::fontLoadShortLimitCallback),
m_fontLoadLongLimitTimer(this, &FontResource::fontLoadLongLimitCallback) {
@@ -109,15 +110,14 @@ void FontResource::setRevalidatingRequest(const ResourceRequest& request) {
Resource::setRevalidatingRequest(request);
}
-void FontResource::startLoadLimitTimersIfNeeded() {
- DCHECK(!stillNeedsLoad());
- if (isLoaded() || m_fontLoadLongLimitTimer.isActive())
- return;
+void FontResource::startLoadLimitTimers() {
+ DCHECK(!m_isLoadLimitTimersStarted);
Kunihiko Sakamoto 2016/10/13 05:55:19 Can you add DCHECK(isLoading()) here?
Shao-Chuan Lee 2016/10/13 06:12:58 Done.
DCHECK_EQ(m_loadLimitState, UnderLimit);
m_fontLoadShortLimitTimer.startOneShot(fontLoadWaitShortLimitSec,
BLINK_FROM_HERE);
m_fontLoadLongLimitTimer.startOneShot(fontLoadWaitLongLimitSec,
BLINK_FROM_HERE);
+ m_isLoadLimitTimersStarted = true;
}
bool FontResource::ensureCustomFontData() {
@@ -172,6 +172,7 @@ void FontResource::allClientsAndObserversRemoved() {
void FontResource::checkNotify() {
m_fontLoadShortLimitTimer.stop();
m_fontLoadLongLimitTimer.stop();
+ m_isLoadLimitTimersStarted = false;
Kunihiko Sakamoto 2016/10/13 05:55:19 Does this mean startLoadLimitTimers() can be calle
Shao-Chuan Lee 2016/10/13 06:12:58 Yes, in revalidation cases.
Kunihiko Sakamoto 2016/10/13 06:36:18 Hm, then we have to reset m_loadLimitState too? Ca
Shao-Chuan Lee 2016/10/13 07:14:06 Adding new LoadLimitState to indicate that timers
Resource::checkNotify();
}

Powered by Google App Engine
This is Rietveld 408576698