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

Unified Diff: chrome/common/badge_util.cc

Issue 11280251: chrome: Use skia::RefPtr for skia ref-counted objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: linuxbuild Created 8 years 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
« no previous file with comments | « chrome/browser/ui/views/theme_helpers.cc ('k') | chrome/renderer/chrome_render_view_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « chrome/browser/ui/views/theme_helpers.cc ('k') | chrome/renderer/chrome_render_view_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698