11diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
2- index 499e70e36..3b943240f 100644
2+ index f747fe11c..602b6c02a 100644
33--- a/fpdfsdk/fpdf_view.cpp
44+++ b/fpdfsdk/fpdf_view.cpp
55@@ -61,6 +61,9 @@
@@ -21,13 +21,14 @@ index 499e70e36..3b943240f 100644
2121+ v8::Isolate* g_isolate = nullptr;
2222+ #endif
2323+
24- void SetRendererType(FPDF_RENDERER_TYPE public_type) {
25- // Internal definition of renderer types must stay updated with respect to
26- // the public definition, such that all public definitions can be mapped to
27- @@ -226,6 +234,22 @@ FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config) {
24+ RetainPtr<const CPDF_Object> GetXFAEntryFromDocument(const CPDF_Document* doc) {
25+ const CPDF_Dictionary* root = doc->GetRoot();
26+ if (!root) {
27+ @@ -197,6 +205,23 @@ FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config) {
28+ if (g_bLibraryInitialized) {
2829 return;
2930 }
30-
31+ +
3132+ #ifdef PDF_ENABLE_V8
3233+ g_platform = v8::platform::NewDefaultPlatform().release();
3334+ v8::V8::InitializePlatform(g_platform);
@@ -46,8 +47,8 @@ index 499e70e36..3b943240f 100644
4647+
4748 FX_InitializeMemoryAllocators();
4849 CFX_Timer::InitializeGlobals();
49- CFX_GEModule::Create(config ? config->m_pUserFontPaths : nullptr);
50- @@ -246 ,11 +270,9 @@ FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config) {
50+
51+ @@ -238 ,11 +263,10 @@ FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config) {
5152 CPDFXFA_ModuleInit();
5253 #endif // PDF_ENABLE_XFA
5354
@@ -59,10 +60,11 @@ index 499e70e36..3b943240f 100644
5960+ #if PDF_ENABLE_V8
6061+ IJS_Runtime::Initialize(0, g_isolate, g_platform);
6162+ #endif // PDF_ENABLE_V8
63+ +
64+ g_bLibraryInitialized = true;
65+ }
6266
63- if (config && config->version >= 4) {
64- SetRendererType(config->m_RendererType);
65- @@ -282,6 +304,19 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary() {
67+ @@ -263,6 +287,19 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary() {
6668 CFX_Timer::DestroyGlobals();
6769 FX_DestroyMemoryAllocators();
6870
0 commit comments