Bug 1382509 - Part2. Remove the code from PDFiumEngineShim that allows for linking PDFium.dll r=jwatt
authorFarmer Tseng <fatseng@mozilla.com>
Sun, 20 Aug 2017 22:45:17 +0800
changeset 376100 2d7a01b9ac5155e7b4889438f04e0b86adabac21
parent 376099 3360dfa8c756384ceb435a86a3400734cd61bd72
child 376101 806ba87bbf3c0fb2b1616072c1e9e53e92e03a2d
push id32375
push userkwierso@gmail.com
push dateTue, 22 Aug 2017 22:40:30 +0000
treeherdermozilla-central@80fafbaaf848 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1382509
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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