From 335cf093231c984a23cb9ea113148ea1f19621ba Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 9 Nov 2016 13:28:26 -0800 Subject: Return unique_ptr from CPDF_Object::Clone(). Because that's what clone does. There are numerous release() calls that will go away as more code is converted. Review-Url: https://codereview.chromium.org/2484033002 --- core/fpdfapi/parser/cpdf_object.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'core/fpdfapi/parser/cpdf_object.h') diff --git a/core/fpdfapi/parser/cpdf_object.h b/core/fpdfapi/parser/cpdf_object.h index 8f6491ec72..c24b40a789 100644 --- a/core/fpdfapi/parser/cpdf_object.h +++ b/core/fpdfapi/parser/cpdf_object.h @@ -46,12 +46,13 @@ class CPDF_Object { bool IsInline() const { return m_ObjNum == 0; } // Create a deep copy of the object. - virtual CPDF_Object* Clone() const = 0; + virtual std::unique_ptr Clone() const = 0; + // Create a deep copy of the object except any reference object be // copied to the object it points to directly. - virtual CPDF_Object* CloneDirectObject() const; - virtual CPDF_Object* GetDirect() const; + virtual std::unique_ptr CloneDirectObject() const; + virtual CPDF_Object* GetDirect() const; virtual CFX_ByteString GetString() const; virtual CFX_WideString GetUnicodeText() const; virtual FX_FLOAT GetNumber() const; @@ -97,7 +98,7 @@ class CPDF_Object { CPDF_Object() : m_ObjNum(0), m_GenNum(0) {} - CPDF_Object* CloneObjectNonCyclic(bool bDirect) const; + std::unique_ptr CloneObjectNonCyclic(bool bDirect) const; // Create a deep copy of the object with the option to either // copy a reference object or directly copy the object it refers to @@ -105,7 +106,7 @@ class CPDF_Object { // Also check cyclic reference against |pVisited|, no copy if it is found. // Complex objects should implement their own CloneNonCyclic() // function to properly check for possible loop. - virtual CPDF_Object* CloneNonCyclic( + virtual std::unique_ptr CloneNonCyclic( bool bDirect, std::set* pVisited) const; -- cgit v1.2.3