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

Unified Diff: ui/gfx/platform_font_pango.h

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: ui/gfx/platform_font_pango.h
diff --git a/ui/gfx/platform_font_pango.h b/ui/gfx/platform_font_pango.h
index cb93bf4bb0cc59c1f2df98a1ff2a5da733f3868d..845c15028b0763ffa3acef7649c3154bb419fe4c 100644
--- a/ui/gfx/platform_font_pango.h
+++ b/ui/gfx/platform_font_pango.h
@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
+#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "ui/gfx/platform_font.h"
@@ -52,7 +53,7 @@ class UI_EXPORT PlatformFontPango : public PlatformFont {
private:
// Create a new instance of this object with the specified properties. Called
// from DeriveFont.
- PlatformFontPango(SkTypeface* typeface,
+ PlatformFontPango(const skia::RefPtr<SkTypeface>& typeface,
const std::string& name,
int size,
int style);
@@ -60,10 +61,11 @@ class UI_EXPORT PlatformFontPango : public PlatformFont {
// Initialize this object.
void InitWithNameAndSize(const std::string& font_name, int font_size);
- void InitWithTypefaceNameSizeAndStyle(SkTypeface* typeface,
- const std::string& name,
- int size,
- int style);
+ void InitWithTypefaceNameSizeAndStyle(
+ const skia::RefPtr<SkTypeface>& typeface,
+ const std::string& name,
+ int size,
+ int style);
void InitFromPlatformFont(const PlatformFontPango* other);
// Potentially slow call to get pango metrics (average width, underline info).
@@ -78,11 +80,7 @@ class UI_EXPORT PlatformFontPango : public PlatformFont {
// The average width of a character, initialized and cached if needed.
double GetAverageWidth() const;
- // These two both point to the same SkTypeface. We use the SkAutoUnref to
- // handle the reference counting, but without @typeface_ we would have to
- // cast the SkRefCnt from @typeface_helper_ every time.
- scoped_ptr<SkAutoUnref> typeface_helper_;
- SkTypeface* typeface_;
+ skia::RefPtr<SkTypeface> typeface_;
// Additional information about the face
// Skia actually expects a family name and not a font name.

Powered by Google App Engine
This is Rietveld 408576698