summaryrefslogtreecommitdiff
path: root/core/fpdfapi/edit
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-05-25 22:38:49 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-25 22:38:49 +0000
commit2aa4b2f3928ccd8393f60db8f7b740c75f4e8a8d (patch)
tree3c31b98ac48d5bb95c782cfe3c754037e66119d9 /core/fpdfapi/edit
parentb1ec280837cc6e1932754ef40de26d12b77aa910 (diff)
downloadpdfium-2aa4b2f3928ccd8393f60db8f7b740c75f4e8a8d.tar.xz
Make CPDF_Page retainable.
Small step to reducing the differences between XFA and non-XFA. We still use the RetainPtr pretty much as if it were an unique_ptr, in that we're not yet caching pages and handing out multiple pointers to the same page in the non-XFA case. The one change is in page view cleanup, where we no longer need a boolean and can take (sufficient) page ownership with a RetainPtr. Tidy up some document.h -> page.h -> document.h circular inclusion while we're at it. NOTE: Wait for imminent branch to pass before landing. We'll want this to bake a while. Change-Id: I64a2f12ac3424ece1063d40583995b834117cf34 Reviewed-on: https://pdfium-review.googlesource.com/32790 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/edit')
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
index d97e8abf0b..1244b12331 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
@@ -54,8 +54,8 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessRect) {
pPathObj->m_FillType = FXFILL_ALTERNATE;
pPathObj->m_bStroke = true;
- auto pTestPage = pdfium::MakeUnique<CPDF_Page>(nullptr, nullptr, false);
- CPDF_PageContentGenerator generator(pTestPage.get());
+ auto pTestPage = pdfium::MakeRetain<CPDF_Page>(nullptr, nullptr, false);
+ CPDF_PageContentGenerator generator(pTestPage.Get());
std::ostringstream buf;
TestProcessPath(&generator, &buf, pPathObj.get());
EXPECT_EQ("q 1 0 0 1 0 0 cm 10 5 3 25 re B* Q\n", ByteString(buf));
@@ -98,8 +98,8 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessPath) {
pPathObj->m_FillType = FXFILL_WINDING;
pPathObj->m_bStroke = false;
- auto pTestPage = pdfium::MakeUnique<CPDF_Page>(nullptr, nullptr, false);
- CPDF_PageContentGenerator generator(pTestPage.get());
+ auto pTestPage = pdfium::MakeRetain<CPDF_Page>(nullptr, nullptr, false);
+ CPDF_PageContentGenerator generator(pTestPage.Get());
std::ostringstream buf;
TestProcessPath(&generator, &buf, pPathObj.get());
EXPECT_EQ(
@@ -129,8 +129,8 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) {
auto pDoc = pdfium::MakeUnique<CPDF_Document>(nullptr);
pDoc->CreateNewDoc();
CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(0);
- auto pTestPage = pdfium::MakeUnique<CPDF_Page>(pDoc.get(), pPageDict, false);
- CPDF_PageContentGenerator generator(pTestPage.get());
+ auto pTestPage = pdfium::MakeRetain<CPDF_Page>(pDoc.get(), pPageDict, false);
+ CPDF_PageContentGenerator generator(pTestPage.Get());
std::ostringstream buf;
TestProcessPath(&generator, &buf, pPathObj.get());
ByteString pathString(buf);
@@ -168,8 +168,8 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessStandardText) {
auto pDoc = pdfium::MakeUnique<CPDF_Document>(nullptr);
pDoc->CreateNewDoc();
CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(0);
- auto pTestPage = pdfium::MakeUnique<CPDF_Page>(pDoc.get(), pPageDict, false);
- CPDF_PageContentGenerator generator(pTestPage.get());
+ auto pTestPage = pdfium::MakeRetain<CPDF_Page>(pDoc.get(), pPageDict, false);
+ CPDF_PageContentGenerator generator(pTestPage.Get());
auto pTextObj = pdfium::MakeUnique<CPDF_TextObject>();
CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc.get(), "Times-Roman");
pTextObj->m_TextState.SetFont(pFont);
@@ -231,8 +231,8 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessText) {
auto pDoc = pdfium::MakeUnique<CPDF_Document>(nullptr);
pDoc->CreateNewDoc();
CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(0);
- auto pTestPage = pdfium::MakeUnique<CPDF_Page>(pDoc.get(), pPageDict, false);
- CPDF_PageContentGenerator generator(pTestPage.get());
+ auto pTestPage = pdfium::MakeRetain<CPDF_Page>(pDoc.get(), pPageDict, false);
+ CPDF_PageContentGenerator generator(pTestPage.Get());
std::ostringstream buf;
{