| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "../../core/include/fpdfapi/fpdf_module.h" | 7 #include "../../core/include/fpdfapi/fpdf_module.h" |
| 8 #include "../../core/include/fxcodec/fx_codec.h" | 8 #include "../../core/include/fxcodec/fx_codec.h" |
| 9 #include "../../core/include/fxcrt/fx_safe_types.h" | 9 #include "../../core/include/fxcrt/fx_safe_types.h" |
| 10 #include "../../public/fpdf_ext.h" | 10 #include "../../public/fpdf_ext.h" |
| 11 #include "../../public/fpdf_formfill.h" | 11 #include "../../public/fpdf_formfill.h" |
| 12 #include "../../public/fpdf_progressive.h" | 12 #include "../../public/fpdf_progressive.h" |
| 13 #include "../../public/fpdfview.h" | 13 #include "../../public/fpdfview.h" |
| 14 #include "../../third_party/base/nonstd_unique_ptr.h" | 14 #include "../../third_party/base/nonstd_unique_ptr.h" |
| 15 #include "../../third_party/base/numerics/safe_conversions_impl.h" | 15 #include "../../third_party/base/numerics/safe_conversions_impl.h" |
| 16 #include "../include/fsdk_define.h" | 16 #include "../include/fsdk_define.h" |
| 17 #include "../include/fsdk_mgr.h" | 17 #include "../include/fsdk_mgr.h" |
| 18 #include "../include/fsdk_rendercontext.h" | 18 #include "../include/fsdk_rendercontext.h" |
| 19 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 19 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
| 20 #include "../include/fpdfxfa/fpdfxfa_app.h" | 20 #include "../include/fpdfxfa/fpdfxfa_app.h" |
| 21 #include "../include/fpdfxfa/fpdfxfa_page.h" | 21 #include "../include/fpdfxfa/fpdfxfa_page.h" |
| 22 #include "../include/fpdfxfa/fpdfxfa_util.h" | 22 #include "../include/fpdfxfa/fpdfxfa_util.h" |
| 23 #include "../include/jsapi/fxjs_v8.h" |
| 23 | 24 |
| 24 CFPDF_FileStream::CFPDF_FileStream(FPDF_FILEHANDLER* pFS) { | 25 CFPDF_FileStream::CFPDF_FileStream(FPDF_FILEHANDLER* pFS) { |
| 25 m_pFS = pFS; | 26 m_pFS = pFS; |
| 26 m_nCurPos = 0; | 27 m_nCurPos = 0; |
| 27 } | 28 } |
| 28 | 29 |
| 29 IFX_FileStream* CFPDF_FileStream::Retain() { | 30 IFX_FileStream* CFPDF_FileStream::Retain() { |
| 30 return this; | 31 return this; |
| 31 } | 32 } |
| 32 | 33 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* cfg) { | 188 FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* cfg) { |
| 188 g_pCodecModule = new CCodec_ModuleMgr(); | 189 g_pCodecModule = new CCodec_ModuleMgr(); |
| 189 | 190 |
| 190 CFX_GEModule::Create(cfg ? cfg->m_pUserFontPaths : nullptr); | 191 CFX_GEModule::Create(cfg ? cfg->m_pUserFontPaths : nullptr); |
| 191 CFX_GEModule::Get()->SetCodecModule(g_pCodecModule); | 192 CFX_GEModule::Get()->SetCodecModule(g_pCodecModule); |
| 192 | 193 |
| 193 CPDF_ModuleMgr::Create(); | 194 CPDF_ModuleMgr::Create(); |
| 194 CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule); | 195 CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule); |
| 195 CPDF_ModuleMgr::Get()->InitPageModule(); | 196 CPDF_ModuleMgr::Get()->InitPageModule(); |
| 196 CPDF_ModuleMgr::Get()->InitRenderModule(); | 197 CPDF_ModuleMgr::Get()->InitRenderModule(); |
| 197 | |
| 198 CPDFXFA_App::GetInstance()->Initialize(); | 198 CPDFXFA_App::GetInstance()->Initialize(); |
| 199 if (cfg && cfg->version >= 2) { |
| 200 FXJS_Initialize(cfg->m_v8EmbedderSlot, |
| 201 reinterpret_cast<v8::Isolate*>(cfg->m_pIsolate)); |
| 202 } |
| 199 } | 203 } |
| 200 | 204 |
| 201 DLLEXPORT void STDCALL FPDF_DestroyLibrary() { | 205 DLLEXPORT void STDCALL FPDF_DestroyLibrary() { |
| 202 CPDFXFA_App::ReleaseInstance(); | 206 CPDFXFA_App::ReleaseInstance(); |
| 203 CPDF_ModuleMgr::Destroy(); | 207 CPDF_ModuleMgr::Destroy(); |
| 204 CFX_GEModule::Destroy(); | 208 CFX_GEModule::Destroy(); |
| 205 | 209 |
| 206 delete g_pCodecModule; | 210 delete g_pCodecModule; |
| 207 g_pCodecModule = nullptr; | 211 g_pCodecModule = nullptr; |
| 208 } | 212 } |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 if (!buffer) { | 1086 if (!buffer) { |
| 1083 *buflen = len; | 1087 *buflen = len; |
| 1084 } else if (*buflen >= len) { | 1088 } else if (*buflen >= len) { |
| 1085 memcpy(buffer, utf16Name.c_str(), len); | 1089 memcpy(buffer, utf16Name.c_str(), len); |
| 1086 *buflen = len; | 1090 *buflen = len; |
| 1087 } else { | 1091 } else { |
| 1088 *buflen = -1; | 1092 *buflen = -1; |
| 1089 } | 1093 } |
| 1090 return (FPDF_DEST)pDestObj; | 1094 return (FPDF_DEST)pDestObj; |
| 1091 } | 1095 } |
| OLD | NEW |