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

Unified Diff: src/gpu/GrTextBlobCache.cpp

Issue 1250693002: Add sanity check to GrAtlasTextBlob (Closed) Base URL: https://skia.googlesource.com/skia.git@debug
Patch Set: more Created 5 years, 5 months 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
« no previous file with comments | « src/gpu/GrTextBlobCache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextBlobCache.cpp
diff --git a/src/gpu/GrTextBlobCache.cpp b/src/gpu/GrTextBlobCache.cpp
index b1a13a866f2d240de902617c8b24790f616269f6..dd7ddc129e77252524d4ccd6f85f675fcb02a25b 100644
--- a/src/gpu/GrTextBlobCache.cpp
+++ b/src/gpu/GrTextBlobCache.cpp
@@ -13,8 +13,7 @@ GrTextBlobCache::~GrTextBlobCache() {
this->freeAll();
}
-GrAtlasTextBlob* GrTextBlobCache::createBlob(int glyphCount, int runCount,
- size_t maxVASize) {
+GrAtlasTextBlob* GrTextBlobCache::createBlob(int glyphCount, int runCount, size_t maxVASize) {
// We allocate size for the GrAtlasTextBlob itself, plus size for the vertices array,
// and size for the glyphIds array.
size_t verticesCount = glyphCount * kVerticesPerGlyph * maxVASize;
@@ -23,7 +22,15 @@ GrAtlasTextBlob* GrTextBlobCache::createBlob(int glyphCount, int runCount,
glyphCount * sizeof(GrGlyph**) +
sizeof(GrAtlasTextBlob::Run) * runCount;
- GrAtlasTextBlob* cacheBlob = SkNEW_PLACEMENT(fPool.allocate(size), GrAtlasTextBlob);
+ void* allocation = fPool.allocate(size);
+#ifdef CACHE_SANITY_CHECK
+ sk_bzero(allocation, size);
+#endif
+
+ GrAtlasTextBlob* cacheBlob = SkNEW_PLACEMENT(allocation, GrAtlasTextBlob);
+#ifdef CACHE_SANITY_CHECK
+ cacheBlob->fSize = size;
+#endif
// setup offsets for vertices / glyphs
cacheBlob->fVertices = sizeof(GrAtlasTextBlob) + reinterpret_cast<unsigned char*>(cacheBlob);
« no previous file with comments | « src/gpu/GrTextBlobCache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698