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

Side by Side Diff: fpdfsdk/fpdfdoc_unittest.cpp

Issue 2489283003: Make AddIndirectObject() take a unique_ptr. (Closed)
Patch Set: Address review comments Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/fpdf_transformpage.cpp ('k') | fpdfsdk/fpdfppo.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "public/fpdf_doc.h" 5 #include "public/fpdf_doc.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "core/fpdfapi/cpdf_modulemgr.h" 10 #include "core/fpdfapi/cpdf_modulemgr.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 m_pRootObj.reset(); 74 m_pRootObj.reset();
75 m_pIndirectObjs = nullptr; 75 m_pIndirectObjs = nullptr;
76 m_pDoc.reset(); 76 m_pDoc.reset();
77 CPDF_ModuleMgr::Destroy(); 77 CPDF_ModuleMgr::Destroy();
78 } 78 }
79 79
80 std::vector<DictObjInfo> CreateDictObjs(int num) { 80 std::vector<DictObjInfo> CreateDictObjs(int num) {
81 std::vector<DictObjInfo> info; 81 std::vector<DictObjInfo> info;
82 for (int i = 0; i < num; ++i) { 82 for (int i = 0; i < num; ++i) {
83 // Objects created will be released by the document. 83 // Objects created will be released by the document.
84 CPDF_Dictionary* obj = new CPDF_Dictionary(); 84 CPDF_Dictionary* obj = m_pIndirectObjs->NewIndirect<CPDF_Dictionary>();
85 info.push_back({m_pIndirectObjs->AddIndirectObject(obj), obj}); 85 info.push_back({obj->GetObjNum(), obj});
86 } 86 }
87 return info; 87 return info;
88 } 88 }
89 89
90 protected: 90 protected:
91 std::unique_ptr<CPDF_TestPdfDocument> m_pDoc; 91 std::unique_ptr<CPDF_TestPdfDocument> m_pDoc;
92 CPDF_IndirectObjectHolder* m_pIndirectObjs; 92 CPDF_IndirectObjectHolder* m_pIndirectObjs;
93 std::unique_ptr<CPDF_Dictionary> m_pRootObj; 93 std::unique_ptr<CPDF_Dictionary> m_pRootObj;
94 }; 94 };
95 95
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 EXPECT_TRUE(FPDFDest_GetLocationInPage(array.get(), &hasX, &hasY, &hasZoom, 264 EXPECT_TRUE(FPDFDest_GetLocationInPage(array.get(), &hasX, &hasY, &hasZoom,
265 &x, &y, &zoom)); 265 &x, &y, &zoom));
266 EXPECT_FALSE(hasX); 266 EXPECT_FALSE(hasX);
267 EXPECT_FALSE(hasY); 267 EXPECT_FALSE(hasY);
268 EXPECT_FALSE(hasZoom); 268 EXPECT_FALSE(hasZoom);
269 269
270 array = pdfium::MakeUnique<CPDF_Array>(); 270 array = pdfium::MakeUnique<CPDF_Array>();
271 EXPECT_FALSE(FPDFDest_GetLocationInPage(array.get(), &hasX, &hasY, &hasZoom, 271 EXPECT_FALSE(FPDFDest_GetLocationInPage(array.get(), &hasX, &hasY, &hasZoom,
272 &x, &y, &zoom)); 272 &x, &y, &zoom));
273 } 273 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdf_transformpage.cpp ('k') | fpdfsdk/fpdfppo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698