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

Unified Diff: ui/gfx/platform_font_pango.cc

Issue 10406014: Add a ScopedPangoFontDescription helper class and use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months 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 | « ui/gfx/pango_util.cc ('k') | ui/gfx/platform_font_pango_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/platform_font_pango.cc
===================================================================
--- ui/gfx/platform_font_pango.cc (revision 137485)
+++ ui/gfx/platform_font_pango.cc (working copy)
@@ -98,10 +98,9 @@
if (default_font_ == NULL) {
std::string font_name = GetDefaultFont();
- PangoFontDescription* desc =
- pango_font_description_from_string(font_name.c_str());
- default_font_ = new Font(desc);
- pango_font_description_free(desc);
+ ScopedPangoFontDescription desc(
+ pango_font_description_from_string(font_name.c_str()));
+ default_font_ = new Font(desc.get());
DCHECK(default_font_);
}
@@ -340,8 +339,8 @@
void PlatformFontPango::InitPangoMetrics() {
if (!pango_metrics_inited_) {
pango_metrics_inited_ = true;
- PangoFontDescription* pango_desc = GetNativeFont();
- PangoFontMetrics* pango_metrics = GetPangoFontMetrics(pango_desc);
+ ScopedPangoFontDescription pango_desc(GetNativeFont());
+ PangoFontMetrics* pango_metrics = GetPangoFontMetrics(pango_desc.get());
underline_position_pixels_ =
pango_font_metrics_get_underline_position(pango_metrics) /
@@ -367,7 +366,6 @@
ASCIIToUTF16("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
const double dialog_units_pixels = (text_width_pixels / 26 + 1) / 2;
average_width_pixels_ = std::min(pango_width_pixels, dialog_units_pixels);
- pango_font_description_free(pango_desc);
}
}
« no previous file with comments | « ui/gfx/pango_util.cc ('k') | ui/gfx/platform_font_pango_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698