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

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

Issue 2043613002: Remove the use of OwnedPtrDeleter in HarfBuzzFace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
index 46d7870da57e8e3449392839be5bff982546d014..e1b1bd1eefa1e4f0ca3cb705bc46cc28f95cd8f5 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -53,6 +53,26 @@
namespace blink {
+struct HbFontDeleter {
+ void operator()(hb_font_t* font)
+ {
+ if (font)
+ hb_font_destroy(font);
+ }
+};
+
+using HbFontUniquePtr = std::unique_ptr<hb_font_t, HbFontDeleter>;
+
+struct HbFaceDeleter {
+ void operator()(hb_face_t* face)
+ {
+ if (face)
+ hb_face_destroy(face);
+ }
+};
+
+using HbFaceUniquePtr = std::unique_ptr<hb_face_t, HbFaceDeleter>;
+
// struct to carry user-pointer data for hb_font_t callback functions.
struct HarfBuzzFontData {
USING_FAST_MALLOC(HarfBuzzFontData);
@@ -91,11 +111,11 @@ public:
private:
explicit HbFontCacheEntry(hb_font_t* font)
- : m_hbFont(adoptPtr(font))
+ : m_hbFont(HbFontUniquePtr(font))
, m_hbFontData(adoptPtr(new HarfBuzzFontData()))
{ };
- OwnPtr<hb_font_t> m_hbFont;
+ HbFontUniquePtr m_hbFont;
OwnPtr<HarfBuzzFontData> m_hbFontData;
};
@@ -115,7 +135,7 @@ HarfBuzzFace::HarfBuzzFace(FontPlatformData* platformData, uint64_t uniqueID)
{
HarfBuzzFontCache::AddResult result = harfBuzzFontCache()->add(m_uniqueID, nullptr);
if (result.isNewEntry) {
- OwnPtr<hb_face_t> face = adoptPtr(createFace());
+ HbFaceUniquePtr face(createFace());
result.storedValue->value = createHbFontCacheEntry(face.get());
}
result.storedValue->value->ref();
@@ -302,7 +322,7 @@ hb_face_t* HarfBuzzFace::createFace()
PassRefPtr<HbFontCacheEntry> createHbFontCacheEntry(hb_face_t* face)
{
- OwnPtr<hb_font_t> otFont = adoptPtr(hb_font_create(face));
+ HbFontUniquePtr otFont(hb_font_create(face));
hb_ot_font_set_funcs(otFont.get());
// Creating a sub font means that non-available functions
// are found from the parent.
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698