summaryrefslogtreecommitdiff
path: root/core/fxge/cfx_fontmgr.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-30 21:02:03 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-30 21:02:03 +0000
commitda65a8ea74d2748c93015fb5521da678e29e6548 (patch)
treec9455640dd3e89a43ab4cf7e3bf17ed475033b5d /core/fxge/cfx_fontmgr.h
parentf213df4a87ede709db1f311bbad3c68fbccf159c (diff)
downloadpdfium-da65a8ea74d2748c93015fb5521da678e29e6548.tar.xz
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 <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxge/cfx_fontmgr.h')
-rw-r--r--core/fxge/cfx_fontmgr.h5
1 files changed, 3 insertions, 2 deletions
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 <map>
#include <memory>
+#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<uint8_t, FxFreeDeleter> 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<uint8_t, FxFreeDeleter> pData,
uint32_t size,
int font_offset);
FXFT_Face GetFileFace(const char* filename, int face_index);