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

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

Issue 2419173002: Update CPDF_IndirectObjectHolder APIs for unique objects (Closed)
Patch Set: Fix issues Created 4 years, 2 months 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_document.cpp ('k') | core/fpdfapi/parser/cpdf_indirect_object_holder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 da4e942b5da73ca92fca89725e773febeebd827f..074e428d4350d92e815a7f61c4b5b458dcbbd1d4 100644
--- a/core/fpdfapi/parser/cpdf_indirect_object_holder.h
+++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.h
@@ -10,9 +10,14 @@
#include <map>
#include <memory>
+#include "core/fpdfapi/parser/cpdf_object.h"
+#include "core/fxcrt/cfx_string_pool_template.h"
+#include "core/fxcrt/cfx_weak_ptr.h"
#include "core/fxcrt/fx_system.h"
-class CPDF_Object;
+class CPDF_Array;
+class CPDF_Dictionary;
+class CPDF_Stream;
class CPDF_IndirectObjectHolder {
public:
@@ -24,12 +29,23 @@ class CPDF_IndirectObjectHolder {
CPDF_Object* GetIndirectObject(uint32_t objnum) const;
CPDF_Object* GetOrParseIndirectObject(uint32_t objnum);
- void ReleaseIndirectObject(uint32_t objnum);
+ void DeleteIndirectObject(uint32_t objnum);
+
+ // Take ownership of |pObj|, returns unowned pointer to it.
+ CPDF_Object* AddIndirectObject(UniqueObject pObj);
+
+ // Adds and owns a new object, returns unowned pointer to it.
+ CPDF_Array* AddIndirectArray();
+ CPDF_Dictionary* AddIndirectDictionary();
+ CPDF_Dictionary* AddIndirectDictionary(
+ const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ CPDF_Stream* AddIndirectStream();
+ CPDF_Stream* AddIndirectStream(uint8_t* pData,
+ uint32_t size,
+ CPDF_Dictionary* pDict);
- // Take ownership of |pObj|.
- uint32_t AddIndirectObject(CPDF_Object* pObj);
bool ReplaceIndirectObjectIfHigherGeneration(uint32_t objnum,
- CPDF_Object* pObj);
+ UniqueObject pObj);
uint32_t GetLastObjNum() const { return m_LastObjNum; }
void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; }
@@ -42,6 +58,8 @@ class CPDF_IndirectObjectHolder {
private:
uint32_t m_LastObjNum;
+
+ // Ordinary deleter, not Release().
std::map<uint32_t, std::unique_ptr<CPDF_Object>> m_IndirectObjs;
};
« no previous file with comments | « core/fpdfapi/parser/cpdf_document.cpp ('k') | core/fpdfapi/parser/cpdf_indirect_object_holder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698