Cache the CPDF_Annot's subtype, since it should never changes.
BUG=495300
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1178513002.
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h
index b46579a..67b799d 100644
--- a/core/include/fpdfdoc/fpdf_doc.h
+++ b/core/include/fpdfdoc/fpdf_doc.h
@@ -565,6 +565,8 @@
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 3fe20b6..e9084ba 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -135,8 +135,9 @@
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 @@
}
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