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

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

Issue 2384883003: Remove CPDF_Object::Release() in favor of direct delete (Closed)
Patch Set: rebase 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_parser.cpp ('k') | core/fpdfapi/parser/cpdf_stream.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_stream.h
diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h
index 73484d83359a06262a7afbc5242298078f03af97..f0ba31924e4147c82dce91e88d1d42b9c80ce9a3 100644
--- a/core/fpdfapi/parser/cpdf_stream.h
+++ b/core/fpdfapi/parser/cpdf_stream.h
@@ -20,6 +20,7 @@ class CPDF_Stream : public CPDF_Object {
// Takes ownership of |pData| and |pDict|.
CPDF_Stream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict);
+ ~CPDF_Stream() override;
// CPDF_Object.
Type GetType() const override;
@@ -47,20 +48,17 @@ class CPDF_Stream : public CPDF_Object {
bool IsMemoryBased() const { return m_bMemoryBased; }
protected:
- ~CPDF_Stream() override;
CPDF_Object* CloneNonCyclic(
bool bDirect,
std::set<const CPDF_Object*>* pVisited) const override;
- std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> m_pDict;
bool m_bMemoryBased = true;
uint32_t m_dwSize = 0;
+ std::unique_ptr<CPDF_Dictionary> m_pDict;
std::unique_ptr<uint8_t, FxFreeDeleter> m_pDataBuf;
IFX_SeekableReadStream* m_pFile = nullptr;
};
-using UniqueStream = std::unique_ptr<CPDF_Stream, ReleaseDeleter<CPDF_Object>>;
-
inline CPDF_Stream* ToStream(CPDF_Object* obj) {
return obj ? obj->AsStream() : nullptr;
}
@@ -69,12 +67,12 @@ inline const CPDF_Stream* ToStream(const CPDF_Object* obj) {
return obj ? obj->AsStream() : nullptr;
}
-inline UniqueStream ToStream(UniqueObject obj) {
+inline std::unique_ptr<CPDF_Stream> ToStream(std::unique_ptr<CPDF_Object> obj) {
CPDF_Stream* pStream = ToStream(obj.get());
if (!pStream)
return nullptr;
obj.release();
- return UniqueStream(pStream);
+ return std::unique_ptr<CPDF_Stream>(pStream);
}
#endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_H_
« no previous file with comments | « core/fpdfapi/parser/cpdf_parser.cpp ('k') | core/fpdfapi/parser/cpdf_stream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698