diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-05-19 17:08:52 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-20 00:31:33 +0000 |
commit | d15ce4c1e088e8bc084b52b0acdb5f0ef6597f95 (patch) | |
tree | 9de96e6b16569746b78a1aec044e10103779a9b4 /xfa/fgas/font/cfgas_fontmgr.h | |
parent | 910b7635d72b66a06ab22806ad09b650131b4dc2 (diff) | |
download | pdfium-d15ce4c1e088e8bc084b52b0acdb5f0ef6597f95.tar.xz |
Use observed ptrs from CFGAS_GEFont back to its font mgrs.chromium/3106
CFGAS_GEFonts are ref counted, and its a good thing since they
are managed by at least three different font managers:
CFGAS_FontMgr, CXFA_PDFFontMgr, and CXFA_FontMgr. None of these
have a clear claim to ownership of the CFGAS_GEFont.
CFGAS_GEFont has back-pointers to two of these, CFGAS_FontMgr, and
CXFA_PDFFontMgr, and they could each outlive the other. Thus the
font needs to watch for destruction of either of its managers, so
as to stop using it after its gone.
Bug: 724640
Change-Id: I907ec35e300e11e532e13545d51fb200ac86b4f9
Reviewed-on: https://pdfium-review.googlesource.com/5735
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'xfa/fgas/font/cfgas_fontmgr.h')
-rw-r--r-- | xfa/fgas/font/cfgas_fontmgr.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index 1ef78a79a6..ca3cf1c710 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -14,12 +14,14 @@ #include <vector> #include "core/fxcrt/cfx_crtfileaccess.h" +#include "core/fxcrt/cfx_observable.h" #include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/fx_extension.h" #include "core/fxge/cfx_fontmapper.h" #include "core/fxge/fx_freetype.h" #include "core/fxge/ifx_systemfontinfo.h" +#include "xfa/fxfa/cxfa_pdffontmgr.h" #define FX_FONTSTYLE_Normal 0x00 #define FX_FONTSTYLE_FixedPitch 0x01 @@ -32,8 +34,6 @@ #define FX_FONTSTYLE_ExactMatch 0x80000000 class CFX_FontSourceEnum_File; -class CXFA_PDFFontMgr; -class CFGAS_FontMgr; class CFGAS_GEFont; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -81,7 +81,7 @@ typedef void (*FX_LPEnumAllFonts)(std::deque<FX_FONTDESCRIPTOR>* fonts, FX_LPEnumAllFonts FX_GetDefFontEnumerator(); -class CFGAS_FontMgr { +class CFGAS_FontMgr : public CFX_Observable<CFGAS_FontMgr> { public: static std::unique_ptr<CFGAS_FontMgr> Create(FX_LPEnumAllFonts pEnumerator); @@ -180,7 +180,7 @@ class CFX_FontSourceEnum_File { std::vector<CFX_ByteString> m_FolderPaths; }; -class CFGAS_FontMgr { +class CFGAS_FontMgr : public CFX_Observable<CFGAS_FontMgr> { public: static std::unique_ptr<CFGAS_FontMgr> Create( CFX_FontSourceEnum_File* pFontEnum); |