summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_bookmarktree.cpp4
-rw-r--r--core/fpdfdoc/cpdf_bookmarktree.h8
-rw-r--r--core/fpdfdoc/cpdf_docjsactions.cpp10
-rw-r--r--core/fpdfdoc/cpdf_docjsactions.h6
4 files changed, 19 insertions, 9 deletions
diff --git a/core/fpdfdoc/cpdf_bookmarktree.cpp b/core/fpdfdoc/cpdf_bookmarktree.cpp
index 2a4314547c..b5dfe4f45f 100644
--- a/core/fpdfdoc/cpdf_bookmarktree.cpp
+++ b/core/fpdfdoc/cpdf_bookmarktree.cpp
@@ -8,6 +8,10 @@
#include "core/fpdfapi/parser/cpdf_document.h"
+CPDF_BookmarkTree::CPDF_BookmarkTree(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
+
+CPDF_BookmarkTree::~CPDF_BookmarkTree() {}
+
CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild(
const CPDF_Bookmark& parent) const {
CPDF_Dictionary* pParentDict = parent.GetDict();
diff --git a/core/fpdfdoc/cpdf_bookmarktree.h b/core/fpdfdoc/cpdf_bookmarktree.h
index 7207357b1e..a854d6f4b1 100644
--- a/core/fpdfdoc/cpdf_bookmarktree.h
+++ b/core/fpdfdoc/cpdf_bookmarktree.h
@@ -8,19 +8,21 @@
#define CORE_FPDFDOC_CPDF_BOOKMARKTREE_H_
#include "core/fpdfdoc/cpdf_bookmark.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
class CPDF_Document;
class CPDF_BookmarkTree {
public:
- explicit CPDF_BookmarkTree(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
+ explicit CPDF_BookmarkTree(CPDF_Document* pDoc);
+ ~CPDF_BookmarkTree();
CPDF_Bookmark GetFirstChild(const CPDF_Bookmark& parent) const;
CPDF_Bookmark GetNextSibling(const CPDF_Bookmark& bookmark) const;
- CPDF_Document* GetDocument() const { return m_pDocument; }
+ CPDF_Document* GetDocument() const { return m_pDocument.Get(); }
private:
- CPDF_Document* const m_pDocument;
+ CFX_UnownedPtr<CPDF_Document> const m_pDocument;
};
#endif // CORE_FPDFDOC_CPDF_BOOKMARKTREE_H_
diff --git a/core/fpdfdoc/cpdf_docjsactions.cpp b/core/fpdfdoc/cpdf_docjsactions.cpp
index c0e7a78fd6..59dbccce85 100644
--- a/core/fpdfdoc/cpdf_docjsactions.cpp
+++ b/core/fpdfdoc/cpdf_docjsactions.cpp
@@ -10,9 +10,11 @@
CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
+CPDF_DocJSActions::~CPDF_DocJSActions() {}
+
int CPDF_DocJSActions::CountJSActions() const {
ASSERT(m_pDocument);
- CPDF_NameTree name_tree(m_pDocument, "JavaScript");
+ CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
return name_tree.GetCount();
}
@@ -20,7 +22,7 @@ CPDF_Action CPDF_DocJSActions::GetJSActionAndName(
int index,
CFX_ByteString* csName) const {
ASSERT(m_pDocument);
- CPDF_NameTree name_tree(m_pDocument, "JavaScript");
+ CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
CPDF_Object* pAction = name_tree.LookupValueAndName(index, csName);
return ToDictionary(pAction) ? CPDF_Action(pAction->GetDict())
: CPDF_Action();
@@ -28,7 +30,7 @@ CPDF_Action CPDF_DocJSActions::GetJSActionAndName(
CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const {
ASSERT(m_pDocument);
- CPDF_NameTree name_tree(m_pDocument, "JavaScript");
+ CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
CPDF_Object* pAction = name_tree.LookupValue(csName);
return ToDictionary(pAction) ? CPDF_Action(pAction->GetDict())
: CPDF_Action();
@@ -36,6 +38,6 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const {
int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const {
ASSERT(m_pDocument);
- CPDF_NameTree name_tree(m_pDocument, "JavaScript");
+ CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
return name_tree.GetIndex(csName);
}
diff --git a/core/fpdfdoc/cpdf_docjsactions.h b/core/fpdfdoc/cpdf_docjsactions.h
index 16b6be3d69..328b8869f6 100644
--- a/core/fpdfdoc/cpdf_docjsactions.h
+++ b/core/fpdfdoc/cpdf_docjsactions.h
@@ -8,6 +8,7 @@
#define CORE_FPDFDOC_CPDF_DOCJSACTIONS_H_
#include "core/fpdfdoc/cpdf_action.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_string.h"
class CPDF_Document;
@@ -15,15 +16,16 @@ class CPDF_Document;
class CPDF_DocJSActions {
public:
explicit CPDF_DocJSActions(CPDF_Document* pDoc);
+ ~CPDF_DocJSActions();
int CountJSActions() const;
CPDF_Action GetJSActionAndName(int index, CFX_ByteString* csName) const;
CPDF_Action GetJSAction(const CFX_ByteString& csName) const;
int FindJSAction(const CFX_ByteString& csName) const;
- CPDF_Document* GetDocument() const { return m_pDocument; }
+ CPDF_Document* GetDocument() const { return m_pDocument.Get(); }
private:
- CPDF_Document* const m_pDocument;
+ CFX_UnownedPtr<CPDF_Document> const m_pDocument;
};
#endif // CORE_FPDFDOC_CPDF_DOCJSACTIONS_H_