diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-03-24 11:07:31 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-24 19:16:51 +0000 |
commit | 4a58d1427f8a1b105578f2d27391ceda238ca59c (patch) | |
tree | 95d526e6dbe8f37008eed21194190c54b1f7864a /core/fpdfapi/font/font_int.h | |
parent | 73b607fcb5f904893a0610b2c7fb8726d09379e6 (diff) | |
download | pdfium-4a58d1427f8a1b105578f2d27391ceda238ca59c.tar.xz |
Refcount CPDF_CMap all the time.chromium/3052chromium/3051
Change-Id: I85ea9529f4188bf818ee96c37944e4546411f79c
Reviewed-on: https://pdfium-review.googlesource.com/3211
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/font/font_int.h')
-rw-r--r-- | core/fpdfapi/font/font_int.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/core/fpdfapi/font/font_int.h b/core/fpdfapi/font/font_int.h index 23513d4e90..926ea91a9e 100644 --- a/core/fpdfapi/font/font_int.h +++ b/core/fpdfapi/font/font_int.h @@ -12,7 +12,7 @@ #include <vector> #include "core/fpdfapi/font/cpdf_cidfont.h" -#include "core/fxcrt/cfx_maybe_owned.h" +#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_basic.h" class CPDF_CID2UnicodeMap; @@ -31,17 +31,17 @@ class CPDF_CMapManager { CPDF_CMapManager(); ~CPDF_CMapManager(); - CFX_MaybeOwned<CPDF_CMap> GetPredefinedCMap(const CFX_ByteString& name, - bool bPromptCJK); + CFX_RetainPtr<CPDF_CMap> GetPredefinedCMap(const CFX_ByteString& name, + bool bPromptCJK); CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK); private: - std::unique_ptr<CPDF_CMap> LoadPredefinedCMap(const CFX_ByteString& name, - bool bPromptCJK); + CFX_RetainPtr<CPDF_CMap> LoadPredefinedCMap(const CFX_ByteString& name, + bool bPromptCJK); std::unique_ptr<CPDF_CID2UnicodeMap> LoadCID2UnicodeMap(CIDSet charset, bool bPromptCJK); - std::map<CFX_ByteString, std::unique_ptr<CPDF_CMap>> m_CMaps; + std::map<CFX_ByteString, CFX_RetainPtr<CPDF_CMap>> m_CMaps; std::unique_ptr<CPDF_CID2UnicodeMap> m_CID2UnicodeMaps[6]; }; @@ -127,7 +127,7 @@ enum CIDCoding : uint8_t { CIDCODING_UTF16, }; -class CPDF_CMap { +class CPDF_CMap : public CFX_Retainable { public: enum CodingScheme : uint8_t { OneByte, @@ -136,8 +136,8 @@ class CPDF_CMap { MixedFourBytes }; - CPDF_CMap(); - ~CPDF_CMap(); + template <typename T, typename... Args> + friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); void LoadPredefined(CPDF_CMapManager* pMgr, const CFX_ByteString& name, @@ -156,6 +156,9 @@ class CPDF_CMap { friend class CPDF_CMapParser; friend class CPDF_CIDFont; + CPDF_CMap(); + ~CPDF_CMap() override; + CFX_ByteString m_PredefinedCMap; bool m_bVertical; CIDSet m_Charset; |