From da65a8ea74d2748c93015fb5521da678e29e6548 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 30 Apr 2018 21:02:03 +0000 Subject: Saner memory managment in cttfontdesc, part 1. A subsequent patch will tackle the ad-hoc ref counting, but we can tidy this before going down that hole. Decouple CTTFontDesc creation from face setting. Remove union and treat single-entry case as vector's first element. Pass unique_ptr to prove memory ownership. Change-Id: Ic427798da04f3afbb65a56ee10045b9f22457a73 Reviewed-on: https://pdfium-review.googlesource.com/31730 Reviewed-by: dsinclair Commit-Queue: Tom Sepez --- core/fxge/cfx_fontmgr.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core/fxge/cfx_fontmgr.h') diff --git a/core/fxge/cfx_fontmgr.h b/core/fxge/cfx_fontmgr.h index 6ca0970bdc..24c5ad3b6f 100644 --- a/core/fxge/cfx_fontmgr.h +++ b/core/fxge/cfx_fontmgr.h @@ -10,6 +10,7 @@ #include #include +#include "core/fxcrt/fx_memory.h" #include "core/fxge/fx_font.h" class CFX_FontMapper; @@ -31,7 +32,7 @@ class CFX_FontMgr { FXFT_Face AddCachedFace(const ByteString& face_name, int weight, bool bItalic, - uint8_t* pData, + std::unique_ptr pData, uint32_t size, int face_index); FXFT_Face GetCachedTTCFace(int ttc_size, @@ -40,7 +41,7 @@ class CFX_FontMgr { uint8_t** pFontData); FXFT_Face AddCachedTTCFace(int ttc_size, uint32_t checksum, - uint8_t* pData, + std::unique_ptr pData, uint32_t size, int font_offset); FXFT_Face GetFileFace(const char* filename, int face_index); -- cgit v1.2.3