aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkRemoteGlyphCacheTest.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@google.com>2018-05-23 00:16:47 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-23 00:16:56 +0000
commitfc6cf92e4b21c92ead769fae557534056eac6d83 (patch)
treebb0c97f845fcc9c15dc22f5a0ad50059f7067029 /tests/SkRemoteGlyphCacheTest.cpp
parente60ae82dec8c5dac7997233b17dabdbf677de7da (diff)
Revert "fonts: Cleanup cache miss logging for font remoting."
This reverts commit 2b8a0d1844ed236259284fbc2efe08dab0ed539f. Reason for revert: reverting a CL this builds on Original change's description: > fonts: Cleanup cache miss logging for font remoting. > > Add hooks to notify the embedder if there is a cache miss during draw. > Also remove the reference to SkStrikeClient from SkTypefaceProxy and > SkScalerContextProxy, since the proxies can outlive the client. > > R=​herb@google.com > > Bug: 829622 > Change-Id: Ib2fd1b91ebd057856c1d4e717cf50b49f08c903b > Reviewed-on: https://skia-review.googlesource.com/129402 > Commit-Queue: Khusal Sagar <khushalsagar@chromium.org> > Reviewed-by: Herb Derby <herb@google.com> TBR=herb@google.com,khushalsagar@chromium.org Change-Id: I8a331545988885c620685008f4b60240d80f3712 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 829622 Reviewed-on: https://skia-review.googlesource.com/129682 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
Diffstat (limited to 'tests/SkRemoteGlyphCacheTest.cpp')
-rw-r--r--tests/SkRemoteGlyphCacheTest.cpp34
1 files changed, 2 insertions, 32 deletions
diff --git a/tests/SkRemoteGlyphCacheTest.cpp b/tests/SkRemoteGlyphCacheTest.cpp
index 6a4a4d37cf..5d4b9ff6f3 100644
--- a/tests/SkRemoteGlyphCacheTest.cpp
+++ b/tests/SkRemoteGlyphCacheTest.cpp
@@ -22,7 +22,7 @@
class DiscardableManager : public SkStrikeServer::DiscardableHandleManager,
public SkStrikeClient::DiscardableHandleManager {
public:
- DiscardableManager() { sk_bzero(&fCacheMissCount, sizeof(fCacheMissCount)); }
+ DiscardableManager() = default;
~DiscardableManager() override = default;
// Server implementation.
@@ -39,7 +39,6 @@ public:
// Client implementation.
bool deleteHandle(SkDiscardableHandleId id) override { return id <= fLastDeletedHandleId; }
- void NotifyCacheMiss(SkStrikeClient::CacheMissType type) override { fCacheMissCount[type]++; }
void unlockAll() { fLockedHandles.reset(); }
void unlockAndDeleteAll() {
@@ -48,13 +47,11 @@ public:
}
const SkTHashSet<SkDiscardableHandleId>& lockedHandles() const { return fLockedHandles; }
SkDiscardableHandleId handleCount() { return fNextHandleId; }
- int cacheMissCount(SkStrikeClient::CacheMissType type) { return fCacheMissCount[type]; }
private:
SkDiscardableHandleId fNextHandleId = 0u;
SkDiscardableHandleId fLastDeletedHandleId = 0u;
SkTHashSet<SkDiscardableHandleId> fLockedHandles;
- int fCacheMissCount[SkStrikeClient::CacheMissType::kLast + 1u];
};
sk_sp<SkTextBlob> buildTextBlob(sk_sp<SkTypeface> tf, int glyphCount) {
@@ -117,7 +114,7 @@ DEF_TEST(SkRemoteGlyphCache_TypefaceSerialization, reporter) {
auto client_tf = client.deserializeTypeface(tf_data->data(), tf_data->size());
REPORTER_ASSERT(reporter, client_tf);
- REPORTER_ASSERT(reporter, static_cast<SkTypefaceProxy*>(client_tf.get())->remoteTypefaceID() ==
+ REPORTER_ASSERT(reporter, SkTypefaceProxy::DownCast(client_tf.get())->remoteTypefaceID() ==
server_tf->uniqueID());
}
@@ -352,31 +349,4 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextAsDFT, reporter, c
COMPARE_BLOBS(expected, actual, reporter);
SkStrikeCache::Validate();
}
-
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_CacheMissReporting, reporter, ctxInfo) {
- sk_sp<DiscardableManager> discardableManager = sk_make_sp<DiscardableManager>();
- SkStrikeServer server(discardableManager.get());
- SkStrikeClient client(discardableManager);
-
- auto serverTf = SkTypeface::MakeFromName("monospace", SkFontStyle());
- auto tfData = server.serializeTypeface(serverTf.get());
- auto clientTf = client.deserializeTypeface(tfData->data(), tfData->size());
- REPORTER_ASSERT(reporter, clientTf);
- int glyphCount = 10;
- auto clientBlob = buildTextBlob(clientTf, glyphCount);
-
- // Raster the client-side blob without the glyph data, we should get cache miss notifications.
- SkPaint paint;
- SkMatrix matrix = SkMatrix::I();
- RasterBlob(clientBlob, 10, 10, paint, ctxInfo.grContext(), &matrix);
- REPORTER_ASSERT(reporter,
- discardableManager->cacheMissCount(SkStrikeClient::kFontMetrics) == 1);
- REPORTER_ASSERT(reporter,
- discardableManager->cacheMissCount(SkStrikeClient::kGlyphMetrics) == 10);
-
- // There shouldn't be any image or path requests, since we mark the glyph as empty on a cache
- // miss.
- REPORTER_ASSERT(reporter, discardableManager->cacheMissCount(SkStrikeClient::kGlyphImage) == 0);
- REPORTER_ASSERT(reporter, discardableManager->cacheMissCount(SkStrikeClient::kGlyphPath) == 0);
-}
#endif