| 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/fxcodec/fx_codec.h" | 7 #include "../../core/include/fxcodec/fx_codec.h" |
| 8 #include "../../core/include/fxcrt/fx_safe_types.h" | 8 #include "../../core/include/fxcrt/fx_safe_types.h" |
| 9 #include "../../public/fpdf_ext.h" | 9 #include "../../public/fpdf_ext.h" |
| 10 #include "../../public/fpdf_progressive.h" | 10 #include "../../public/fpdf_progressive.h" |
| 11 #include "../../public/fpdfview.h" | 11 #include "../../public/fpdfview.h" |
| 12 #include "../../third_party/base/nonstd_unique_ptr.h" | 12 #include "../../third_party/base/nonstd_unique_ptr.h" |
| 13 #include "../../third_party/base/numerics/safe_conversions_impl.h" | 13 #include "../../third_party/base/numerics/safe_conversions_impl.h" |
| 14 #include "../include/fsdk_define.h" | 14 #include "../include/fsdk_define.h" |
| 15 #include "../include/fsdk_mgr.h" | 15 #include "../include/fsdk_mgr.h" |
| 16 #include "../include/fsdk_rendercontext.h" | 16 #include "../include/fsdk_rendercontext.h" |
| 17 #include "../include/jsapi/fxjs_v8.h" | 17 #include "../include/javascript/IJavaScript.h" |
| 18 | 18 |
| 19 CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess) { | 19 CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess) { |
| 20 if (pFileAccess) | 20 if (pFileAccess) |
| 21 m_FileAccess = *pFileAccess; | 21 m_FileAccess = *pFileAccess; |
| 22 } | 22 } |
| 23 | 23 |
| 24 FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer, | 24 FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer, |
| 25 FX_FILESIZE offset, | 25 FX_FILESIZE offset, |
| 26 size_t size) { | 26 size_t size) { |
| 27 if (offset < 0) { | 27 if (offset < 0) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule); | 103 CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule); |
| 104 CPDF_ModuleMgr::Get()->InitPageModule(); | 104 CPDF_ModuleMgr::Get()->InitPageModule(); |
| 105 CPDF_ModuleMgr::Get()->InitRenderModule(); | 105 CPDF_ModuleMgr::Get()->InitRenderModule(); |
| 106 CPDF_ModuleMgr* pModuleMgr = CPDF_ModuleMgr::Get(); | 106 CPDF_ModuleMgr* pModuleMgr = CPDF_ModuleMgr::Get(); |
| 107 if (pModuleMgr) { | 107 if (pModuleMgr) { |
| 108 pModuleMgr->LoadEmbeddedGB1CMaps(); | 108 pModuleMgr->LoadEmbeddedGB1CMaps(); |
| 109 pModuleMgr->LoadEmbeddedJapan1CMaps(); | 109 pModuleMgr->LoadEmbeddedJapan1CMaps(); |
| 110 pModuleMgr->LoadEmbeddedCNS1CMaps(); | 110 pModuleMgr->LoadEmbeddedCNS1CMaps(); |
| 111 pModuleMgr->LoadEmbeddedKorea1CMaps(); | 111 pModuleMgr->LoadEmbeddedKorea1CMaps(); |
| 112 } | 112 } |
| 113 if (cfg && cfg->version >= 2) { | 113 if (cfg && cfg->version >= 2) |
| 114 FXJS_Initialize(cfg->m_v8EmbedderSlot, | 114 IJS_Runtime::Initialize(cfg->m_v8EmbedderSlot, cfg->m_pIsolate); |
| 115 reinterpret_cast<v8::Isolate*>(cfg->m_pIsolate)); | |
| 116 } | |
| 117 } | 115 } |
| 118 | 116 |
| 119 DLLEXPORT void STDCALL FPDF_DestroyLibrary() { | 117 DLLEXPORT void STDCALL FPDF_DestroyLibrary() { |
| 120 #if _FX_OS_ == _FX_LINUX_EMBEDDED_ | 118 #if _FX_OS_ == _FX_LINUX_EMBEDDED_ |
| 121 delete g_pFontMapper; | 119 delete g_pFontMapper; |
| 122 g_pFontMapper = nullptr; | 120 g_pFontMapper = nullptr; |
| 123 #endif | 121 #endif |
| 124 CPDF_ModuleMgr::Destroy(); | 122 CPDF_ModuleMgr::Destroy(); |
| 125 CFX_GEModule::Destroy(); | 123 CFX_GEModule::Destroy(); |
| 126 delete g_pCodecModule; | 124 delete g_pCodecModule; |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 if (!buffer) { | 912 if (!buffer) { |
| 915 *buflen = len; | 913 *buflen = len; |
| 916 } else if (*buflen >= len) { | 914 } else if (*buflen >= len) { |
| 917 memcpy(buffer, utf16Name.c_str(), len); | 915 memcpy(buffer, utf16Name.c_str(), len); |
| 918 *buflen = len; | 916 *buflen = len; |
| 919 } else { | 917 } else { |
| 920 *buflen = -1; | 918 *buflen = -1; |
| 921 } | 919 } |
| 922 return (FPDF_DEST)pDestObj; | 920 return (FPDF_DEST)pDestObj; |
| 923 } | 921 } |
| OLD | NEW |