Chromium Code Reviews| Index: core/fpdfapi/parser/cpdf_indirect_object_holder.h |
| diff --git a/core/fpdfapi/parser/cpdf_indirect_object_holder.h b/core/fpdfapi/parser/cpdf_indirect_object_holder.h |
| index db6f4acbf40eddbb9dd9e19d0a37a02210c8e4a6..6f6ecfeb864b791de1f4987cebd57ebf7acdf6d1 100644 |
| --- a/core/fpdfapi/parser/cpdf_indirect_object_holder.h |
| +++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.h |
| @@ -11,6 +11,7 @@ |
| #include <memory> |
| #include "core/fxcrt/fx_system.h" |
| +#include "third_party/base/ptr_util.h" |
| class CPDF_Object; |
| @@ -26,8 +27,16 @@ class CPDF_IndirectObjectHolder { |
| CPDF_Object* GetOrParseIndirectObject(uint32_t objnum); |
| void DeleteIndirectObject(uint32_t objnum); |
| - // Take ownership of |pObj|. |
| - uint32_t AddIndirectObject(CPDF_Object* pObj); |
| + // Creates and adds a new ojbect, returns unowned pointer to it. |
|
dsinclair
2016/11/15 18:55:51
Returns unowned pointer is a bit confusing. Ouowne
Tom Sepez
2016/11/15 19:15:16
Done.
|
| + template <typename T, typename... Args> |
| + T* NewIndirect(Args... args) { |
| + return static_cast<T*>(AddIndirectObject(pdfium::MakeUnique<T>(args...))); |
| + } |
| + |
| + // Takes ownership of |pObj|, returns unowned pointer to it. |
| + CPDF_Object* AddIndirectObject(std::unique_ptr<CPDF_Object> pObj); |
| + |
| + // Always takes ownership of |pObj|, return true if higher generation number. |
| bool ReplaceIndirectObjectIfHigherGeneration( |
| uint32_t objnum, |
| std::unique_ptr<CPDF_Object> pObj); |