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

Unified Diff: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.h

Issue 1943993003: Cache hb_font_t and the user data container instead of hb_face_t (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reset paint flags properly Created 4 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
Index: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.h
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.h b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.h
index cdc3233a1f1b1ab6bf220a4f2740cabf2a868579..30cd6c18e1e0f1f4435fc3defa51f7e5b1360ee9 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.h
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.h
@@ -60,8 +60,7 @@ public:
// In order to support the restricting effect of unicode-range optionally a
// range restriction can be passed in, which will restrict which glyphs we
// return in the harfBuzzGetGlyph function.
- hb_font_t* getScaledFont(PassRefPtr<UnicodeRangeSet> = nullptr);
- hb_face_t* face() const { return m_face; }
+ hb_font_t* getScaledFont(PassRefPtr<UnicodeRangeSet> = nullptr) const;
private:
HarfBuzzFace(FontPlatformData*, uint64_t);
@@ -71,9 +70,8 @@ private:
FontPlatformData* m_platformData;
uint64_t m_uniqueID;
- hb_face_t* m_face;
- OwnPtr<hb_font_t> m_unscaledFont;
- OwnPtr<HarfBuzzFontData> m_harfBuzzFontData;
+ hb_font_t* m_unscaledFont;
+ HarfBuzzFontData* m_harfBuzzFontData;
};
} // namespace blink
@@ -90,6 +88,16 @@ template<> struct OwnedPtrDeleter<hb_font_t> {
}
};
+template<typename T> struct OwnedPtrDeleter;
+template<> struct OwnedPtrDeleter<hb_face_t> {
+ STATIC_ONLY(OwnedPtrDeleter);
+ static void deletePtr(hb_face_t* face)
+ {
+ if (face)
+ hb_face_destroy(face);
+ }
+};
+
} // namespace WTF
#endif // HarfBuzzFace_h

Powered by Google App Engine
This is Rietveld 408576698