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_array.h" | 7 #include "core/fpdfapi/parser/cpdf_array.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "core/fpdfapi/parser/cpdf_name.h" | 11 #include "core/fpdfapi/parser/cpdf_name.h" |
12 #include "core/fpdfapi/parser/cpdf_number.h" | 12 #include "core/fpdfapi/parser/cpdf_number.h" |
13 #include "core/fpdfapi/parser/cpdf_reference.h" | 13 #include "core/fpdfapi/parser/cpdf_reference.h" |
14 #include "core/fpdfapi/parser/cpdf_stream.h" | 14 #include "core/fpdfapi/parser/cpdf_stream.h" |
15 #include "core/fpdfapi/parser/cpdf_string.h" | 15 #include "core/fpdfapi/parser/cpdf_string.h" |
16 #include "third_party/base/logging.h" | 16 #include "third_party/base/logging.h" |
17 #include "third_party/base/stl_util.h" | 17 #include "third_party/base/stl_util.h" |
18 | 18 |
19 CPDF_Array::CPDF_Array() {} | 19 CPDF_Array::CPDF_Array() {} |
20 | 20 |
| 21 CPDF_Array::CPDF_Array(const CFX_WeakPtr<CFX_ByteStringPool>& pPool) |
| 22 : m_pPool(pPool) {} |
| 23 |
21 CPDF_Array::~CPDF_Array() { | 24 CPDF_Array::~CPDF_Array() { |
22 // Break cycles for cyclic references. | 25 // Break cycles for cyclic references. |
23 m_ObjNum = kInvalidObjNum; | 26 m_ObjNum = kInvalidObjNum; |
24 for (auto& it : m_Objects) { | 27 for (auto& it : m_Objects) { |
25 if (it && it->GetObjNum() == kInvalidObjNum) | 28 if (it && it->GetObjNum() == kInvalidObjNum) |
26 it.release(); | 29 it.release(); |
27 } | 30 } |
28 } | 31 } |
29 | 32 |
30 CPDF_Object::Type CPDF_Array::GetType() const { | 33 CPDF_Object::Type CPDF_Array::GetType() const { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return pRet; | 183 return pRet; |
181 } | 184 } |
182 | 185 |
183 CPDF_Object* CPDF_Array::Add(std::unique_ptr<CPDF_Object> pObj) { | 186 CPDF_Object* CPDF_Array::Add(std::unique_ptr<CPDF_Object> pObj) { |
184 ASSERT(IsArray()); | 187 ASSERT(IsArray()); |
185 CHECK(!pObj || pObj->IsInline()); | 188 CHECK(!pObj || pObj->IsInline()); |
186 CPDF_Object* pRet = pObj.get(); | 189 CPDF_Object* pRet = pObj.get(); |
187 m_Objects.push_back(std::move(pObj)); | 190 m_Objects.push_back(std::move(pObj)); |
188 return pRet; | 191 return pRet; |
189 } | 192 } |
OLD | NEW |