summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfview.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-27 12:25:00 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-27 12:25:00 -0700
commitbdeeb8a036442302b821686a03698b0bb98952e1 (patch)
tree2ef5fadc13ca977f4ed134d9e2074fade72282f9 /fpdfsdk/src/fpdfview.cpp
parent599851360cf036418a13ad246bf0334f46eabacb (diff)
downloadpdfium-bdeeb8a036442302b821686a03698b0bb98952e1.tar.xz
Make CPDFXFA_App / IXFA_AppProvider saner
Move interface comments from the implementation header to the interface header. Replace Create / Release functions with static methods. Replace dubious Release() methods with deletion via virtual dtor, also for IXFA_App and IXFA_FontMgr while we're at it. Untabify and fix (theoretically) illegal _CAP include guard definitions for fpdfxfa/ headers. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1153553003
Diffstat (limited to 'fpdfsdk/src/fpdfview.cpp')
-rw-r--r--fpdfsdk/src/fpdfview.cpp45
1 files changed, 17 insertions, 28 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index c5d8f32dca..52e0ccd317 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -176,36 +176,29 @@ FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy)
return FALSE;
}
-
-#ifndef _T
-#define _T(x) x
-#endif
-
CCodec_ModuleMgr* g_pCodecModule = NULL;
DLLEXPORT void STDCALL FPDF_InitLibrary()
{
- g_pCodecModule = CCodec_ModuleMgr::Create();
-
- CFX_GEModule::Create();
- CFX_GEModule::Get()->SetCodecModule(g_pCodecModule);
-
- CPDF_ModuleMgr::Create();
- CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule);
- CPDF_ModuleMgr::Get()->InitPageModule();
- CPDF_ModuleMgr::Get()->InitRenderModule();
+ g_pCodecModule = CCodec_ModuleMgr::Create();
- CPDFXFA_App* pAppProvider = FPDFXFA_GetApp();
- pAppProvider->Initialize();
-}
+ CFX_GEModule::Create();
+ CFX_GEModule::Get()->SetCodecModule(g_pCodecModule);
+
+ CPDF_ModuleMgr::Create();
+ CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule);
+ CPDF_ModuleMgr::Get()->InitPageModule();
+ CPDF_ModuleMgr::Get()->InitRenderModule();
+ CPDFXFA_App::GetInstance()->Initialize();
+}
DLLEXPORT void STDCALL FPDF_DestroyLibrary()
{
- FPDFXFA_ReleaseApp();
- CPDF_ModuleMgr::Destroy();
- CFX_GEModule::Destroy();
- g_pCodecModule->Destroy();
+ CPDFXFA_App::ReleaseInstance();
+ CPDF_ModuleMgr::Destroy();
+ CFX_GEModule::Destroy();
+ g_pCodecModule->Destroy();
}
#ifndef _WIN32
@@ -261,7 +254,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BY
if (!pPDFDoc)
return NULL;
- CPDFXFA_App* pProvider = FPDFXFA_GetApp();
+ CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance();
CPDFXFA_Document* pDocument = FX_NEW CPDFXFA_Document(pPDFDoc, pProvider);
return pDocument;
}
@@ -347,10 +340,8 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, int s
if (!pPDFDoc)
return NULL;
- CPDFXFA_App* pProvider = FPDFXFA_GetApp();
+ CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance();
CPDFXFA_Document* pDocument = FX_NEW CPDFXFA_Document(pPDFDoc, pProvider);
- //pDocument->LoadXFADoc();
-
return pDocument;
}
@@ -372,10 +363,8 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAc
if (!pPDFDoc)
return NULL;
- CPDFXFA_App* pProvider = FPDFXFA_GetApp();
+ CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance();
CPDFXFA_Document* pDocument = FX_NEW CPDFXFA_Document(pPDFDoc, pProvider);
- //pDocument->LoadXFADoc();
-
return pDocument;
}