summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_dictionary.h
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-04 08:25:34 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-04 08:25:34 -0700
commitf0d5b6c35fa343108a3ab7a25bc2cc2b3cf105b3 (patch)
treeedc3d5f35225971679e581c8ef951de8275a944b /core/fpdfapi/parser/cpdf_dictionary.h
parent4de3d095c9d9e961f93750cf1ebd489fd515be12 (diff)
downloadpdfium-f0d5b6c35fa343108a3ab7a25bc2cc2b3cf105b3.tar.xz
Revert of Remove CPDF_Object::Release() in favor of direct delete (patchset #11 id:200001 of https://codereview.chromium.org/2384883003/ )
Reason for revert: Looks like it's blocking the roll. https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_compile_dbg_ng/builds/186619 Original issue's description: > Remove CPDF_Object::Release() in favor of direct delete > > Follow-on once we prove Release always deletes in previous CL. > > Committed: https://pdfium.googlesource.com/pdfium/+/4de3d095c9d9e961f93750cf1ebd489fd515be12 TBR=thestig@chromium.org,tsepez@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2478253002
Diffstat (limited to 'core/fpdfapi/parser/cpdf_dictionary.h')
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h
index 4ef2f96ce7..fb8200f78c 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.h
+++ b/core/fpdfapi/parser/cpdf_dictionary.h
@@ -26,7 +26,6 @@ class CPDF_Dictionary : public CPDF_Object {
CPDF_Dictionary();
explicit CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
- ~CPDF_Dictionary() override;
// CPDF_Object.
Type GetType() const override;
@@ -89,6 +88,8 @@ class CPDF_Dictionary : public CPDF_Object {
CFX_WeakPtr<CFX_ByteStringPool> GetByteStringPool() const { return m_pPool; }
protected:
+ ~CPDF_Dictionary() override;
+
CFX_ByteString MaybeIntern(const CFX_ByteString& str);
CPDF_Object* CloneNonCyclic(
bool bDirect,
@@ -98,6 +99,9 @@ class CPDF_Dictionary : public CPDF_Object {
std::map<CFX_ByteString, CPDF_Object*> m_Map;
};
+using UniqueDictionary =
+ std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Object>>;
+
inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) {
return obj ? obj->AsDictionary() : nullptr;
}
@@ -106,13 +110,12 @@ inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) {
return obj ? obj->AsDictionary() : nullptr;
}
-inline std::unique_ptr<CPDF_Dictionary> ToDictionary(
- std::unique_ptr<CPDF_Object> obj) {
+inline UniqueDictionary ToDictionary(UniqueObject obj) {
CPDF_Dictionary* pDict = ToDictionary(obj.get());
if (!pDict)
return nullptr;
obj.release();
- return std::unique_ptr<CPDF_Dictionary>(pDict);
+ return UniqueDictionary(pDict);
}
#endif // CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_