From c1bbd1f1909708882d6357d879736bda2d2bb2e6 Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Mon, 15 Nov 2021 09:48:39 -0500 Subject: [PATCH] generalize text geometry back pointer This change allows types other than GrTextBlob to use the geometry's lifetime to manage refs. Change-Id: Iacb726cd4d097c87df146e119c476c014d4df99e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471616 Reviewed-by: Robert Phillips Commit-Queue: Herb Derby --- src/gpu/ops/AtlasTextOp.h | 10 +++++----- src/gpu/text/GrTextBlob.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gpu/ops/AtlasTextOp.h b/src/gpu/ops/AtlasTextOp.h index 68db35e118..e3dc6b98be 100644 --- a/src/gpu/ops/AtlasTextOp.h +++ b/src/gpu/ops/AtlasTextOp.h @@ -44,14 +44,14 @@ public: GrAtlasSubRunOwner subRunOwner, const SkPMColor4f& color) : fSubRun{subRun} - , fBlob{std::move(blob)} + , fSupportDataKeepAlive{std::move(blob)} , fSubRunDtor{std::move(subRunOwner)} , fDrawMatrix{drawMatrix} , fDrawOrigin{drawOrigin} , fClipRect{clipRect} , fColor{color} { - SkASSERT(fBlob != nullptr || fSubRunDtor != nullptr); - SkASSERT(SkToBool(fSubRunDtor) != SkToBool(fBlob)); + SkASSERT(fSupportDataKeepAlive != nullptr || fSubRunDtor != nullptr); + SkASSERT(SkToBool(fSubRunDtor) != SkToBool(fSupportDataKeepAlive)); } static Geometry* MakeForBlob(const GrAtlasSubRun& subRun, @@ -66,10 +66,10 @@ public: const GrAtlasSubRun& fSubRun; - // Either this Geometry holds a ref to the GrTextBlob in the case of a text blob based + // Either this Geometry holds a ref to the support data in the case of a blob based // SubRun (WithCaching case), or it holds a unique_ptr to a SubRun allocated on the // GrTextBlobAllocator in the NoCache case. It must hold one, and can't hold both. - sk_sp fBlob; // mutable to make unref call in Op dtor. + sk_sp fSupportDataKeepAlive; GrAtlasSubRunOwner fSubRunDtor; const SkMatrix fDrawMatrix; diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h index c766372dd6..658e927da8 100644 --- a/src/gpu/text/GrTextBlob.h +++ b/src/gpu/text/GrTextBlob.h @@ -178,7 +178,7 @@ struct GrSubRunList { // with. // // -class GrTextBlob final : public SkNVRefCnt, public SkGlyphRunPainterInterface { +class GrTextBlob final : public SkRefCnt, public SkGlyphRunPainterInterface { public: // Key is not used as part of a hash map, so the hash is never taken. It's only used in a