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

Unified Diff: ui/gfx/pango_util.h

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/font.h ('k') | ui/gfx/pango_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/pango_util.h
===================================================================
--- ui/gfx/pango_util.h (revision 137485)
+++ ui/gfx/pango_util.h (working copy)
@@ -11,6 +11,7 @@
#include <string>
#include "base/i18n/rtl.h"
+#include "base/logging.h"
#include "base/string16.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/ui_export.h"
@@ -30,6 +31,26 @@
// resolution hasn't been set.
double GetPangoResolution();
+// Utility class to ensure that PangoFontDescription is freed.
+class ScopedPangoFontDescription {
+ public:
+ explicit ScopedPangoFontDescription(PangoFontDescription* description)
+ : description_(description) {
+ DCHECK(description);
+ }
+
+ ~ScopedPangoFontDescription() {
+ pango_font_description_free(description_);
+ }
+
+ PangoFontDescription* get() { return description_; }
+
+ private:
+ PangoFontDescription* description_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedPangoFontDescription);
+};
+
// Uses Pango to draw text onto |cr|. This is the public method for d
void UI_EXPORT DrawTextOntoCairoSurface(cairo_t* cr,
const string16& text,
« no previous file with comments | « ui/gfx/font.h ('k') | ui/gfx/pango_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698