summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_annot.h
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-13 10:28:47 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-13 10:28:47 -0800
commit05b4fc1227f5b6d39a3a65daf915a92ea3b749f4 (patch)
tree681b1f98593fb3923b46dff4f58a627aeb131d40 /core/fpdfdoc/cpdf_annot.h
parent8df02348924f66e14131aa378abc6c6ea7a352b6 (diff)
downloadpdfium-05b4fc1227f5b6d39a3a65daf915a92ea3b749f4.tar.xz
Use CFX_MaybeOwned<> in CPDF_Annot.
Avoid another unique_ptr release and a separate flag. Review-Url: https://codereview.chromium.org/2570913002
Diffstat (limited to 'core/fpdfdoc/cpdf_annot.h')
-rw-r--r--core/fpdfdoc/cpdf_annot.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/core/fpdfdoc/cpdf_annot.h b/core/fpdfdoc/cpdf_annot.h
index 2dcddb0ef8..188106acdf 100644
--- a/core/fpdfdoc/cpdf_annot.h
+++ b/core/fpdfdoc/cpdf_annot.h
@@ -10,6 +10,7 @@
#include <map>
#include <memory>
+#include "core/fxcrt/cfx_maybe_owned.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
@@ -81,9 +82,8 @@ class CPDF_Annot {
CPDF_Annot::Subtype GetSubtype() const;
uint32_t GetFlags() const;
CFX_FloatRect GetRect() const;
- const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; }
- CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; }
CPDF_Document* GetDocument() const { return m_pDocument; }
+ CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict.Get(); }
bool DrawAppearance(CPDF_Page* pPage,
CFX_RenderDevice* pDevice,
@@ -111,11 +111,7 @@ class CPDF_Annot {
CFX_FloatRect RectForDrawing() const;
- // For regular annotations, |m_pAnnotDict| is not owned. For
- // our artificially created popup annotations, |m_pAnnotDict|
- // is owned by this class.
- bool m_bOwnedAnnotDict;
- CPDF_Dictionary* m_pAnnotDict;
+ CFX_MaybeOwned<CPDF_Dictionary> m_pAnnotDict;
CPDF_Document* const m_pDocument;
CPDF_Annot::Subtype m_nSubtype;
std::map<CPDF_Stream*, std::unique_ptr<CPDF_Form>> m_APMap;