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

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

Issue 2453813004: WebFonts cache-aware timeout adaptation (Closed)
Patch Set: unit test, rebase, grammar 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.h
diff --git a/third_party/WebKit/Source/core/fetch/FontResource.h b/third_party/WebKit/Source/core/fetch/FontResource.h
index e83ab315a525782642b34205c432c2d1cc84114f..e8543ad0e91052355207852be5e2996083314365 100644
--- a/third_party/WebKit/Source/core/fetch/FontResource.h
+++ b/third_party/WebKit/Source/core/fetch/FontResource.h
@@ -67,6 +67,8 @@ class CORE_EXPORT FontResource final : public Resource {
bool italic,
FontOrientation = FontOrientation::Horizontal);
+ void willReloadAfterDiskCacheMiss() override;
+
private:
class FontResourceFactory : public ResourceFactory {
public:
@@ -83,12 +85,16 @@ class CORE_EXPORT FontResource final : public Resource {
void checkNotify() override;
void fontLoadShortLimitCallback(TimerBase*);
void fontLoadLongLimitCallback(TimerBase*);
+ void notifyClientsShortLimitExceeded();
+ void notifyClientsLongLimitExceeded();
+ // This is used in UMA histograms, should not change order.
enum LoadLimitState {
LoadNotStarted,
UnderLimit,
ShortLimitExceeded,
- LongLimitExceeded
+ LongLimitExceeded,
+ LoadLimitStateEnumMax
};
std::unique_ptr<FontCustomPlatformData> m_fontData;
@@ -99,6 +105,7 @@ class CORE_EXPORT FontResource final : public Resource {
Timer<FontResource> m_fontLoadLongLimitTimer;
friend class MemoryCache;
+ friend class FontResourceTestWrapper;
};
DEFINE_RESOURCE_TYPE_CASTS(Font);
@@ -110,6 +117,10 @@ class FontResourceClient : public ResourceClient {
return client->getResourceClientType() == FontType;
}
ResourceClientType getResourceClientType() const final { return FontType; }
+
+ // If cache-aware loading is activated, both callbacks will be blocked until
+ // disk cache miss. Calls to addClient() and removeClient() in both callbacks
+ // are prohibited to prevent race issues regarding current loading state.
virtual void fontLoadShortLimitExceeded(FontResource*) {}
virtual void fontLoadLongLimitExceeded(FontResource*) {}
};

Powered by Google App Engine
This is Rietveld 408576698