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

Unified Diff: chrome/common/badge_util.cc

Issue 11418217: Add skia::RefPtr class to wrap ref counted classes from Skia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Drop TNoRef Created 8 years, 1 month 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
Index: chrome/common/badge_util.cc
diff --git a/chrome/common/badge_util.cc b/chrome/common/badge_util.cc
index e33f8d43edde2fc4b085fba9ed7362bedff54598..bd124d156a1fda84e724ad4a0afb7e3fd6a65a92 100644
--- a/chrome/common/badge_util.cc
+++ b/chrome/common/badge_util.cc
@@ -28,7 +28,7 @@ SkPaint* GetBadgeTextPaintSingleton() {
text_paint->setAntiAlias(true);
text_paint->setTextAlign(SkPaint::kLeft_Align);
- SkTypeface* typeface = SkTypeface::CreateFromName(
+ skia::RefPtr<SkTypeface> typeface = 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.
@@ -46,9 +46,8 @@ SkPaint* GetBadgeTextPaintSingleton() {
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;
}

Powered by Google App Engine
This is Rietveld 408576698