Bug 1382509 - Part2. Remove the code from PDFiumEngineShim that allows for linking PDFium.dll r=jwatt draft
authorFarmer Tseng <fatseng@mozilla.com>
Sun, 20 Aug 2017 22:45:17 +0800
changeset 649695 8f0fc1be93fec1a61b732682fbc8449117042ca6
parent 649694 c16704fce19bf4700f9a12f5251c292d8b03db39
child 649696 86f98a8f53bb4d4c17947646c24b207424475b81
child 649702 865eddd37a2b00692cda0fca3b5fbde45f37bb76
child 650296 b7d04486f58dbd964f878efc5ec9ccc07bfd0f5c
push id75104
push userbmo:fatseng@mozilla.com
push dateMon, 21 Aug 2017 06:23:04 +0000
reviewersjwatt
bugs1382509
milestone57.0a1
Bug 1382509 - Part2. Remove the code from PDFiumEngineShim that allows for linking PDFium.dll r=jwatt MozReview-Commit-ID: IAdCznwCWBf
widget/windows/PDFiumEngineShim.cpp
widget/windows/PDFiumEngineShim.h
--- 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