OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fpdfapi/parser/cpdf_indirect_object_holder.h" | 7 #include "core/fpdfapi/parser/cpdf_indirect_object_holder.h" |
8 | 8 |
9 #include "core/fpdfapi/parser/cpdf_object.h" | 9 #include "core/fpdfapi/parser/cpdf_object.h" |
10 #include "core/fpdfapi/parser/cpdf_parser.h" | 10 #include "core/fpdfapi/parser/cpdf_parser.h" |
11 | 11 |
12 CPDF_IndirectObjectHolder::CPDF_IndirectObjectHolder() : m_LastObjNum(0) {} | 12 CPDF_IndirectObjectHolder::CPDF_IndirectObjectHolder() |
| 13 : m_LastObjNum(0), |
| 14 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) {} |
13 | 15 |
14 CPDF_IndirectObjectHolder::~CPDF_IndirectObjectHolder() {} | 16 CPDF_IndirectObjectHolder::~CPDF_IndirectObjectHolder() { |
| 17 m_pByteStringPool.DeleteObject(); // Make weak. |
| 18 } |
15 | 19 |
16 CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject( | 20 CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject( |
17 uint32_t objnum) const { | 21 uint32_t objnum) const { |
18 auto it = m_IndirectObjs.find(objnum); | 22 auto it = m_IndirectObjs.find(objnum); |
19 return it != m_IndirectObjs.end() ? it->second.get() : nullptr; | 23 return it != m_IndirectObjs.end() ? it->second.get() : nullptr; |
20 } | 24 } |
21 | 25 |
22 CPDF_Object* CPDF_IndirectObjectHolder::GetOrParseIndirectObject( | 26 CPDF_Object* CPDF_IndirectObjectHolder::GetOrParseIndirectObject( |
23 uint32_t objnum) { | 27 uint32_t objnum) { |
24 if (objnum == 0) | 28 if (objnum == 0) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return true; | 74 return true; |
71 } | 75 } |
72 | 76 |
73 void CPDF_IndirectObjectHolder::DeleteIndirectObject(uint32_t objnum) { | 77 void CPDF_IndirectObjectHolder::DeleteIndirectObject(uint32_t objnum) { |
74 CPDF_Object* pObj = GetIndirectObject(objnum); | 78 CPDF_Object* pObj = GetIndirectObject(objnum); |
75 if (!pObj || pObj->GetObjNum() == CPDF_Object::kInvalidObjNum) | 79 if (!pObj || pObj->GetObjNum() == CPDF_Object::kInvalidObjNum) |
76 return; | 80 return; |
77 | 81 |
78 m_IndirectObjs.erase(objnum); | 82 m_IndirectObjs.erase(objnum); |
79 } | 83 } |
OLD | NEW |