summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_annot.h
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-11-10 10:47:21 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-10 10:47:22 -0800
commitf3480661a20c259581e7c100b0d5d06950a9559b (patch)
tree5353bb1456069c191f7418ff91966f97f002c9b2 /core/fpdfdoc/cpdf_annot.h
parent69bbfa8fb536143e045a9dce3006ddd91785adbb (diff)
downloadpdfium-f3480661a20c259581e7c100b0d5d06950a9559b.tar.xz
Use more unique_ptrs for CPDF_Annot and friends.
Review-Url: https://codereview.chromium.org/2494583002
Diffstat (limited to 'core/fpdfdoc/cpdf_annot.h')
-rw-r--r--core/fpdfdoc/cpdf_annot.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/fpdfdoc/cpdf_annot.h b/core/fpdfdoc/cpdf_annot.h
index e5404a8c9e..2dcddb0ef8 100644
--- a/core/fpdfdoc/cpdf_annot.h
+++ b/core/fpdfdoc/cpdf_annot.h
@@ -73,7 +73,9 @@ class CPDF_Annot {
static CFX_ByteString AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype);
static CFX_FloatRect RectFromQuadPoints(CPDF_Dictionary* pAnnotDict);
- CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument, bool bToOwnDict);
+ // The second constructor does not take ownership of the dictionary.
+ CPDF_Annot(std::unique_ptr<CPDF_Dictionary> pDict, CPDF_Document* pDocument);
+ CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument);
~CPDF_Annot();
CPDF_Annot::Subtype GetSubtype() const;
@@ -103,6 +105,7 @@ class CPDF_Annot {
void SetPopupAnnot(CPDF_Annot* pAnnot) { m_pPopupAnnot = pAnnot; }
private:
+ void Init();
void GenerateAPIfNeeded();
bool ShouldDrawAnnotation();
@@ -117,12 +120,12 @@ class CPDF_Annot {
CPDF_Annot::Subtype m_nSubtype;
std::map<CPDF_Stream*, std::unique_ptr<CPDF_Form>> m_APMap;
// |m_bOpenState| is only set for popup annotations.
- bool m_bOpenState;
+ bool m_bOpenState = false;
bool m_bHasGeneratedAP;
bool m_bIsTextMarkupAnnotation;
// Not owned. If there is a valid pointer in |m_pPopupAnnot|,
// then this annot is never a popup.
- CPDF_Annot* m_pPopupAnnot;
+ CPDF_Annot* m_pPopupAnnot = nullptr;
};
CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,