summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-10 13:29:24 -0700
committerLei Zhang <thestig@chromium.org>2015-06-10 13:29:24 -0700
commit7b2897c47245f04c806cfa8cee09458e31ba3777 (patch)
tree5865605071623e1d3be54015790a0584bbd4974d
parentb3aa96cbee31e81d0a72a61027467a2713654499 (diff)
downloadpdfium-7b2897c47245f04c806cfa8cee09458e31ba3777.tar.xz
Cache the CPDF_Annot's subtype, since it should never changes.
BUG=495300 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1178513002.
-rw-r--r--core/include/fpdfdoc/fpdf_doc.h2
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp7
2 files changed, 6 insertions, 3 deletions
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h
index b46579ac88..67b799d06e 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 3fe20b6e28..e9084ba26e 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