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

Unified Diff: third_party/WebKit/Source/core/loader/resource/FontResource.h

Issue 2556683003: Reland: WebFonts cache-aware timeout adaptation (Closed)
Patch Set: rebase Created 4 years 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/loader/resource/FontResource.h
diff --git a/third_party/WebKit/Source/core/loader/resource/FontResource.h b/third_party/WebKit/Source/core/loader/resource/FontResource.h
index 2e1fffa3b97e4657d72b4d00d4d680a358a998e6..e1da23354a720366db86adebe1ff2cab91a7adf5 100644
--- a/third_party/WebKit/Source/core/loader/resource/FontResource.h
+++ b/third_party/WebKit/Source/core/loader/resource/FontResource.h
@@ -26,6 +26,7 @@
#ifndef FontResource_h
#define FontResource_h
+#include "base/gtest_prod_util.h"
#include "core/CoreExport.h"
#include "core/fetch/Resource.h"
#include "core/fetch/ResourceClient.h"
@@ -72,6 +73,8 @@ class CORE_EXPORT FontResource final : public Resource {
// font is not needed for painting the text.
bool isLowPriorityLoadingAllowedForRemoteFont() const;
+ void willReloadAfterDiskCacheMiss() override;
+
void onMemoryDump(WebMemoryDumpLevelOfDetail,
WebProcessMemoryDump*) const override;
@@ -91,12 +94,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;
@@ -107,6 +114,7 @@ class CORE_EXPORT FontResource final : public Resource {
Timer<FontResource> m_fontLoadLongLimitTimer;
friend class MemoryCache;
+ FRIEND_TEST_ALL_PREFIXES(FontResourceTest, CacheAwareFontLoading);
};
DEFINE_RESOURCE_TYPE_CASTS(Font);
@@ -118,6 +126,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