Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Unified Diff: core/fpdfapi/parser/cpdf_dictionary.h

Issue 2478253002: Revert of Remove CPDF_Object::Release() in favor of direct delete (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_data_avail.cpp ('k') | core/fpdfapi/parser/cpdf_dictionary.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_dictionary.h
diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h
index 4ef2f96ce74cc32d94fe76983b0d3041ea145e71..fb8200f78c47bfb26528a45b4367d4808f69a4cc 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.h
+++ b/core/fpdfapi/parser/cpdf_dictionary.h
@@ -26,7 +26,6 @@
CPDF_Dictionary();
explicit CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
- ~CPDF_Dictionary() override;
// CPDF_Object.
Type GetType() const override;
@@ -89,6 +88,8 @@
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 @@
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 @@
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_
« no previous file with comments | « core/fpdfapi/parser/cpdf_data_avail.cpp ('k') | core/fpdfapi/parser/cpdf_dictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698