summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cpdfsdk_document.cpp3
-rw-r--r--fpdfsdk/cpdfsdk_environment.cpp7
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp3
-rw-r--r--fpdfsdk/formfiller/cffl_listbox.cpp3
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.cpp3
-rw-r--r--fpdfsdk/fpdf_dataavail.cpp5
-rw-r--r--fpdfsdk/fpdf_ext.cpp3
-rw-r--r--fpdfsdk/fpdf_progressive.cpp3
-rw-r--r--fpdfsdk/fpdfdoc_unittest.cpp5
-rw-r--r--fpdfsdk/fpdfeditimg.cpp3
-rw-r--r--fpdfsdk/fpdfformfill.cpp3
-rw-r--r--fpdfsdk/fpdfview.cpp27
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_app.cpp3
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_page.cpp5
-rw-r--r--fpdfsdk/fxedit/fxet_edit.cpp9
-rw-r--r--fpdfsdk/javascript/JS_Runtime_Stub.cpp3
-rw-r--r--fpdfsdk/pdfwindow/PWL_FontMap.cpp4
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.cpp3
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.cpp6
19 files changed, 61 insertions, 40 deletions
diff --git a/fpdfsdk/cpdfsdk_document.cpp b/fpdfsdk/cpdfsdk_document.cpp
index 66851c0ebb..6179ef88d4 100644
--- a/fpdfsdk/cpdfsdk_document.cpp
+++ b/fpdfsdk/cpdfsdk_document.cpp
@@ -20,6 +20,7 @@
#include "fpdfsdk/cpdfsdk_pageview.h"
#include "fpdfsdk/cpdfsdk_widget.h"
#include "fpdfsdk/fsdk_actionhandler.h"
+#include "third_party/base/ptr_util.h"
// static
CPDFSDK_Document* CPDFSDK_Document::FromFPDFFormHandle(
@@ -162,7 +163,7 @@ UnderlyingPageType* CPDFSDK_Document::GetPage(int nIndex) {
CPDFSDK_InterForm* CPDFSDK_Document::GetInterForm() {
if (!m_pInterForm)
- m_pInterForm = WrapUnique(new CPDFSDK_InterForm(this));
+ m_pInterForm = pdfium::MakeUnique<CPDFSDK_InterForm>(this);
return m_pInterForm.get();
}
diff --git a/fpdfsdk/cpdfsdk_environment.cpp b/fpdfsdk/cpdfsdk_environment.cpp
index 6ea95ad3f5..df0ba06167 100644
--- a/fpdfsdk/cpdfsdk_environment.cpp
+++ b/fpdfsdk/cpdfsdk_environment.cpp
@@ -13,6 +13,7 @@
#include "fpdfsdk/formfiller/cffl_interactiveformfiller.h"
#include "fpdfsdk/fsdk_actionhandler.h"
#include "fpdfsdk/javascript/ijs_runtime.h"
+#include "third_party/base/ptr_util.h"
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h"
@@ -201,19 +202,19 @@ IJS_Runtime* CPDFSDK_Environment::GetJSRuntime() {
CPDFSDK_AnnotHandlerMgr* CPDFSDK_Environment::GetAnnotHandlerMgr() {
if (!m_pAnnotHandlerMgr)
- m_pAnnotHandlerMgr = WrapUnique(new CPDFSDK_AnnotHandlerMgr(this));
+ m_pAnnotHandlerMgr = pdfium::MakeUnique<CPDFSDK_AnnotHandlerMgr>(this);
return m_pAnnotHandlerMgr.get();
}
CPDFSDK_ActionHandler* CPDFSDK_Environment::GetActionHander() {
if (!m_pActionHandler)
- m_pActionHandler = WrapUnique(new CPDFSDK_ActionHandler());
+ m_pActionHandler = pdfium::MakeUnique<CPDFSDK_ActionHandler>();
return m_pActionHandler.get();
}
CFFL_InteractiveFormFiller* CPDFSDK_Environment::GetInteractiveFormFiller() {
if (!m_pFormFiller)
- m_pFormFiller = WrapUnique(new CFFL_InteractiveFormFiller(this));
+ m_pFormFiller = pdfium::MakeUnique<CFFL_InteractiveFormFiller>(this);
return m_pFormFiller.get();
}
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 2e7e6c0ad6..f877d25da5 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -18,6 +18,7 @@
#include "fpdfsdk/cpdfsdk_annotiterator.h"
#include "fpdfsdk/cpdfsdk_environment.h"
#include "fpdfsdk/cpdfsdk_interform.h"
+#include "third_party/base/ptr_util.h"
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/fpdfxfa/fpdfxfa_page.h"
@@ -495,7 +496,7 @@ void CPDFSDK_PageView::LoadFXAnnots() {
bool bUpdateAP = CPDF_InterForm::IsUpdateAPEnabled();
// Disable the default AP construction.
CPDF_InterForm::SetUpdateAP(false);
- m_pAnnotList = WrapUnique(new CPDF_AnnotList(pPage));
+ m_pAnnotList = pdfium::MakeUnique<CPDF_AnnotList>(pPage);
CPDF_InterForm::SetUpdateAP(bUpdateAP);
const size_t nCount = m_pAnnotList->Count();
diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp
index 664c02dc36..ab437d401e 100644
--- a/fpdfsdk/formfiller/cffl_listbox.cpp
+++ b/fpdfsdk/formfiller/cffl_listbox.cpp
@@ -13,6 +13,7 @@
#include "fpdfsdk/formfiller/cffl_interactiveformfiller.h"
#include "fpdfsdk/fsdk_common.h"
#include "fpdfsdk/pdfwindow/PWL_ListBox.h"
+#include "third_party/base/ptr_util.h"
#define FFL_DEFAULTLISTBOXFONTSIZE 12.0f
@@ -37,7 +38,7 @@ PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() {
if (!m_pFontMap) {
m_pFontMap =
- WrapUnique(new CBA_FontMap(m_pWidget, m_pEnv->GetSysHandler()));
+ pdfium::MakeUnique<CBA_FontMap>(m_pWidget, m_pEnv->GetSysHandler());
}
cp.pFontMap = m_pFontMap.get();
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 7e2cce1d99..ffb3785c36 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -10,6 +10,7 @@
#include "fpdfsdk/cpdfsdk_widget.h"
#include "fpdfsdk/formfiller/cba_fontmap.h"
#include "fpdfsdk/fsdk_common.h"
+#include "third_party/base/ptr_util.h"
CFFL_TextField::CFFL_TextField(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pAnnot)
: CFFL_FormFiller(pApp, pAnnot) {}
@@ -72,7 +73,7 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() {
if (!m_pFontMap) {
m_pFontMap =
- WrapUnique(new CBA_FontMap(m_pWidget, m_pEnv->GetSysHandler()));
+ pdfium::MakeUnique<CBA_FontMap>(m_pWidget, m_pEnv->GetSysHandler());
}
cp.pFontMap = m_pFontMap.get();
cp.pFocusHandler = this;
diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp
index cc8376ed2c..f38f38eaa9 100644
--- a/fpdfsdk/fpdf_dataavail.cpp
+++ b/fpdfsdk/fpdf_dataavail.cpp
@@ -13,6 +13,7 @@
#include "core/fpdfapi/fpdf_parser/cpdf_document.h"
#include "fpdfsdk/fsdk_define.h"
#include "public/fpdf_formfill.h"
+#include "third_party/base/ptr_util.h"
// These checks are here because core/ and public/ cannot depend on each other.
static_assert(CPDF_DataAvail::DataError == PDF_DATA_ERROR,
@@ -115,8 +116,8 @@ DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail,
CFPDF_DataAvail* pAvail = new CFPDF_DataAvail;
pAvail->m_FileAvail.Set(file_avail);
pAvail->m_FileRead.Set(file);
- pAvail->m_pDataAvail = WrapUnique(
- new CPDF_DataAvail(&pAvail->m_FileAvail, &pAvail->m_FileRead, TRUE));
+ pAvail->m_pDataAvail = pdfium::MakeUnique<CPDF_DataAvail>(
+ &pAvail->m_FileAvail, &pAvail->m_FileRead, TRUE);
return pAvail;
}
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index d9889ef150..66247545d9 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -18,6 +18,7 @@
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/fx_xml.h"
#include "fpdfsdk/fsdk_define.h"
+#include "third_party/base/ptr_util.h"
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h"
@@ -41,7 +42,7 @@ FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) {
return FALSE;
CPDF_ModuleMgr::Get()->SetUnsupportInfoAdapter(
- WrapUnique(new CFSDK_UnsupportInfo_Adapter(unsp_info)));
+ pdfium::MakeUnique<CFSDK_UnsupportInfo_Adapter>(unsp_info));
return TRUE;
}
diff --git a/fpdfsdk/fpdf_progressive.cpp b/fpdfsdk/fpdf_progressive.cpp
index 5a51a322bb..8c08b8f310 100644
--- a/fpdfsdk/fpdf_progressive.cpp
+++ b/fpdfsdk/fpdf_progressive.cpp
@@ -15,6 +15,7 @@
#include "fpdfsdk/fsdk_define.h"
#include "fpdfsdk/fsdk_pauseadapter.h"
#include "public/fpdfview.h"
+#include "third_party/base/ptr_util.h"
// These checks are here because core/ and public/ cannot depend on each other.
static_assert(CPDF_ProgressiveRenderer::Ready == FPDF_RENDER_READER,
@@ -44,7 +45,7 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
return FPDF_RENDER_FAILED;
CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext;
- pPage->SetRenderContext(WrapUnique(pContext));
+ pPage->SetRenderContext(pdfium::WrapUnique(pContext));
CFX_FxgeDevice* pDevice = new CFX_FxgeDevice;
pContext->m_pDevice.reset(pDevice);
CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap);
diff --git a/fpdfsdk/fpdfdoc_unittest.cpp b/fpdfsdk/fpdfdoc_unittest.cpp
index 70d136b890..e559f60125 100644
--- a/fpdfsdk/fpdfdoc_unittest.cpp
+++ b/fpdfsdk/fpdfdoc_unittest.cpp
@@ -16,6 +16,7 @@
#include "core/fpdfapi/fpdf_parser/cpdf_string.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/test_support.h"
+#include "third_party/base/ptr_util.h"
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h"
@@ -34,7 +35,7 @@ class CPDF_TestDocument : public CPDF_Document {
class CPDF_TestXFADocument : public CPDFXFA_Document {
public:
CPDF_TestXFADocument()
- : CPDFXFA_Document(WrapUnique(new CPDF_TestDocument()),
+ : CPDFXFA_Document(pdfium::MakeUnique<CPDF_TestDocument>(),
CPDFXFA_App::GetInstance()) {}
void SetRoot(CPDF_Dictionary* root) {
@@ -61,7 +62,7 @@ class PDFDocTest : public testing::Test {
CPDF_ModuleMgr* module_mgr = CPDF_ModuleMgr::Get();
module_mgr->InitPageModule();
- m_pDoc = WrapUnique(new CPDF_TestPdfDocument());
+ m_pDoc = pdfium::MakeUnique<CPDF_TestPdfDocument>();
m_pIndirectObjs = m_pDoc->GetHolder();
// Setup the root directory.
m_pRootObj.reset(new CPDF_Dictionary());
diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp
index 64908408a9..cd4d5525f4 100644
--- a/fpdfsdk/fpdfeditimg.cpp
+++ b/fpdfsdk/fpdfeditimg.cpp
@@ -11,6 +11,7 @@
#include "core/fpdfapi/fpdf_page/cpdf_imageobject.h"
#include "core/fpdfapi/fpdf_page/cpdf_pageobject.h"
#include "fpdfsdk/fsdk_define.h"
+#include "third_party/base/ptr_util.h"
DLLEXPORT FPDF_PAGEOBJECT STDCALL
FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document) {
@@ -19,7 +20,7 @@ FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document) {
return nullptr;
CPDF_ImageObject* pImageObj = new CPDF_ImageObject;
- pImageObj->SetOwnedImage(WrapUnique(new CPDF_Image(pDoc)));
+ pImageObj->SetOwnedImage(pdfium::MakeUnique<CPDF_Image>(pDoc));
return pImageObj;
}
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 8839a61afd..a9a83b3541 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -24,6 +24,7 @@
#include "fpdfsdk/fsdk_actionhandler.h"
#include "fpdfsdk/fsdk_define.h"
#include "public/fpdfview.h"
+#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#ifdef PDF_ENABLE_XFA
@@ -254,7 +255,7 @@ FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document,
#ifdef PDF_ENABLE_XFA
// Ownership of the SDKDocument is passed to the CPDFXFA_Document.
- pDocument->SetSDKDoc(WrapUnique(pEnv->GetSDKDocument()));
+ pDocument->SetSDKDoc(pdfium::WrapUnique(pEnv->GetSDKDocument()));
CPDFXFA_App::GetInstance()->AddFormFillEnv(pEnv);
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index e48c2e9eb1..552ec2a8c7 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -33,6 +33,7 @@
#include "public/fpdf_ext.h"
#include "public/fpdf_progressive.h"
#include "third_party/base/numerics/safe_conversions_impl.h"
+#include "third_party/base/ptr_util.h"
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h"
@@ -69,7 +70,7 @@ CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc) {
FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc) {
#ifdef PDF_ENABLE_XFA
return doc ? FPDFDocumentFromUnderlying(new CPDFXFA_Document(
- WrapUnique(doc), CPDFXFA_App::GetInstance()))
+ pdfium::WrapUnique(doc), CPDFXFA_App::GetInstance()))
: nullptr;
#else // PDF_ENABLE_XFA
return FPDFDocumentFromUnderlying(doc);
@@ -574,20 +575,20 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
return;
CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext;
- pPage->SetRenderContext(WrapUnique(pContext));
+ pPage->SetRenderContext(pdfium::WrapUnique(pContext));
std::unique_ptr<CFX_DIBitmap> pBitmap;
const bool bNewBitmap =
pPage->BackgroundAlphaNeeded() || pPage->HasImageMask();
if (bNewBitmap) {
- pBitmap = WrapUnique(new CFX_DIBitmap);
+ pBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
pBitmap->Create(size_x, size_y, FXDIB_Argb);
pBitmap->Clear(0x00ffffff);
CFX_FxgeDevice* pDevice = new CFX_FxgeDevice;
- pContext->m_pDevice = WrapUnique(pDevice);
+ pContext->m_pDevice = pdfium::WrapUnique(pDevice);
pDevice->Attach(pBitmap.get(), false, nullptr, false);
} else {
- pContext->m_pDevice = WrapUnique(new CFX_WindowsDevice(dc));
+ pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
}
FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
@@ -596,7 +597,7 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
if (bNewBitmap) {
CFX_WindowsDevice WinDC(dc);
if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) {
- std::unique_ptr<CFX_DIBitmap> pDst = WrapUnique(new CFX_DIBitmap);
+ std::unique_ptr<CFX_DIBitmap> pDst = pdfium::MakeUnique<CFX_DIBitmap>();
int pitch = pBitmap->GetPitch();
pDst->Create(size_x, size_y, FXDIB_Rgb32);
FXSYS_memset(pDst->GetBuffer(), -1, pitch * size_y);
@@ -628,7 +629,7 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
return;
CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext;
- pPage->SetRenderContext(WrapUnique(pContext));
+ pPage->SetRenderContext(pdfium::WrapUnique(pContext));
CFX_FxgeDevice* pDevice = new CFX_FxgeDevice;
pContext->m_pDevice.reset(pDevice);
CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap);
@@ -649,7 +650,7 @@ DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page,
return nullptr;
CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext;
- pPage->SetRenderContext(WrapUnique(pContext));
+ pPage->SetRenderContext(pdfium::WrapUnique(pContext));
CFX_FxgeDevice* skDevice = new CFX_FxgeDevice;
FPDF_RECORDER recorder = skDevice->CreateRecorder(size_x, size_y);
pContext->m_pDevice.reset(skDevice);
@@ -850,7 +851,7 @@ void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext,
return;
if (!pContext->m_pOptions)
- pContext->m_pOptions = WrapUnique(new CPDF_RenderOptions);
+ pContext->m_pOptions = pdfium::MakeUnique<CPDF_RenderOptions>();
if (flags & FPDF_LCD_TEXT)
pContext->m_pOptions->m_Flags |= RENDER_CLEARTYPE;
@@ -889,19 +890,19 @@ void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext,
pContext->m_pDevice->SetClip_Rect(
FX_RECT(start_x, start_y, start_x + size_x, start_y + size_y));
- pContext->m_pContext = WrapUnique(new CPDF_RenderContext(pPage));
+ pContext->m_pContext = pdfium::MakeUnique<CPDF_RenderContext>(pPage);
pContext->m_pContext->AppendLayer(pPage, &matrix);
if (flags & FPDF_ANNOT) {
- pContext->m_pAnnots = WrapUnique(new CPDF_AnnotList(pPage));
+ pContext->m_pAnnots = pdfium::MakeUnique<CPDF_AnnotList>(pPage);
FX_BOOL bPrinting = pContext->m_pDevice->GetDeviceClass() != FXDC_DISPLAY;
pContext->m_pAnnots->DisplayAnnots(pPage, pContext->m_pContext.get(),
bPrinting, &matrix, FALSE, nullptr);
}
- pContext->m_pRenderer = WrapUnique(new CPDF_ProgressiveRenderer(
+ pContext->m_pRenderer = pdfium::MakeUnique<CPDF_ProgressiveRenderer>(
pContext->m_pContext.get(), pContext->m_pDevice.get(),
- pContext->m_pOptions.get()));
+ pContext->m_pOptions.get());
pContext->m_pRenderer->Start(pause);
if (bNeedToRestore)
pContext->m_pDevice->RestoreState(false);
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
index 88c31ef006..4edfcf0676 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
@@ -11,6 +11,7 @@
#include "fpdfsdk/cpdfsdk_environment.h"
#include "fpdfsdk/fpdfxfa/fpdfxfa_util.h"
#include "fpdfsdk/fsdk_define.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fxbarcode/BC_Library.h"
#include "xfa/fxfa/xfa_ffapp.h"
#include "xfa/fxfa/xfa_fontmgr.h"
@@ -56,7 +57,7 @@ FX_BOOL CPDFXFA_App::Initialize(v8::Isolate* pIsolate) {
if (!m_pIsolate)
return FALSE;
- m_pXFAApp = WrapUnique(new CXFA_FFApp(this));
+ m_pXFAApp = pdfium::MakeUnique<CXFA_FFApp>(this);
m_pXFAApp->SetDefaultFontMgr(
std::unique_ptr<CXFA_DefFontMgr>(new CXFA_DefFontMgr));
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp
index fdbd2d08e4..b3bc20bad8 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp
@@ -12,6 +12,7 @@
#include "fpdfsdk/fpdfxfa/fpdfxfa_util.h"
#include "fpdfsdk/fsdk_define.h"
#include "public/fpdf_formfill.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/xfa_ffdocview.h"
#include "xfa/fxfa/xfa_ffpageview.h"
@@ -39,7 +40,7 @@ FX_BOOL CPDFXFA_Page::LoadPDFPage() {
return FALSE;
if (!m_pPDFPage || m_pPDFPage->m_pFormDict != pDict) {
- m_pPDFPage = WrapUnique(new CPDF_Page(pPDFDoc, pDict, true));
+ m_pPDFPage = pdfium::MakeUnique<CPDF_Page>(pPDFDoc, pDict, true);
m_pPDFPage->ParseContent();
}
return TRUE;
@@ -88,7 +89,7 @@ FX_BOOL CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) {
return FALSE;
m_pPDFPage =
- WrapUnique(new CPDF_Page(m_pDocument->GetPDFDoc(), pageDict, true));
+ pdfium::MakeUnique<CPDF_Page>(m_pDocument->GetPDFDoc(), pageDict, true);
m_pPDFPage->ParseContent();
return TRUE;
}
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index ef3f7415bd..9f733acd70 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -28,6 +28,7 @@
#include "fpdfsdk/fxedit/fx_edit.h"
#include "fpdfsdk/pdfwindow/PWL_Edit.h"
#include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
+#include "third_party/base/ptr_util.h"
namespace {
@@ -1026,7 +1027,7 @@ void CFX_Edit::Initialize() {
}
void CFX_Edit::SetFontMap(IPVT_FontMap* pFontMap) {
- m_pVTProvider = WrapUnique(new CFX_Edit_Provider(pFontMap));
+ m_pVTProvider = pdfium::MakeUnique<CFX_Edit_Provider>(pFontMap);
m_pVT->SetProvider(m_pVTProvider.get());
}
@@ -1039,8 +1040,10 @@ void CFX_Edit::SetOprNotify(CPWL_Edit* pOprNotify) {
}
CFX_Edit_Iterator* CFX_Edit::GetIterator() {
- if (!m_pIterator)
- m_pIterator = WrapUnique(new CFX_Edit_Iterator(this, m_pVT->GetIterator()));
+ if (!m_pIterator) {
+ m_pIterator =
+ pdfium::MakeUnique<CFX_Edit_Iterator>(this, m_pVT->GetIterator());
+ }
return m_pIterator.get();
}
diff --git a/fpdfsdk/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
index 3b316aaf69..8d8ac33474 100644
--- a/fpdfsdk/javascript/JS_Runtime_Stub.cpp
+++ b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
@@ -8,6 +8,7 @@
#include "fpdfsdk/javascript/ijs_context.h"
#include "fpdfsdk/javascript/ijs_runtime.h"
+#include "third_party/base/ptr_util.h"
class CJS_ContextStub final : public IJS_Context {
public:
@@ -124,7 +125,7 @@ class CJS_RuntimeStub final : public IJS_Runtime {
IJS_Context* NewContext() override {
if (!m_pContext)
- m_pContext = WrapUnique(new CJS_ContextStub());
+ m_pContext = pdfium::MakeUnique<CJS_ContextStub>();
return GetCurrentContext();
}
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
index 57feb27dcd..440efe5a06 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
@@ -13,6 +13,7 @@
#include "core/fpdfapi/fpdf_parser/cpdf_parser.h"
#include "core/fpdfdoc/ipvt_fontmap.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+#include "third_party/base/ptr_util.h"
namespace {
@@ -47,7 +48,8 @@ CPWL_FontMap::~CPWL_FontMap() {
CPDF_Document* CPWL_FontMap::GetDocument() {
if (!m_pPDFDoc) {
if (CPDF_ModuleMgr::Get()) {
- m_pPDFDoc = WrapUnique(new CPDF_Document(std::unique_ptr<CPDF_Parser>()));
+ m_pPDFDoc =
+ pdfium::MakeUnique<CPDF_Document>(std::unique_ptr<CPDF_Parser>());
m_pPDFDoc->CreateNewDoc();
}
}
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index 1af2682570..8739c3b515 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -14,6 +14,7 @@
#include "fpdfsdk/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
#include "public/fpdf_fwlevent.h"
+#include "third_party/base/ptr_util.h"
CPWL_List_Notify::CPWL_List_Notify(CPWL_ListBox* pList) : m_pList(pList) {
ASSERT(m_pList);
@@ -76,7 +77,7 @@ CFX_ByteString CPWL_ListBox::GetClassName() const {
void CPWL_ListBox::OnCreated() {
m_pList->SetFontMap(GetFontMap());
- m_pListNotify = WrapUnique(new CPWL_List_Notify(this));
+ m_pListNotify = pdfium::MakeUnique<CPWL_List_Notify>(this);
m_pList->SetNotify(m_pListNotify.get());
SetHoverSel(HasFlag(PLBS_HOVERSEL));
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
index 207157db7e..729b27ca5d 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
@@ -9,6 +9,7 @@
#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
#include "fpdfsdk/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+#include "third_party/base/ptr_util.h"
static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() {
// Leak the object at shutdown.
@@ -86,10 +87,9 @@ CPWL_TimerHandler::~CPWL_TimerHandler() {}
void CPWL_TimerHandler::BeginTimer(int32_t nElapse) {
if (!m_pTimer)
- m_pTimer = WrapUnique(new CPWL_Timer(this, GetSystemHandler()));
+ m_pTimer = pdfium::MakeUnique<CPWL_Timer>(this, GetSystemHandler());
- if (m_pTimer)
- m_pTimer->SetPWLTimer(nElapse);
+ m_pTimer->SetPWLTimer(nElapse);
}
void CPWL_TimerHandler::EndTimer() {