Revert "Revert "Hold sk_sp<GrAtlasTextBlob> refs in GrTextBlobCache instead of raw ptrs""
This reverts commit 3304c447b953dad79fe7f355184ac13ed7e302e0.
Reason for revert: Fix for SkTHashMap issue landed
Original change's description:
> Revert "Hold sk_sp<GrAtlasTextBlob> refs in GrTextBlobCache instead of raw ptrs"
>
> This reverts commit db3ceb86421fb9da86bb920e3a1f0957beec08d9.
>
> Reason for revert: observing some strange budget behavior w/ instrumented Chromium builds; need to investigate.
>
> Original change's description:
> > Hold sk_sp<GrAtlasTextBlob> refs in GrTextBlobCache instead of raw ptrs
> >
> > Refactor to store sk_sps, and minimize explicit ref manipulation.
> >
> > Change-Id: Ie3d18e5fe1cefbbc5c2f3c4941287a24038522a6
> > Reviewed-on: https://skia-review.googlesource.com/9490
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> >
>
> TBR=bsalomon@google.com,robertphillips@google.com,fmalita@chromium.org,reviews@skia.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Change-Id: I8ca9862ad1519a9ec69ad1ce8e4d129b0dae7b0a
> Reviewed-on: https://skia-review.googlesource.com/9524
> Reviewed-by: Florin Malita <fmalita@google.com>
> Commit-Queue: Florin Malita <fmalita@google.com>
>
TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org,fmalita@chromium.org,fmalita@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I1ba50e3b574381717fbbf46b829d72aceff8f7fe
Reviewed-on: https://skia-review.googlesource.com/9535
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index accdf6b..5427855 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -17,7 +17,7 @@
#include "SkTextBlobRunIterator.h"
#include "ops/GrAtlasTextOp.h"
-GrAtlasTextBlob* GrAtlasTextBlob::Create(GrMemoryPool* pool, int glyphCount, int runCount) {
+sk_sp<GrAtlasTextBlob> GrAtlasTextBlob::Make(GrMemoryPool* pool, int glyphCount, int runCount) {
// We allocate size for the GrAtlasTextBlob itself, plus size for the vertices array,
// and size for the glyphIds array.
size_t verticesCount = glyphCount * kVerticesPerGlyph * kMaxVASize;
@@ -31,11 +31,12 @@
sk_bzero(allocation, size);
}
- GrAtlasTextBlob* cacheBlob = new (allocation) GrAtlasTextBlob;
+ sk_sp<GrAtlasTextBlob> cacheBlob(new (allocation) GrAtlasTextBlob);
cacheBlob->fSize = size;
// setup offsets for vertices / glyphs
- cacheBlob->fVertices = sizeof(GrAtlasTextBlob) + reinterpret_cast<unsigned char*>(cacheBlob);
+ cacheBlob->fVertices = sizeof(GrAtlasTextBlob) +
+ reinterpret_cast<unsigned char*>(cacheBlob.get());
cacheBlob->fGlyphs = reinterpret_cast<GrGlyph**>(cacheBlob->fVertices + verticesCount);
cacheBlob->fRuns = reinterpret_cast<GrAtlasTextBlob::Run*>(cacheBlob->fGlyphs + glyphCount);