aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-05-17 08:36:41 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-17 08:36:41 -0700
commit4bb7ce7b3d64841bed5a4e8e71f2a8e79d3db413 (patch)
treeebda11b796ab4e7f6325e8abcdf8888b928bd3e4 /src
parent835acc7619fc3f07658d868b12a7f869daad99d0 (diff)
Make GrFontScaler not be ref-counted
This object is made invalid when the SkGlyphCache that it points to is destroyed. BUG=chromium:608566 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1982303002 Review-Url: https://codereview.chromium.org/1982303002
Diffstat (limited to 'src')
-rw-r--r--src/gpu/text/GrFontScaler.h8
-rw-r--r--src/gpu/text/GrTextUtils.cpp2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/gpu/text/GrFontScaler.h b/src/gpu/text/GrFontScaler.h
index f6b67706e3..a2be7464a8 100644
--- a/src/gpu/text/GrFontScaler.h
+++ b/src/gpu/text/GrFontScaler.h
@@ -43,10 +43,10 @@ private:
* The client is responsible for instantiating this. The instance is created
* for a specific font+size+matrix.
*/
-class GrFontScaler : public SkRefCnt {
+class GrFontScaler final : public SkNoncopyable {
public:
explicit GrFontScaler(SkGlyphCache* strike);
- virtual ~GrFontScaler();
+ ~GrFontScaler();
const GrFontDescKey* getKey();
GrMaskFormat getMaskFormat() const;
@@ -60,10 +60,12 @@ public:
const SkGlyph& grToSkGlyph(GrGlyph::PackedID);
private:
+ // The SkGlyphCache actually owns this GrFontScaler. The GrFontScaler is deleted when the
+ // SkGlyphCache is deleted.
SkGlyphCache* fStrike;
GrFontDescKey* fKey;
- typedef SkRefCnt INHERITED;
+ typedef SkNoncopyable INHERITED;
};
#endif
diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp
index c368c214e1..da2b3e20db 100644
--- a/src/gpu/text/GrTextUtils.cpp
+++ b/src/gpu/text/GrTextUtils.cpp
@@ -572,7 +572,7 @@ uint32_t GrTextUtils::FilterTextFlags(const SkSurfaceProps& surfaceProps, const
static void glyph_cache_aux_proc(void* data) {
GrFontScaler* scaler = (GrFontScaler*)data;
- SkSafeUnref(scaler);
+ delete scaler;
}
GrFontScaler* GrTextUtils::GetGrFontScaler(SkGlyphCache* cache) {