Bug 1382509 - Part2. Remove the code from PDFiumEngineShim that allows for linking PDFium.dll r=jwatt
MozReview-Commit-ID: IAdCznwCWBf
--- a/widget/windows/PDFiumEngineShim.cpp
+++ b/widget/windows/PDFiumEngineShim.cpp
@@ -30,52 +30,42 @@ PDFiumEngineShim::GetInstanceOrNull()
PDFiumEngineShim::PDFiumEngineShim()
: mFPDF_InitLibrary(nullptr)
, mFPDF_DestroyLibrary(nullptr)
, mFPDF_CloseDocument(nullptr)
, mFPDF_GetPageCount(nullptr)
, mFPDF_LoadPage(nullptr)
, mFPDF_ClosePage(nullptr)
, mFPDF_RenderPage(nullptr)
-#ifdef USE_EXTERNAL_PDFIUM
, mPRLibrary(nullptr)
-#endif
, mInitialized(false)
{
}
PDFiumEngineShim::~PDFiumEngineShim()
{
if (mInitialized) {
mFPDF_DestroyLibrary();
}
sPDFiumEngineShim = nullptr;
-#ifdef USE_EXTERNAL_PDFIUM
if (mPRLibrary) {
PR_UnloadLibrary(mPRLibrary);
}
-#endif
}
bool
PDFiumEngineShim::Init()
{
if (mInitialized) {
return true;
}
-#ifdef USE_EXTERNAL_PDFIUM
- nsAutoString PDFiumPath;
- mozilla::Preferences::GetString("print.load_external_pdfium", PDFiumPath);
- NS_ENSURE_FALSE(PDFiumPath.IsEmpty(), false);
-
- nsAutoCString filePath = NS_ConvertUTF16toUTF8(PDFiumPath);
- mPRLibrary = PR_LoadLibrary(filePath.get());
+ mPRLibrary = PR_LoadLibrary("pdfium.dll");
NS_ENSURE_TRUE(mPRLibrary, false);
mFPDF_InitLibrary = (FPDF_InitLibrary_Pfn)PR_FindFunctionSymbol(
mPRLibrary, "FPDF_InitLibrary");
NS_ENSURE_TRUE(mFPDF_InitLibrary, false);
mFPDF_DestroyLibrary = (FPDF_DestroyLibrary_Pfn)PR_FindFunctionSymbol(
mPRLibrary, "FPDF_DestroyLibrary");
@@ -100,27 +90,16 @@ PDFiumEngineShim::Init()
mFPDF_ClosePage = (FPDF_ClosePage_Pfn)PR_FindFunctionSymbol(
mPRLibrary, "FPDF_ClosePage");
NS_ENSURE_TRUE(mFPDF_ClosePage, false);
mFPDF_RenderPage = (FPDF_RenderPage_Pfn)PR_FindFunctionSymbol(
mPRLibrary, "FPDF_RenderPage");
NS_ENSURE_TRUE(mFPDF_RenderPage, false);
-#else
- mFPDF_InitLibrary = (FPDF_InitLibrary_Pfn) FPDF_InitLibrary;
- mFPDF_DestroyLibrary = (FPDF_DestroyLibrary_Pfn) FPDF_DestroyLibrary;
- mFPDF_LoadDocument = (FPDF_LoadDocument_Pfn) FPDF_LoadDocument;
- mFPDF_CloseDocument = (FPDF_CloseDocument_Pfn) FPDF_CloseDocument;
- mFPDF_GetPageCount = (FPDF_GetPageCount_Pfn) FPDF_GetPageCount;
- mFPDF_LoadPage = (FPDF_LoadPage_Pfn) FPDF_LoadPage;
- mFPDF_ClosePage = (FPDF_ClosePage_Pfn) FPDF_ClosePage;
- mFPDF_RenderPage = (FPDF_RenderPage_Pfn) FPDF_RenderPage;
-#endif
-
mFPDF_InitLibrary();
mInitialized = true;
return true;
}
FPDF_DOCUMENT
PDFiumEngineShim::LoadDocument(FPDF_STRING file_path,
FPDF_BYTESTRING aPassword)
--- a/widget/windows/PDFiumEngineShim.h
+++ b/widget/windows/PDFiumEngineShim.h
@@ -4,18 +4,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PDFIUMENGINESHIM_H
#define PDFIUMENGINESHIM_H
#include "prlink.h"
#include "fpdfview.h"
-//#define USE_EXTERNAL_PDFIUM
-
/* include windows.h for the HDC definitions that we need. */
#include <windows.h>
namespace mozilla {
namespace widget {
typedef void (STDCALL *FPDF_InitLibrary_Pfn)();
typedef void (STDCALL *FPDF_DestroyLibrary_Pfn)();
@@ -78,17 +76,15 @@ private:
FPDF_DestroyLibrary_Pfn mFPDF_DestroyLibrary;
FPDF_LoadDocument_Pfn mFPDF_LoadDocument;
FPDF_CloseDocument_Pfn mFPDF_CloseDocument;
FPDF_GetPageCount_Pfn mFPDF_GetPageCount;
FPDF_LoadPage_Pfn mFPDF_LoadPage;
FPDF_ClosePage_Pfn mFPDF_ClosePage;
FPDF_RenderPage_Pfn mFPDF_RenderPage;
-#ifdef USE_EXTERNAL_PDFIUM
PRLibrary* mPRLibrary;
-#endif
};
} // namespace widget
} // namespace mozilla
#endif /* PDFIUMENGINESHIM_H */
\ No newline at end of file