Remove DetachCache and AttachCache.

Change-Id: I78697bed25f5d26ad91318b1fa3efbfc697a428a
Reviewed-on: https://skia-review.googlesource.com/113275
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
Herb Derby 2018-03-09 16:40:48 -05:00 committed by Skia Commit-Bot
parent b5502b2012
commit 82a36ac4e6
2 changed files with 1 additions and 30 deletions

View File

@ -522,10 +522,6 @@ SkExclusiveStrikePtr SkGlyphCache::FindOrCreateStrikeExclusive(
return FindOrCreateStrikeExclusive(*desc, effects, *tf);
}
void SkGlyphCache::AttachCache(SkGlyphCache* cache) {
SkGlyphCache_Globals::AttachCache(cache);
}
void SkGlyphCache::ForEachStrike(std::function<void(const SkGlyphCache&)> visitor) {
SkGlyphCache_Globals& globals = get_globals();
SkAutoExclusive ac(globals.fLock);
@ -799,10 +795,3 @@ void SkGraphics::PurgeFontCache() {
SkTypefaceCache::PurgeAll();
}
SkGlyphCache* SkGlyphCache::DetachCache(
SkTypeface* typeface, const SkScalerContextEffects& effects, const SkDescriptor* desc)
{
auto cache = FindOrCreateStrikeExclusive(*desc, effects, *typeface);
return cache.release();
}

View File

@ -32,7 +32,7 @@ using SkExclusiveStrikePtr = std::unique_ptr<
it and then adding it to the strike.
The strikes are held in a global list, available to all threads. To interact with one, call
either Find*() or (Deprecated)DetachCache().
either Find{OrCreate}Exclusive().
The Find*Exclusive() method returns SkExclusiveStrikePtr, which releases exclusive ownership
when they go out of scope.
@ -123,13 +123,6 @@ public:
SkScalerContext* getScalerContext() const { return fScalerContext.get(); }
/** Given a strike that was returned by DetachCache() add it back into
the global cache list (after which the caller should not reference it anymore.
DEPRECATED - Use Find* and rely on RAII.
*/
static void AttachCache(SkGlyphCache*);
static SkExclusiveStrikePtr FindStrikeExclusive(const SkDescriptor& desc);
template <typename ScalerContextCreator>
@ -173,17 +166,6 @@ public:
return SkExclusiveStrikePtr(new SkGlyphCache(desc, std::move(context)));
}
/** Detach a strike from the global cache matching the specified descriptor. Once detached,
it can be queried/modified by the current thread, and when finished, be reattached to the
global cache with AttachCache(). While detached, if another request is made with the same
descriptor, a different strike will be generated. This is fine. It does mean we can have
more than 1 strike for the same descriptor, but that will eventually get purged, and the
win is that different thread will never block each other while a strike is being used.
DEPRECATED
*/
static SkGlyphCache* DetachCache(
SkTypeface* typeface, const SkScalerContextEffects& effects, const SkDescriptor* desc);
static void Dump();
/** Dump memory usage statistics of all the attaches caches in the process using the