Make SkRemoteGlyphCache tests use private glyph cache

Change-Id: If6aa189f3badc7558ab8ecf71ee3d704b275b20f
Reviewed-on: https://skia-review.googlesource.com/136225
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Herb Derby 2018-06-20 14:43:23 -04:00 committed by Skia Commit-Bot
parent b70e3b4831
commit 3e36ce6e66
7 changed files with 131 additions and 78 deletions

View File

@ -734,8 +734,11 @@ private:
sk_sp<DiscardableHandleManager> fManager;
};
SkStrikeClient::SkStrikeClient(sk_sp<DiscardableHandleManager> discardableManager, bool isLogging)
SkStrikeClient::SkStrikeClient(sk_sp<DiscardableHandleManager> discardableManager,
bool isLogging,
SkStrikeCache* strikeCache)
: fDiscardableHandleManager(std::move(discardableManager))
, fStrikeCache{strikeCache ? strikeCache : SkStrikeCache::GetGlobalStrikeCache()}
, fIsLogging{isLogging} {}
SkStrikeClient::~SkStrikeClient() = default;
@ -792,18 +795,19 @@ bool SkStrikeClient::readStrikeData(const volatile void* memory, size_t memorySi
SkAutoDescriptor ad;
auto* client_desc = auto_descriptor_from_desc(sourceAd.getDesc(), tf->uniqueID(), &ad);
auto strike = SkStrikeCache::FindStrikeExclusive(*client_desc);
auto strike = fStrikeCache->findStrikeExclusive(*client_desc);
if (strike == nullptr) {
// Note that we don't need to deserialize the effects since we won't be generating any
// glyphs here anyway, and the desc is still correct since it includes the serialized
// effects.
SkScalerContextEffects effects;
auto scaler = SkStrikeCache::CreateScalerContext(*client_desc, effects, *tf);
strike = SkStrikeCache::CreateStrikeExclusive(
strike = fStrikeCache->createStrikeExclusive(
*client_desc, std::move(scaler), &fontMetrics,
skstd::make_unique<DiscardableStrikePinner>(spec.discardableHandleId,
fDiscardableHandleManager));
static_cast<SkScalerContextProxy*>(strike->getScalerContext())->initCache(strike.get());
auto proxyContext = static_cast<SkScalerContextProxy*>(strike->getScalerContext());
proxyContext->initCache(strike.get(), fStrikeCache);
}
size_t glyphImagesCount = 0u;
@ -865,7 +869,7 @@ sk_sp<SkTypeface> SkStrikeClient::deserializeTypeface(const void* buf, size_t le
WireTypeface wire;
if (len != sizeof(wire)) return nullptr;
memcpy(&wire, buf, sizeof(wire));
return addTypeface(wire);
return this->addTypeface(wire);
}
sk_sp<SkTypeface> SkStrikeClient::addTypeface(const WireTypeface& wire) {

View File

@ -20,7 +20,6 @@
#include "SkMakeUnique.h"
#include "SkNoDrawCanvas.h"
#include "SkRefCnt.h"
#include "SkRemoteGlyphCache.h"
#include "SkSerialProcs.h"
#include "SkTypeface.h"
@ -30,6 +29,7 @@ class SkGlyphCache;
struct SkPackedGlyphID;
enum SkScalerContextFlags : uint32_t;
class SkScalerContextRecDescriptor;
class SkStrikeCache;
class SkTextBlobRunIterator;
class SkTypefaceProxy;
struct WireTypeface;
@ -212,7 +212,9 @@ public:
virtual void notifyCacheMiss(CacheMissType) {}
};
SkStrikeClient(sk_sp<DiscardableHandleManager>, bool isLogging = true);
SkStrikeClient(sk_sp<DiscardableHandleManager>,
bool isLogging = true,
SkStrikeCache* strikeCache = nullptr);
~SkStrikeClient();
// Deserializes the typeface previously serialized using the SkStrikeServer. Returns null if the
@ -223,7 +225,9 @@ public:
// from a server when serializing the ops must be deserialized before the op
// is rasterized.
// Returns false if the data is invalid.
bool readStrikeData(const volatile void* memory, size_t memorySize);
bool readStrikeData(
const volatile void* memory,
size_t memorySize);
private:
class DiscardableStrikePinner;
@ -232,6 +236,7 @@ private:
SkTHashMap<SkFontID, sk_sp<SkTypeface>> fRemoteFontIdToTypeface;
sk_sp<DiscardableHandleManager> fDiscardableHandleManager;
SkStrikeCache* const fStrikeCache;
const bool fIsLogging;
};

View File

@ -19,15 +19,6 @@
#include "SkTypefaceCache.h"
#include "SkPaintPriv.h"
// Returns the shared globals
static SkStrikeCache& get_globals() {
static SkOnce once;
static SkStrikeCache* globals;
once([]{ globals = new SkStrikeCache; });
return *globals;
}
struct SkStrikeCache::Node {
Node(const SkDescriptor& desc,
std::unique_ptr<SkScalerContext> scaler,
@ -42,23 +33,35 @@ struct SkStrikeCache::Node {
std::unique_ptr<SkStrikePinner> fPinner;
};
SkStrikeCache::ExclusiveStrikePtr::ExclusiveStrikePtr(SkStrikeCache::Node* node) : fNode{node} {}
SkStrikeCache::ExclusiveStrikePtr::ExclusiveStrikePtr() : fNode{nullptr} {}
SkStrikeCache::ExclusiveStrikePtr::ExclusiveStrikePtr(
SkStrikeCache::Node* node, SkStrikeCache* strikeCache)
: fNode{node}
, fStrikeCache{strikeCache} {}
SkStrikeCache::ExclusiveStrikePtr::ExclusiveStrikePtr()
: fNode{nullptr}
, fStrikeCache{nullptr} {}
SkStrikeCache::ExclusiveStrikePtr::ExclusiveStrikePtr(ExclusiveStrikePtr&& o)
: fNode{o.fNode} {
: fNode{o.fNode}, fStrikeCache{o.fStrikeCache} {
o.fNode = nullptr;
o.fStrikeCache = nullptr;
}
SkStrikeCache::ExclusiveStrikePtr&
SkStrikeCache::ExclusiveStrikePtr::operator = (ExclusiveStrikePtr&& o) {
Attach(fNode);
if (fNode != nullptr) {
fStrikeCache->attachNode(fNode);
}
fNode = o.fNode;
fStrikeCache = o.fStrikeCache;
o.fNode = nullptr;
o.fStrikeCache = nullptr;
return *this;
}
SkStrikeCache::ExclusiveStrikePtr::~ExclusiveStrikePtr() {
SkStrikeCache::Attach(fNode);
if (fNode != nullptr) {
fStrikeCache->attachNode(fNode);
}
}
SkGlyphCache* SkStrikeCache::ExclusiveStrikePtr::get() const {
return &fNode->fCache;
@ -84,6 +87,14 @@ bool operator == (decltype(nullptr), const SkStrikeCache::ExclusiveStrikePtr& rh
return nullptr == rhs.fNode;
}
SkStrikeCache* SkStrikeCache::GetGlobalStrikeCache() {
static SkOnce once;
static SkStrikeCache* globals;
once([]{ globals = new SkStrikeCache; });
return globals;
}
SkStrikeCache::~SkStrikeCache() {
Node* node = fHead;
while (node) {
@ -93,22 +104,9 @@ SkStrikeCache::~SkStrikeCache() {
}
}
void SkStrikeCache::Attach(Node* node) {
get_globals().attachNode(node);
}
SkExclusiveStrikePtr SkStrikeCache::FindStrikeExclusive(const SkDescriptor& desc) {
return get_globals().findStrikeExclusive(desc);
}
bool SkStrikeCache::DesperationSearchForImage(const SkDescriptor& desc, SkGlyph* glyph,
SkGlyphCache* targetCache) {
return get_globals().desperationSearchForImage(desc, glyph, targetCache);
}
bool SkStrikeCache::DesperationSearchForPath(
const SkDescriptor& desc, SkGlyphID glyphID, SkPath* path) {
return get_globals().desperationSearchForPath(desc, glyphID, path);
return GetGlobalStrikeCache()->findStrikeExclusive(desc);
}
std::unique_ptr<SkScalerContext> SkStrikeCache::CreateScalerContext(
@ -131,10 +129,16 @@ std::unique_ptr<SkScalerContext> SkStrikeCache::CreateScalerContext(
SkExclusiveStrikePtr SkStrikeCache::FindOrCreateStrikeExclusive(
const SkDescriptor& desc, const SkScalerContextEffects& effects, const SkTypeface& typeface)
{
auto cache = FindStrikeExclusive(desc);
return GetGlobalStrikeCache()->findOrCreateStrikeExclusive(desc, effects, typeface);
}
SkExclusiveStrikePtr SkStrikeCache::findOrCreateStrikeExclusive(
const SkDescriptor& desc, const SkScalerContextEffects& effects, const SkTypeface& typeface)
{
auto cache = this->findStrikeExclusive(desc);
if (cache == nullptr) {
auto scaler = CreateScalerContext(desc, effects, typeface);
cache = CreateStrikeExclusive(desc, std::move(scaler));
cache = this->createStrikeExclusive(desc, std::move(scaler));
}
return cache;
}
@ -162,17 +166,23 @@ SkExclusiveStrikePtr SkStrikeCache::FindOrCreateStrikeExclusive(const SkPaint& p
}
void SkStrikeCache::PurgeAll() {
get_globals().purgeAll();
GetGlobalStrikeCache()->purgeAll();
}
void SkStrikeCache::Validate() {
#ifdef SK_DEBUG
auto visitor = [](const SkGlyphCache& cache) { cache.forceValidate(); };
get_globals().forEachStrike(visitor);
GetGlobalStrikeCache()->validate();
#endif
}
#ifdef SK_DEBUG
void SkStrikeCache::validate() const {
SkAutoExclusive ac(fLock);
this->internalValidate();
}
#endif
void SkStrikeCache::Dump() {
SkDebugf("GlyphCache [ used budget ]\n");
SkDebugf(" bytes [ %8zu %8zu ]\n",
@ -190,7 +200,7 @@ void SkStrikeCache::Dump() {
counter += 1;
};
get_globals().forEachStrike(visitor);
GetGlobalStrikeCache()->forEachStrike(visitor);
}
namespace {
@ -234,7 +244,7 @@ void SkStrikeCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
dump->setMemoryBacking(dumpName.c_str(), "malloc", nullptr);
};
get_globals().forEachStrike(visitor);
GetGlobalStrikeCache()->forEachStrike(visitor);
}
@ -244,7 +254,7 @@ void SkStrikeCache::attachNode(Node* node) {
}
SkAutoExclusive ac(fLock);
this->validate();
this->internalValidate();
node->fCache.validate();
this->internalAttachToHead(node);
@ -258,11 +268,11 @@ SkExclusiveStrikePtr SkStrikeCache::findStrikeExclusive(const SkDescriptor& desc
for (node = internalGetHead(); node != nullptr; node = node->fNext) {
if (node->fCache.getDescriptor() == desc) {
this->internalDetachCache(node);
return SkExclusiveStrikePtr(node);
return SkExclusiveStrikePtr(node, this);
}
}
return SkExclusiveStrikePtr(nullptr);
return SkExclusiveStrikePtr();
}
static bool loose_compare(const SkDescriptor& lhs, const SkDescriptor& rhs) {
@ -353,6 +363,16 @@ SkExclusiveStrikePtr SkStrikeCache::CreateStrikeExclusive(
std::unique_ptr<SkScalerContext> scaler,
SkPaint::FontMetrics* maybeMetrics,
std::unique_ptr<SkStrikePinner> pinner)
{
return GetGlobalStrikeCache()->createStrikeExclusive(
desc, std::move(scaler), maybeMetrics, std::move(pinner));
}
SkExclusiveStrikePtr SkStrikeCache::createStrikeExclusive(
const SkDescriptor& desc,
std::unique_ptr<SkScalerContext> scaler,
SkPaint::FontMetrics* maybeMetrics,
std::unique_ptr<SkStrikePinner> pinner)
{
SkPaint::FontMetrics fontMetrics;
if (maybeMetrics != nullptr) {
@ -361,7 +381,9 @@ SkExclusiveStrikePtr SkStrikeCache::CreateStrikeExclusive(
scaler->getFontMetrics(&fontMetrics);
}
return SkExclusiveStrikePtr(new Node(desc, std::move(scaler), fontMetrics, std::move(pinner)));
return SkExclusiveStrikePtr(
new Node(desc, std::move(scaler), fontMetrics, std::move(pinner)),
this);
}
void SkStrikeCache::purgeAll() {
@ -436,15 +458,13 @@ int SkStrikeCache::setCachePointSizeLimit(int newLimit) {
void SkStrikeCache::forEachStrike(std::function<void(const SkGlyphCache&)> visitor) const {
SkAutoExclusive ac(fLock);
this->validate();
for (Node* node = this->internalGetHead(); node != nullptr; node = node->fNext) {
visitor(node->fCache);
}
}
size_t SkStrikeCache::internalPurge(size_t minBytesNeeded) {
this->validate();
this->internalValidate();
size_t bytesNeeded = 0;
if (fTotalMemoryUsed > fCacheSizeLimit) {
@ -487,7 +507,7 @@ size_t SkStrikeCache::internalPurge(size_t minBytesNeeded) {
node = prev;
}
this->validate();
this->internalValidate();
#ifdef SPEW_PURGE_STATUS
if (countFreed) {
@ -534,12 +554,13 @@ void SkStrikeCache::internalDetachCache(Node* node) {
}
#ifdef SK_DEBUG
void SkStrikeCache::validate() const {
void SkStrikeCache::internalValidate() const {
size_t computedBytes = 0;
int computedCount = 0;
const Node* node = fHead;
while (node != nullptr) {
node->fCache.forceValidate();
computedBytes += node->fCache.getMemoryUsed();
computedCount += 1;
node = node->fNext;
@ -555,38 +576,38 @@ void SkStrikeCache::validate() const {
////////////////////////////////////////////////////////////////////////////////////////////////////
size_t SkGraphics::GetFontCacheLimit() {
return get_globals().getCacheSizeLimit();
return SkStrikeCache::GetGlobalStrikeCache()->getCacheSizeLimit();
}
size_t SkGraphics::SetFontCacheLimit(size_t bytes) {
return get_globals().setCacheSizeLimit(bytes);
return SkStrikeCache::GetGlobalStrikeCache()->setCacheSizeLimit(bytes);
}
size_t SkGraphics::GetFontCacheUsed() {
return get_globals().getTotalMemoryUsed();
return SkStrikeCache::GetGlobalStrikeCache()->getTotalMemoryUsed();
}
int SkGraphics::GetFontCacheCountLimit() {
return get_globals().getCacheCountLimit();
return SkStrikeCache::GetGlobalStrikeCache()->getCacheCountLimit();
}
int SkGraphics::SetFontCacheCountLimit(int count) {
return get_globals().setCacheCountLimit(count);
return SkStrikeCache::GetGlobalStrikeCache()->setCacheCountLimit(count);
}
int SkGraphics::GetFontCacheCountUsed() {
return get_globals().getCacheCountUsed();
return SkStrikeCache::GetGlobalStrikeCache()->getCacheCountUsed();
}
int SkGraphics::GetFontCachePointSizeLimit() {
return get_globals().getCachePointSizeLimit();
return SkStrikeCache::GetGlobalStrikeCache()->getCachePointSizeLimit();
}
int SkGraphics::SetFontCachePointSizeLimit(int limit) {
return get_globals().setCachePointSizeLimit(limit);
return SkStrikeCache::GetGlobalStrikeCache()->setCachePointSizeLimit(limit);
}
void SkGraphics::PurgeFontCache() {
get_globals().purgeAll();
SkStrikeCache::GetGlobalStrikeCache()->purgeAll();
SkTypefaceCache::PurgeAll();
}

View File

@ -47,7 +47,7 @@ public:
class ExclusiveStrikePtr {
public:
explicit ExclusiveStrikePtr(Node*);
explicit ExclusiveStrikePtr(Node*, SkStrikeCache*);
ExclusiveStrikePtr();
ExclusiveStrikePtr(const ExclusiveStrikePtr&) = delete;
ExclusiveStrikePtr& operator = (const ExclusiveStrikePtr&) = delete;
@ -65,8 +65,10 @@ public:
private:
Node* fNode;
SkStrikeCache* fStrikeCache;
};
static SkStrikeCache* GetGlobalStrikeCache();
static ExclusiveStrikePtr FindStrikeExclusive(const SkDescriptor&);
@ -111,6 +113,17 @@ public:
void attachNode(Node* node);
ExclusiveStrikePtr findStrikeExclusive(const SkDescriptor&);
ExclusiveStrikePtr findOrCreateStrikeExclusive(
const SkDescriptor& desc,
const SkScalerContextEffects& effects,
const SkTypeface& typeface);
ExclusiveStrikePtr createStrikeExclusive(
const SkDescriptor& desc,
std::unique_ptr<SkScalerContext> scaler,
SkPaint::FontMetrics* maybeMetrics = nullptr,
std::unique_ptr<SkStrikePinner> = nullptr);
// Routines to find suitable data when working in a remote cache situation. These are
// suitable as substitutes for similar calls in SkScalerContext.
bool desperationSearchForImage(const SkDescriptor& desc,
@ -133,13 +146,13 @@ public:
#ifdef SK_DEBUG
void validate() const;
void internalValidate() const;
#else
void validate() const {}
void internalValidate() const {}
#endif
private:
static void Attach(Node* node);
// The following methods can only be called when mutex is already held.
Node* internalGetHead() const { return fHead; }
Node* internalGetTail() const { return fTail; }

View File

@ -19,11 +19,12 @@ SkScalerContextProxy::SkScalerContextProxy(sk_sp<SkTypeface> tf,
: SkScalerContext{std::move(tf), effects, desc}
, fDiscardableManager{std::move(manager)} {}
void SkScalerContextProxy::initCache(SkGlyphCache* cache) {
void SkScalerContextProxy::initCache(SkGlyphCache* cache, SkStrikeCache* strikeCache) {
SkASSERT(fCache == nullptr);
SkASSERT(cache != nullptr);
fCache = cache;
fStrikeCache = strikeCache;
}
unsigned SkScalerContextProxy::generateGlyphCount() {
@ -57,7 +58,7 @@ void SkScalerContextProxy::generateMetrics(SkGlyph* glyph) {
}
// Now check other caches for a desc mismatch.
if (SkStrikeCache::DesperationSearchForImage(fCache->getDescriptor(), glyph, fCache)) {
if (fStrikeCache->desperationSearchForImage(fCache->getDescriptor(), glyph, fCache)) {
fDiscardableManager->notifyCacheMiss(
SkStrikeClient::CacheMissType::kGlyphMetricsFallback);
return;
@ -88,7 +89,7 @@ bool SkScalerContextProxy::generatePath(SkGlyphID glyphID, SkPath* path) {
// Since the scaler context is being called, we don't have the needed data. Try to find a
// fallback before failing.
auto desc = SkScalerContext::DescriptorGivenRecAndEffects(this->getRec(), this->getEffects());
bool foundPath = SkStrikeCache::DesperationSearchForPath(*desc, glyphID, path);
bool foundPath = fStrikeCache->desperationSearchForPath(*desc, glyphID, path);
fDiscardableManager->notifyCacheMiss(foundPath
? SkStrikeClient::CacheMissType::kGlyphPathFallback
: SkStrikeClient::CacheMissType::kGlyphPath);

View File

@ -18,6 +18,7 @@
#include "SkTypeface.h"
class SkTypefaceProxy;
class SkStrikeCache;
class SkScalerContextProxy : public SkScalerContext {
public:
@ -26,7 +27,7 @@ public:
const SkDescriptor* desc,
sk_sp<SkStrikeClient::DiscardableHandleManager> manager);
void initCache(SkGlyphCache*);
void initCache(SkGlyphCache*, SkStrikeCache*);
protected:
unsigned generateGlyphCount() override;
@ -41,6 +42,7 @@ protected:
private:
sk_sp<SkStrikeClient::DiscardableHandleManager> fDiscardableManager;
SkGlyphCache* fCache = nullptr;
SkStrikeCache* fStrikeCache = nullptr;
typedef SkScalerContext INHERITED;
};

View File

@ -428,6 +428,8 @@ DEF_TEST(SkRemoteGlyphCache_SearchOfDesperation, reporter) {
auto lostGlyphID = SkPackedGlyphID(1, SK_FixedHalf, SK_FixedHalf);
const uint8_t glyphImage[] = {0xFF, 0xFF};
SkStrikeCache strikeCache;
// Build a fallback cache.
{
SkAutoDescriptor ad;
@ -437,7 +439,7 @@ DEF_TEST(SkRemoteGlyphCache_SearchOfDesperation, reporter) {
SkScalerContext::MakeRecAndEffects(paint, nullptr, nullptr, flags, &rec, &effects, false);
auto desc = SkScalerContext::AutoDescriptorGivenRecAndEffects(rec, effects, &ad);
auto fallbackCache = SkStrikeCache::FindOrCreateStrikeExclusive(*desc, effects, *clientTf);
auto fallbackCache = strikeCache.findOrCreateStrikeExclusive(*desc, effects, *clientTf);
auto glyph = fallbackCache->getRawGlyphByID(lostGlyphID);
glyph->fMaskFormat = SkMask::kA8_Format;
glyph->fHeight = 1;
@ -454,7 +456,7 @@ DEF_TEST(SkRemoteGlyphCache_SearchOfDesperation, reporter) {
SkScalerContextFlags flags = SkScalerContextFlags::kFakeGammaAndBoostContrast;
SkScalerContext::MakeRecAndEffects(paint, nullptr, nullptr, flags, &rec, &effects, false);
auto desc = SkScalerContext::AutoDescriptorGivenRecAndEffects(rec, effects, &ad);
auto testCache = SkStrikeCache::FindStrikeExclusive(*desc);
auto testCache = strikeCache.findStrikeExclusive(*desc);
REPORTER_ASSERT(reporter, !(testCache == nullptr));
}
@ -466,11 +468,12 @@ DEF_TEST(SkRemoteGlyphCache_SearchOfDesperation, reporter) {
SkScalerContextFlags flags = SkScalerContextFlags::kNone;
SkScalerContext::MakeRecAndEffects(paint, nullptr, nullptr, flags, &rec, &effects, false);
auto desc = SkScalerContext::AutoDescriptorGivenRecAndEffects(rec, effects, &ad);
testCache = SkStrikeCache::FindStrikeExclusive(*desc);
testCache = strikeCache.findStrikeExclusive(*desc);
REPORTER_ASSERT(reporter, testCache == nullptr);
testCache = SkStrikeCache::CreateStrikeExclusive(*desc,
testCache = strikeCache.createStrikeExclusive(*desc,
clientTf->createScalerContext(effects, desc));
static_cast<SkScalerContextProxy*>(testCache->getScalerContext())->initCache(testCache.get());
auto scalerProxy = static_cast<SkScalerContextProxy*>(testCache->getScalerContext());
scalerProxy->initCache(testCache.get(), &strikeCache);
// Look for the lost glyph.
{
@ -504,7 +507,7 @@ DEF_TEST(SkRemoteGlyphCache_SearchOfDesperation, reporter) {
REPORTER_ASSERT(reporter, discardableManager->cacheMissCount(i) == 0);
}
}
SkStrikeCache::Validate();
strikeCache.internalValidate();
// Must unlock everything on termination, otherwise valgrind complains about memory leaks.
discardableManager->unlockAndDeleteAll();
@ -530,6 +533,8 @@ DEF_TEST(SkRemoteGlyphCache_ReWriteGlyph, reporter) {
uint32_t realMask;
uint32_t fakeMask;
SkStrikeCache strikeCache;
{
SkAutoDescriptor ad;
SkScalerContextRec rec;
@ -557,7 +562,7 @@ DEF_TEST(SkRemoteGlyphCache_ReWriteGlyph, reporter) {
SkScalerContext::MakeRecAndEffects(paint, nullptr, nullptr, flags, &rec, &effects, false);
auto desc = SkScalerContext::AutoDescriptorGivenRecAndEffects(rec, effects, &ad);
auto fallbackCache = SkStrikeCache::FindOrCreateStrikeExclusive(*desc, effects, *clientTf);
auto fallbackCache = strikeCache.findOrCreateStrikeExclusive(*desc, effects, *clientTf);
auto glyph = fallbackCache->getRawGlyphByID(lostGlyphID);
fakeMask = (realMask == SkMask::kA8_Format) ? SkMask::kBW_Format : SkMask::kA8_Format;
glyph->fMaskFormat = fakeMask;
@ -579,7 +584,9 @@ DEF_TEST(SkRemoteGlyphCache_ReWriteGlyph, reporter) {
std::vector<uint8_t> serverStrikeData;
server.writeStrikeData(&serverStrikeData);
REPORTER_ASSERT(reporter,
client.readStrikeData(serverStrikeData.data(), serverStrikeData.size()));
client.readStrikeData(
serverStrikeData.data(),
serverStrikeData.size()));
}
{
@ -591,7 +598,7 @@ DEF_TEST(SkRemoteGlyphCache_ReWriteGlyph, reporter) {
SkScalerContext::MakeRecAndEffects(paint, nullptr, nullptr, flags, &rec, &effects, false);
auto desc = SkScalerContext::AutoDescriptorGivenRecAndEffects(rec, effects, &ad);
auto fallbackCache = SkStrikeCache::FindStrikeExclusive(*desc);
auto fallbackCache = strikeCache.findStrikeExclusive(*desc);
REPORTER_ASSERT(reporter, fallbackCache.get() != nullptr);
auto glyph = fallbackCache->getRawGlyphByID(lostGlyphID);
REPORTER_ASSERT(reporter, glyph->fMaskFormat == fakeMask);