From 71b0378c7ce0bf8bfa54eddb2c2734729bae27f1 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 10 Jun 2015 14:51:39 -0700 Subject: Merge to XFA: Cache the CPDF_Annot's subtype, since it should never changes. BUG=495300 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1178513002. (cherry picked from commit 7b2897c47245f04c806cfa8cee09458e31ba3777) Review URL: https://codereview.chromium.org/1177003002. --- core/include/fpdfdoc/fpdf_doc.h | 2 ++ core/src/fpdfdoc/doc_annot.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index 3c4820aa2b..be1bcd90e3 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -565,6 +565,8 @@ class CPDF_Annot : public CFX_PrivateData CPDF_AnnotList* const m_pList; + const CFX_ByteString m_sSubtype; + CFX_MapPtrToPtr m_APMap; }; diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index a72285c478..24ee6a9c90 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -135,8 +135,9 @@ int CPDF_AnnotList::GetIndex(CPDF_Annot* pAnnot) return -1; } CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList) - : m_pAnnotDict(pDict), - m_pList(pList) + : m_pAnnotDict(pDict), + m_pList(pList), + m_sSubtype(m_pAnnotDict->GetConstString(FX_BSTRC("Subtype"))) { } CPDF_Annot::~CPDF_Annot() @@ -156,7 +157,7 @@ void CPDF_Annot::ClearCachedAP() } CFX_ByteString CPDF_Annot::GetSubType() const { - return m_pAnnotDict ? m_pAnnotDict->GetConstString(FX_BSTRC("Subtype")) : CFX_ByteStringC(); + return m_sSubtype; } void CPDF_Annot::GetRect(CPDF_Rect& rect) const -- cgit v1.2.3