diff options
author | tsepez <tsepez@chromium.org> | 2016-12-14 05:57:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-14 05:57:10 -0800 |
commit | a9caab94c1f16929e5acf2676117224617d80f53 (patch) | |
tree | d71ff9a82fae6e6080deb76375f43056127b3ee2 /xfa/fwl | |
parent | 992ecf7c189e5cabf43e5ad862511cf63d030966 (diff) | |
download | pdfium-a9caab94c1f16929e5acf2676117224617d80f53.tar.xz |
Avoid the ptr.reset(new XXX()) anti-pattern
Be suspicious of |new|. This removes some of the
easy cases.
Review-Url: https://codereview.chromium.org/2571913002
Diffstat (limited to 'xfa/fwl')
-rw-r--r-- | xfa/fwl/cfwl_combobox.cpp | 4 | ||||
-rw-r--r-- | xfa/fwl/cfwl_datetimepicker.cpp | 3 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widgetmgr.cpp | 2 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_checkboxtp.cpp | 3 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_widgettp.cpp | 5 |
5 files changed, 10 insertions, 7 deletions
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp index eb6bb632cd..7e5d1b8d74 100644 --- a/xfa/fwl/cfwl_combobox.cpp +++ b/xfa/fwl/cfwl_combobox.cpp @@ -56,8 +56,8 @@ CFWL_ComboBox::CFWL_ComboBox(const CFWL_App* app) pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp, std::move(prop), this); if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) { - m_pEdit.reset(new CFWL_ComboEdit( - m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), this)); + m_pEdit = pdfium::MakeUnique<CFWL_ComboEdit>( + m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), this); m_pEdit->SetOuter(this); } if (m_pEdit) diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp index fe7b90307b..10e26b4891 100644 --- a/xfa/fwl/cfwl_datetimepicker.cpp +++ b/xfa/fwl/cfwl_datetimepicker.cpp @@ -53,7 +53,8 @@ CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app) editProp->m_pParent = this; editProp->m_pThemeProvider = m_pProperties->m_pThemeProvider; - m_pEdit.reset(new CFWL_DateTimeEdit(m_pOwnerApp, std::move(editProp), this)); + m_pEdit = pdfium::MakeUnique<CFWL_DateTimeEdit>(m_pOwnerApp, + std::move(editProp), this); RegisterEventTarget(m_pMonthCal.get()); RegisterEventTarget(m_pEdit.get()); } diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index e7eca100cc..7df7fb234d 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -563,7 +563,7 @@ CFX_Graphics* CFWL_WidgetMgr::DrawWidgetBefore(CFWL_Widget* pWidget, Item* pItem = GetWidgetMgrItem(pWidget); if (!pItem->pOffscreen) { - pItem->pOffscreen.reset(new CFX_Graphics); + pItem->pOffscreen = pdfium::MakeUnique<CFX_Graphics>(); CFX_RectF rect = pWidget->GetWidgetRect(); pItem->pOffscreen->Create((int32_t)rect.width, (int32_t)rect.height, FXDIB_Argb); diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index 4ff2ccd2a6..9109cb61c4 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -7,6 +7,7 @@ #include "xfa/fwl/theme/cfwl_checkboxtp.h" #include "core/fxge/cfx_pathdata.h" +#include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" #include "xfa/fwl/cfwl_checkbox.h" #include "xfa/fwl/cfwl_themebackground.h" @@ -219,7 +220,7 @@ void CFWL_CheckBoxTP::SetThemeData() { void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) { if (!m_pCheckPath) { - m_pCheckPath.reset(new CFX_Path); + m_pCheckPath = pdfium::MakeUnique<CFX_Path>(); m_pCheckPath->Create(); FX_FLOAT fWidth = kSignPath; FX_FLOAT fHeight = -kSignPath; diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index efc1e96335..3b436d8302 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -9,6 +9,7 @@ #include <algorithm> #include <utility> +#include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" #include "xfa/fgas/font/cfgas_fontmgr.h" #include "xfa/fgas/font/cfgas_gefont.h" @@ -173,7 +174,7 @@ void CFWL_WidgetTP::InitTTO() { m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(FX_WSTRC(L"Helvetica"), 0, 0); - m_pTextOut.reset(new CFDE_TextOut); + m_pTextOut = pdfium::MakeUnique<CFDE_TextOut>(); m_pTextOut->SetFont(m_pFDEFont); m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); @@ -641,7 +642,7 @@ bool CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ m_pFontMgr = CFGAS_FontMgr::Create(FX_GetDefFontEnumerator()); #else - m_pFontSource.reset(new CFX_FontSourceEnum_File); + m_pFontSource = pdfium::MakeUnique<CFX_FontSourceEnum_File>(); m_pFontMgr = CFGAS_FontMgr::Create(m_pFontSource.get()); #endif } |