Index: chrome/common/badge_util.cc |
diff --git a/chrome/common/badge_util.cc b/chrome/common/badge_util.cc |
index 5f0073e098e83e26121fc8db910c802f087e6efa..7ed6edf8b2bca414a0b59f2e902d9efa4a9b254f 100644 |
--- a/chrome/common/badge_util.cc |
+++ b/chrome/common/badge_util.cc |
@@ -68,8 +68,8 @@ SkPaint* GetBadgeTextPaintSingleton() { |
text_paint->setAntiAlias(true); |
text_paint->setTextAlign(SkPaint::kLeft_Align); |
- SkTypeface* typeface = SkTypeface::CreateFromName( |
- kPreferredTypeface, SkTypeface::kBold); |
+ skia::RefPtr<SkTypeface> typeface = skia::AdoptRef( |
+ SkTypeface::CreateFromName(kPreferredTypeface, SkTypeface::kBold)); |
// Skia doesn't do any font fallback---if the user is missing the font then |
// typeface will be NULL. If we don't do manual fallback then we'll crash. |
if (typeface) { |
@@ -81,14 +81,13 @@ SkPaint* GetBadgeTextPaintSingleton() { |
// that don't have Arial. |
ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); |
- typeface = SkTypeface::CreateFromName( |
- base_font.GetFontName().c_str(), SkTypeface::kNormal); |
+ typeface = skia::AdoptRef(SkTypeface::CreateFromName( |
+ base_font.GetFontName().c_str(), SkTypeface::kNormal)); |
DCHECK(typeface); |
} |
- text_paint->setTypeface(typeface); |
+ text_paint->setTypeface(typeface.get()); |
// |text_paint| adds its own ref. Release the ref from CreateFontName. |
- typeface->unref(); |
} |
return text_paint; |
} |