Commit fd8f403d authored by Olivier Yiptong's avatar Olivier Yiptong Committed by Commit Bot

FontAccess: Consolidate cache readiness hook

Consolidate the cache readiness hook implementations in the base class
because all the implementations ended up the same.

Bug: 1043306
Change-Id: I814c4eb4ca464247336f263ba98af1a1dfd39d7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422352
Commit-Queue: Olivier Yiptong <oyiptong@chromium.org>
Reviewed-by: default avatarJoshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809499}
parent c4876854
...@@ -43,6 +43,12 @@ void FontEnumerationCache::QueueShareMemoryRegionWhenReady( ...@@ -43,6 +43,12 @@ void FontEnumerationCache::QueueShareMemoryRegionWhenReady(
} }
} }
bool FontEnumerationCache::IsFontEnumerationCacheReady() {
DCHECK(base::FeatureList::IsEnabled(blink::features::kFontAccess));
return enumeration_cache_built_.IsSet() && IsFontEnumerationCacheValid();
}
void FontEnumerationCache::ResetStateForTesting() { void FontEnumerationCache::ResetStateForTesting() {
callbacks_task_runner_ = callbacks_task_runner_ =
base::MakeRefCounted<base::DeferredSequencedTaskRunner>(); base::MakeRefCounted<base::DeferredSequencedTaskRunner>();
......
...@@ -45,7 +45,7 @@ class CONTENT_EXPORT FontEnumerationCache { ...@@ -45,7 +45,7 @@ class CONTENT_EXPORT FontEnumerationCache {
// Returns whether the cache population has completed and the shared memory // Returns whether the cache population has completed and the shared memory
// region is ready. // region is ready.
virtual bool IsFontEnumerationCacheReady() = 0; bool IsFontEnumerationCacheReady();
void ResetStateForTesting(); void ResetStateForTesting();
......
...@@ -63,12 +63,6 @@ FontEnumerationCache* FontEnumerationCache::GetInstance() { ...@@ -63,12 +63,6 @@ FontEnumerationCache* FontEnumerationCache::GetInstance() {
return instance.get(); return instance.get();
} }
bool FontEnumerationCacheFontconfig::IsFontEnumerationCacheReady() {
DCHECK(base::FeatureList::IsEnabled(blink::features::kFontAccess));
return enumeration_cache_built_.IsSet() && IsFontEnumerationCacheValid();
}
void FontEnumerationCacheFontconfig::SchedulePrepareFontEnumerationCache() { void FontEnumerationCacheFontconfig::SchedulePrepareFontEnumerationCache() {
DCHECK(base::FeatureList::IsEnabled(blink::features::kFontAccess)); DCHECK(base::FeatureList::IsEnabled(blink::features::kFontAccess));
......
...@@ -26,9 +26,6 @@ class CONTENT_EXPORT FontEnumerationCacheFontconfig ...@@ -26,9 +26,6 @@ class CONTENT_EXPORT FontEnumerationCacheFontconfig
static FontEnumerationCacheFontconfig* GetInstance(); static FontEnumerationCacheFontconfig* GetInstance();
// FontEnumerationCache interface.
bool IsFontEnumerationCacheReady() override;
protected: protected:
// FontEnumerationCache interface. // FontEnumerationCache interface.
void SchedulePrepareFontEnumerationCache() override; void SchedulePrepareFontEnumerationCache() override;
......
...@@ -31,9 +31,6 @@ class CONTENT_EXPORT FontEnumerationCacheMac : public FontEnumerationCache { ...@@ -31,9 +31,6 @@ class CONTENT_EXPORT FontEnumerationCacheMac : public FontEnumerationCache {
static FontEnumerationCacheMac* GetInstance(); static FontEnumerationCacheMac* GetInstance();
// FontEnumerationCache interface.
bool IsFontEnumerationCacheReady() override;
protected: protected:
// FontEnumerationCache interface. // FontEnumerationCache interface.
void SchedulePrepareFontEnumerationCache() override; void SchedulePrepareFontEnumerationCache() override;
......
...@@ -45,12 +45,6 @@ FontEnumerationCache* FontEnumerationCache::GetInstance() { ...@@ -45,12 +45,6 @@ FontEnumerationCache* FontEnumerationCache::GetInstance() {
return instance.get(); return instance.get();
} }
bool FontEnumerationCacheMac::IsFontEnumerationCacheReady() {
DCHECK(base::FeatureList::IsEnabled(blink::features::kFontAccess));
return enumeration_cache_built_.IsSet() && IsFontEnumerationCacheValid();
}
void FontEnumerationCacheMac::SchedulePrepareFontEnumerationCache() { void FontEnumerationCacheMac::SchedulePrepareFontEnumerationCache() {
DCHECK(base::FeatureList::IsEnabled(blink::features::kFontAccess)); DCHECK(base::FeatureList::IsEnabled(blink::features::kFontAccess));
......
...@@ -185,12 +185,6 @@ FontEnumerationCache* FontEnumerationCache::GetInstance() { ...@@ -185,12 +185,6 @@ FontEnumerationCache* FontEnumerationCache::GetInstance() {
return instance.get(); return instance.get();
} }
bool FontEnumerationCacheWin::IsFontEnumerationCacheReady() {
DCHECK(base::FeatureList::IsEnabled(blink::features::kFontAccess));
return enumeration_cache_built_.IsSet() && IsFontEnumerationCacheValid();
}
void FontEnumerationCacheWin::InitializeDirectWrite() { void FontEnumerationCacheWin::InitializeDirectWrite() {
if (direct_write_initialized_) if (direct_write_initialized_)
return; return;
......
...@@ -45,9 +45,6 @@ class CONTENT_EXPORT FontEnumerationCacheWin : public FontEnumerationCache { ...@@ -45,9 +45,6 @@ class CONTENT_EXPORT FontEnumerationCacheWin : public FontEnumerationCache {
}; };
static FontEnumerationCacheWin* GetInstance(); static FontEnumerationCacheWin* GetInstance();
// FontEnumerationCache interface.
bool IsFontEnumerationCacheReady() override;
protected: protected:
// FontEnumerationCache interface. // FontEnumerationCache interface.
void SchedulePrepareFontEnumerationCache() override; void SchedulePrepareFontEnumerationCache() override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment