diff options
author | thestig <thestig@chromium.org> | 2016-09-28 17:04:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-28 17:04:51 -0700 |
commit | d4c34f208aa3b76c5941395823c6dcf6bb7e2f34 (patch) | |
tree | b0d73710639ddfe2fff5578e7cd6b761cd4052ed /fpdfsdk | |
parent | 5ef75ba52b1ce6024d6aa43b03e25824a04b469b (diff) | |
download | pdfium-d4c34f208aa3b76c5941395823c6dcf6bb7e2f34.tar.xz |
Replace std::unique_ptr.reset() with WrapUnique assignment.
fpdfsdk/ edition.
Review-Url: https://codereview.chromium.org/2381723002
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/cpdfsdk_document.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_environment.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_pageview.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_listbox.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_textfield.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/fpdf_dataavail.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/fpdfdoc_unittest.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/fpdfview.cpp | 9 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/fpdfxfa_app.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/fpdfxfa_page.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/javascript/JS_Runtime_Stub.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_FontMap.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ListBox.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Wnd.cpp | 2 |
15 files changed, 39 insertions, 25 deletions
diff --git a/fpdfsdk/cpdfsdk_document.cpp b/fpdfsdk/cpdfsdk_document.cpp index 01e4d88ac1..3912e06964 100644 --- a/fpdfsdk/cpdfsdk_document.cpp +++ b/fpdfsdk/cpdfsdk_document.cpp @@ -158,7 +158,7 @@ UnderlyingPageType* CPDFSDK_Document::GetPage(int nIndex) { CPDFSDK_InterForm* CPDFSDK_Document::GetInterForm() { if (!m_pInterForm) - m_pInterForm.reset(new CPDFSDK_InterForm(this)); + m_pInterForm = WrapUnique(new CPDFSDK_InterForm(this)); return m_pInterForm.get(); } diff --git a/fpdfsdk/cpdfsdk_environment.cpp b/fpdfsdk/cpdfsdk_environment.cpp index b17b782367..0f621eb887 100644 --- a/fpdfsdk/cpdfsdk_environment.cpp +++ b/fpdfsdk/cpdfsdk_environment.cpp @@ -6,6 +6,8 @@ #include "fpdfsdk/include/cpdfsdk_environment.h" +#include <memory> + #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" #include "fpdfsdk/include/cpdfsdk_annothandlermgr.h" #include "fpdfsdk/include/cpdfsdk_document.h" @@ -199,19 +201,19 @@ IJS_Runtime* CPDFSDK_Environment::GetJSRuntime() { CPDFSDK_AnnotHandlerMgr* CPDFSDK_Environment::GetAnnotHandlerMgr() { if (!m_pAnnotHandlerMgr) - m_pAnnotHandlerMgr.reset(new CPDFSDK_AnnotHandlerMgr(this)); + m_pAnnotHandlerMgr = WrapUnique(new CPDFSDK_AnnotHandlerMgr(this)); return m_pAnnotHandlerMgr.get(); } CPDFSDK_ActionHandler* CPDFSDK_Environment::GetActionHander() { if (!m_pActionHandler) - m_pActionHandler.reset(new CPDFSDK_ActionHandler()); + m_pActionHandler = WrapUnique(new CPDFSDK_ActionHandler()); return m_pActionHandler.get(); } CFFL_InteractiveFormFiller* CPDFSDK_Environment::GetInteractiveFormFiller() { if (!m_pFormFiller) - m_pFormFiller.reset(new CFFL_InteractiveFormFiller(this)); + m_pFormFiller = WrapUnique(new CFFL_InteractiveFormFiller(this)); return m_pFormFiller.get(); } diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index f546e385e6..db322101c2 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -494,7 +494,7 @@ void CPDFSDK_PageView::LoadFXAnnots() { bool bUpdateAP = CPDF_InterForm::IsUpdateAPEnabled(); // Disable the default AP construction. CPDF_InterForm::SetUpdateAP(false); - m_pAnnotList.reset(new CPDF_AnnotList(pPage)); + m_pAnnotList = WrapUnique(new 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 7a6976e440..50d04a869a 100644 --- a/fpdfsdk/formfiller/cffl_listbox.cpp +++ b/fpdfsdk/formfiller/cffl_listbox.cpp @@ -35,8 +35,10 @@ PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() { if (cp.dwFlags & PWS_AUTOFONTSIZE) cp.fFontSize = FFL_DEFAULTLISTBOXFONTSIZE; - if (!m_pFontMap) - m_pFontMap.reset(new CBA_FontMap(m_pWidget, m_pEnv->GetSysHandler())); + if (!m_pFontMap) { + m_pFontMap = + WrapUnique(new CBA_FontMap(m_pWidget, m_pEnv->GetSysHandler())); + } cp.pFontMap = m_pFontMap.get(); return cp; diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index 611da7438a..242179e6f9 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp @@ -70,8 +70,10 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { break; } - if (!m_pFontMap) - m_pFontMap.reset(new CBA_FontMap(m_pWidget, m_pEnv->GetSysHandler())); + if (!m_pFontMap) { + m_pFontMap = + WrapUnique(new 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 1a83fdf64b..f208a776c4 100644 --- a/fpdfsdk/fpdf_dataavail.cpp +++ b/fpdfsdk/fpdf_dataavail.cpp @@ -6,6 +6,9 @@ #include "public/fpdf_dataavail.h" +#include <memory> +#include <utility> + #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "fpdfsdk/include/fsdk_define.h" @@ -112,7 +115,7 @@ 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.reset( + pAvail->m_pDataAvail = WrapUnique( new CPDF_DataAvail(&pAvail->m_FileAvail, &pAvail->m_FileRead, TRUE)); return pAvail; } diff --git a/fpdfsdk/fpdfdoc_unittest.cpp b/fpdfsdk/fpdfdoc_unittest.cpp index 7b185cc48f..7c757e40c5 100644 --- a/fpdfsdk/fpdfdoc_unittest.cpp +++ b/fpdfsdk/fpdfdoc_unittest.cpp @@ -61,7 +61,7 @@ class PDFDocTest : public testing::Test { CPDF_ModuleMgr* module_mgr = CPDF_ModuleMgr::Get(); module_mgr->InitPageModule(); - m_pDoc.reset(new CPDF_TestPdfDocument()); + m_pDoc = WrapUnique(new CPDF_TestPdfDocument()); m_pIndirectObjs = m_pDoc->GetHolder(); // Setup the root directory. m_pRootObj.reset(new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>())); diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 62cafa0781..3c60ab0041 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -7,6 +7,7 @@ #include "public/fpdfview.h" #include <memory> +#include <utility> #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" @@ -845,7 +846,7 @@ void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext, return; if (!pContext->m_pOptions) - pContext->m_pOptions.reset(new CPDF_RenderOptions); + pContext->m_pOptions = WrapUnique(new CPDF_RenderOptions); if (flags & FPDF_LCD_TEXT) pContext->m_pOptions->m_Flags |= RENDER_CLEARTYPE; @@ -884,17 +885,17 @@ 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.reset(new CPDF_RenderContext(pPage)); + pContext->m_pContext = WrapUnique(new CPDF_RenderContext(pPage)); pContext->m_pContext->AppendLayer(pPage, &matrix); if (flags & FPDF_ANNOT) { - pContext->m_pAnnots.reset(new CPDF_AnnotList(pPage)); + pContext->m_pAnnots = WrapUnique(new 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.reset(new CPDF_ProgressiveRenderer( + pContext->m_pRenderer = WrapUnique(new CPDF_ProgressiveRenderer( pContext->m_pContext.get(), pContext->m_pDevice.get(), pContext->m_pOptions.get())); pContext->m_pRenderer->Start(pause); diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp index 6295494621..ccaceac413 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp @@ -6,6 +6,8 @@ #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" +#include <memory> + #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" #include "fpdfsdk/include/cpdfsdk_environment.h" #include "fpdfsdk/include/fsdk_define.h" @@ -54,7 +56,7 @@ FX_BOOL CPDFXFA_App::Initialize(v8::Isolate* pIsolate) { if (!m_pIsolate) return FALSE; - m_pXFAApp.reset(new CXFA_FFApp(this)); + m_pXFAApp = WrapUnique(new 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 451175a9a4..3567524c65 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp @@ -39,7 +39,7 @@ FX_BOOL CPDFXFA_Page::LoadPDFPage() { return FALSE; if (!m_pPDFPage || m_pPDFPage->m_pFormDict != pDict) { - m_pPDFPage.reset(new CPDF_Page(pPDFDoc, pDict, true)); + m_pPDFPage = WrapUnique(new CPDF_Page(pPDFDoc, pDict, true)); m_pPDFPage->ParseContent(); } return TRUE; @@ -87,7 +87,8 @@ FX_BOOL CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) { if (!m_pDocument || m_iPageIndex < 0 || !pageDict) return FALSE; - m_pPDFPage.reset(new CPDF_Page(m_pDocument->GetPDFDoc(), pageDict, true)); + m_pPDFPage = + WrapUnique(new 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 528a0ba061..ce16a21a17 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -7,6 +7,8 @@ #include "fpdfsdk/fxedit/include/fxet_edit.h" #include <algorithm> +#include <memory> +#include <utility> #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" @@ -24,7 +26,6 @@ #include "core/fxge/include/cfx_renderdevice.h" #include "fpdfsdk/cfx_systemhandler.h" #include "fpdfsdk/fxedit/include/fx_edit.h" -#include "fpdfsdk/fxedit/include/fxet_edit.h" #include "fpdfsdk/pdfwindow/PWL_Edit.h" #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" @@ -1025,7 +1026,7 @@ void CFX_Edit::Initialize() { } void CFX_Edit::SetFontMap(IPVT_FontMap* pFontMap) { - m_pVTProvider.reset(new CFX_Edit_Provider(pFontMap)); + m_pVTProvider = WrapUnique(new CFX_Edit_Provider(pFontMap)); m_pVT->SetProvider(m_pVTProvider.get()); } @@ -1039,7 +1040,7 @@ void CFX_Edit::SetOprNotify(CPWL_Edit* pOprNotify) { CFX_Edit_Iterator* CFX_Edit::GetIterator() { if (!m_pIterator) - m_pIterator.reset(new CFX_Edit_Iterator(this, m_pVT->GetIterator())); + m_pIterator = WrapUnique(new 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 2c7eda8a7e..3b316aaf69 100644 --- a/fpdfsdk/javascript/JS_Runtime_Stub.cpp +++ b/fpdfsdk/javascript/JS_Runtime_Stub.cpp @@ -124,7 +124,7 @@ class CJS_RuntimeStub final : public IJS_Runtime { IJS_Context* NewContext() override { if (!m_pContext) - m_pContext.reset(new CJS_ContextStub()); + m_pContext = WrapUnique(new CJS_ContextStub()); return GetCurrentContext(); } diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp index d49f4ec6c0..9f1c854914 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp @@ -47,7 +47,7 @@ CPWL_FontMap::~CPWL_FontMap() { CPDF_Document* CPWL_FontMap::GetDocument() { if (!m_pPDFDoc) { if (CPDF_ModuleMgr::Get()) { - m_pPDFDoc.reset(new CPDF_Document(std::unique_ptr<CPDF_Parser>())); + m_pPDFDoc = WrapUnique(new 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 2b44e29319..ef1dfb2906 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp @@ -76,7 +76,7 @@ CFX_ByteString CPWL_ListBox::GetClassName() const { void CPWL_ListBox::OnCreated() { m_pList->SetFontMap(GetFontMap()); - m_pListNotify.reset(new CPWL_List_Notify(this)); + m_pListNotify = WrapUnique(new 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 adda0bbbc9..207157db7e 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -86,7 +86,7 @@ CPWL_TimerHandler::~CPWL_TimerHandler() {} void CPWL_TimerHandler::BeginTimer(int32_t nElapse) { if (!m_pTimer) - m_pTimer.reset(new CPWL_Timer(this, GetSystemHandler())); + m_pTimer = WrapUnique(new CPWL_Timer(this, GetSystemHandler())); if (m_pTimer) m_pTimer->SetPWLTimer(nElapse); |