diff options
author | dsinclair <dsinclair@chromium.org> | 2016-10-13 10:57:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-13 10:57:01 -0700 |
commit | b685e6471075bebd26711bc183de3128f54932e3 (patch) | |
tree | e3ddfa51c087bb7a6960f117f68a412b14b322d8 /fpdfsdk/fpdfview.cpp | |
parent | abefb79577b32d291d14d7e01a70f6f8cf213bd3 (diff) | |
download | pdfium-b685e6471075bebd26711bc183de3128f54932e3.tar.xz |
Revert of Make the CPDFXFA_App non-global (patchset #3 id:80001 of https://codereview.chromium.org/2416753002/ )
Reason for revert:
https://build.chromium.org/p/client.pdfium/builders/linux_xfa_asan_lsan/builds/112/steps/embeddertests/logs/stdio
msan is sad.
Original issue's description:
> Make the CPDFXFA_App non-global
>
> This CL changes CPDFXFA_App from a global object to a child of the
> CPDFXFA_Document objects.
>
> BUG=pdfium:623
>
> Committed: https://pdfium.googlesource.com/pdfium/+/abefb79577b32d291d14d7e01a70f6f8cf213bd3
TBR=tsepez@chromium.org,thestig@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=pdfium:623
Review-Url: https://codereview.chromium.org/2412903004
Diffstat (limited to 'fpdfsdk/fpdfview.cpp')
-rw-r--r-- | fpdfsdk/fpdfview.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index cb0cf5917c..3ab81fe112 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -42,7 +42,6 @@ #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" #include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h" #include "public/fpdf_formfill.h" -#include "xfa/fxbarcode/BC_Library.h" #endif // PDF_ENABLE_XFA #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -71,8 +70,8 @@ CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc) { FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc) { #ifdef PDF_ENABLE_XFA - return doc ? FPDFDocumentFromUnderlying( - new CPDFXFA_Document(pdfium::WrapUnique(doc))) + return doc ? FPDFDocumentFromUnderlying(new CPDFXFA_Document( + pdfium::WrapUnique(doc), CPDFXFA_App::GetInstance())) : nullptr; #else // PDF_ENABLE_XFA return FPDFDocumentFromUnderlying(doc); @@ -286,19 +285,19 @@ FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* cfg) { pModuleMgr->LoadEmbeddedKorea1CMaps(); #ifdef PDF_ENABLE_XFA - FXJSE_Initialize(); - BC_Library_Init(); + CPDFXFA_App::GetInstance()->Initialize( + (cfg && cfg->version >= 2) ? static_cast<v8::Isolate*>(cfg->m_pIsolate) + : nullptr); #endif // PDF_ENABLE_XFA + if (cfg && cfg->version >= 2) IJS_Runtime::Initialize(cfg->m_v8EmbedderSlot, cfg->m_pIsolate); } DLLEXPORT void STDCALL FPDF_DestroyLibrary() { #ifdef PDF_ENABLE_XFA - BC_Library_Destory(); - FXJSE_Finalize(); + CPDFXFA_App::ReleaseInstance(); #endif // PDF_ENABLE_XFA - CPDF_ModuleMgr::Destroy(); CFX_GEModule::Destroy(); @@ -378,7 +377,11 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, ProcessParseError(error); return nullptr; } - return FPDFDocumentFromCPDFDocument(pDocument.release()); +#ifdef PDF_ENABLE_XFA + return new CPDFXFA_Document(std::move(pDocument), CPDFXFA_App::GetInstance()); +#else // PDF_ENABLE_XFA + return pDocument.release(); +#endif // PDF_ENABLE_XFA } #ifdef PDF_ENABLE_XFA |