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

Unified Diff: samples/pdfium_test.cc

Issue 2397473006: Remove ownership of CPDFSDK_Document from CPDFXFA_Document (Closed)
Patch Set: Rebase to master 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 | « fpdfsdk/fpdfxfa/cpdfxfa_document.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/pdfium_test.cc
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 35e0d50678baa3592bef364772d5a356ee89a5d8..5c0f81b1b0a7f3b5799e6e1186a5561b70b6a674 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -86,19 +86,6 @@ static FPDF_FORMFILLINFO_PDFiumTest* ToPDFiumTestFormFillInfo(
return static_cast<FPDF_FORMFILLINFO_PDFiumTest*>(formFillInfo);
}
-static void CloseDocAndForm(FPDF_DOCUMENT doc, FPDF_FORMHANDLE form) {
-#ifdef PDF_ENABLE_XFA
- // Note: The shut down order here is the reverse of the non-XFA branch order.
- // Need to work out if this is required, and if it is, the lifetimes of
- // objects owned by |doc| that |form| reference.
- FPDF_CloseDocument(doc);
- FPDFDOC_ExitFormFillEnvironment(form);
-#else // PDF_ENABLE_XFA
- FPDFDOC_ExitFormFillEnvironment(form);
- FPDF_CloseDocument(doc);
-#endif // PDF_ENABLE_XFA
-}
-
static bool CheckDimensions(int stride, int width, int height) {
if (stride < 0 || width < 0 || height < 0)
return false;
@@ -791,7 +778,8 @@ void RenderPdf(const std::string& name,
if (nRet == PDF_DATA_ERROR) {
fprintf(stderr, "Unknown error in checking if page %d is available.\n",
i);
- CloseDocAndForm(doc, form);
+ FPDFDOC_ExitFormFillEnvironment(form);
+ FPDF_CloseDocument(doc);
return;
}
}
@@ -803,7 +791,8 @@ void RenderPdf(const std::string& name,
FORM_DoDocumentAAction(form, FPDFDOC_AACTION_WC);
- CloseDocAndForm(doc, form);
+ FPDFDOC_ExitFormFillEnvironment(form);
+ FPDF_CloseDocument(doc);
fprintf(stderr, "Rendered %d pages.\n", rendered_pages);
if (bad_pages)
« no previous file with comments | « fpdfsdk/fpdfxfa/cpdfxfa_document.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698