diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-05-25 12:03:18 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-25 19:16:31 +0000 |
commit | 797ca5cad52edde7c65da45a15216f20b1bfd8fd (patch) | |
tree | 811a96d5f505e7cff89395cea7dff89604fc9133 /xfa/fwl | |
parent | 3a4c408554f2f2ffb5a143f6dadcdd528fcf106e (diff) | |
download | pdfium-797ca5cad52edde7c65da45a15216f20b1bfd8fd.tar.xz |
Mass conversion of all const-lifetime class members
Sed + minimal conversions to compile, including moving some
constructors into the .cpp file. Any that caused ASAN issues
during the tests were omitted rather than trying to resolve
the underlying issue.
Change-Id: I00a421f33b253eb4071ffd9af3f2922c7443b335
Reviewed-on: https://pdfium-review.googlesource.com/5891
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'xfa/fwl')
-rw-r--r-- | xfa/fwl/cfwl_app.h | 4 | ||||
-rw-r--r-- | xfa/fwl/cfwl_combobox.cpp | 21 | ||||
-rw-r--r-- | xfa/fwl/cfwl_datetimepicker.cpp | 10 | ||||
-rw-r--r-- | xfa/fwl/cfwl_edit.cpp | 8 | ||||
-rw-r--r-- | xfa/fwl/cfwl_listbox.cpp | 8 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widget.h | 6 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widgetmgr.h | 2 |
7 files changed, 30 insertions, 29 deletions
diff --git a/xfa/fwl/cfwl_app.h b/xfa/fwl/cfwl_app.h index c2779e8a25..04f140f451 100644 --- a/xfa/fwl/cfwl_app.h +++ b/xfa/fwl/cfwl_app.h @@ -32,12 +32,12 @@ class CFWL_App { explicit CFWL_App(CXFA_FFApp* pAdapter); ~CFWL_App(); - CXFA_FFApp* GetAdapterNative() const { return m_pAdapterNative; } + CXFA_FFApp* GetAdapterNative() const { return m_pAdapterNative.Get(); } CFWL_WidgetMgr* GetWidgetMgr() const { return m_pWidgetMgr.get(); } CFWL_NoteDriver* GetNoteDriver() const { return m_pNoteDriver.get(); } private: - CXFA_FFApp* const m_pAdapterNative; + CFX_UnownedPtr<CXFA_FFApp> const m_pAdapterNative; std::unique_ptr<CFWL_WidgetMgr> m_pWidgetMgr; std::unique_ptr<CFWL_NoteDriver> m_pNoteDriver; }; diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp index b5931d1c04..ba72d3d2b2 100644 --- a/xfa/fwl/cfwl_combobox.cpp +++ b/xfa/fwl/cfwl_combobox.cpp @@ -49,12 +49,12 @@ CFWL_ComboBox::CFWL_ComboBox(const CFWL_App* app) auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(); prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; prop->m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; - m_pListBox = - pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp, std::move(prop), this); + m_pListBox = pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp.Get(), + std::move(prop), this); if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) { m_pEdit = pdfium::MakeUnique<CFWL_ComboEdit>( - m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), this); + m_pOwnerApp.Get(), pdfium::MakeUnique<CFWL_WidgetProperties>(), this); m_pEdit->SetOuter(this); } if (m_pEdit) @@ -92,7 +92,8 @@ void CFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded, bool bRemoveDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown); if (bAddDropDown && !m_pEdit) { m_pEdit = pdfium::MakeUnique<CFWL_ComboEdit>( - m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr); + m_pOwnerApp.Get(), pdfium::MakeUnique<CFWL_WidgetProperties>(), + nullptr); m_pEdit->SetOuter(this); m_pEdit->SetParent(this); } else if (bRemoveDropDown && m_pEdit) { @@ -496,8 +497,8 @@ void CFWL_ComboBox::InitProxyForm() { // TODO(dsinclair): Does this leak? I don't see a delete, but I'm not sure // if the SetParent call is going to transfer ownership. - m_pComboBoxProxy = new CFWL_ComboBoxProxy(this, m_pOwnerApp, std::move(prop), - m_pListBox.get()); + m_pComboBoxProxy = new CFWL_ComboBoxProxy(this, m_pOwnerApp.Get(), + std::move(prop), m_pListBox.get()); m_pListBox->SetParent(m_pComboBoxProxy); } @@ -510,8 +511,8 @@ void CFWL_ComboBox::DisForm_InitComboList() { prop->m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; prop->m_dwStates = FWL_WGTSTATE_Invisible; prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; - m_pListBox = - pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp, std::move(prop), this); + m_pListBox = pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp.Get(), + std::move(prop), this); } void CFWL_ComboBox::DisForm_InitComboEdit() { @@ -522,8 +523,8 @@ void CFWL_ComboBox::DisForm_InitComboEdit() { prop->m_pParent = this; prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; - m_pEdit = - pdfium::MakeUnique<CFWL_ComboEdit>(m_pOwnerApp, std::move(prop), this); + m_pEdit = pdfium::MakeUnique<CFWL_ComboEdit>(m_pOwnerApp.Get(), + std::move(prop), this); m_pEdit->SetOuter(this); } diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp index e1d3a748d6..a49785e987 100644 --- a/xfa/fwl/cfwl_datetimepicker.cpp +++ b/xfa/fwl/cfwl_datetimepicker.cpp @@ -40,8 +40,8 @@ CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app) monthProp->m_dwStates = FWL_WGTSTATE_Invisible; monthProp->m_pParent = this; monthProp->m_pThemeProvider = m_pProperties->m_pThemeProvider; - m_pMonthCal.reset( - new CFWL_MonthCalendar(m_pOwnerApp, std::move(monthProp), this)); + m_pMonthCal = pdfium::MakeUnique<CFWL_MonthCalendar>( + m_pOwnerApp.Get(), std::move(monthProp), this); m_pMonthCal->SetWidgetRect( CFX_RectF(0, 0, m_pMonthCal->GetAutosizedWidgetRect().Size())); @@ -50,7 +50,7 @@ CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app) editProp->m_pParent = this; editProp->m_pThemeProvider = m_pProperties->m_pThemeProvider; - m_pEdit = pdfium::MakeUnique<CFWL_DateTimeEdit>(m_pOwnerApp, + m_pEdit = pdfium::MakeUnique<CFWL_DateTimeEdit>(m_pOwnerApp.Get(), std::move(editProp), this); RegisterEventTarget(m_pMonthCal.get()); RegisterEventTarget(m_pEdit.get()); @@ -332,8 +332,8 @@ void CFWL_DateTimePicker::InitProxyForm() { prop->m_dwStates = FWL_WGTSTATE_Invisible; prop->m_pOwner = this; - m_pForm = pdfium::MakeUnique<CFWL_FormProxy>(m_pOwnerApp, std::move(prop), - m_pMonthCal.get()); + m_pForm = pdfium::MakeUnique<CFWL_FormProxy>( + m_pOwnerApp.Get(), std::move(prop), m_pMonthCal.get()); m_pMonthCal->SetParent(m_pForm.get()); } diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index 28948cca21..eff76ffabf 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -1063,8 +1063,8 @@ void CFWL_Edit::InitVerticalScrollBar() { prop->m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible; prop->m_pParent = this; prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; - m_pVertScrollBar = - pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp, std::move(prop), this); + m_pVertScrollBar = pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp.Get(), + std::move(prop), this); } void CFWL_Edit::InitHorizontalScrollBar() { @@ -1076,8 +1076,8 @@ void CFWL_Edit::InitHorizontalScrollBar() { prop->m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible; prop->m_pParent = this; prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; - m_pHorzScrollBar = - pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp, std::move(prop), this); + m_pHorzScrollBar = pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp.Get(), + std::move(prop), this); } void CFWL_Edit::ShowCaret(CFX_RectF* pRect) { diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp index 9d9bf72f4c..0fd43efa08 100644 --- a/xfa/fwl/cfwl_listbox.cpp +++ b/xfa/fwl/cfwl_listbox.cpp @@ -630,8 +630,8 @@ void CFWL_ListBox::InitVerticalScrollBar() { prop->m_dwStates = FWL_WGTSTATE_Invisible; prop->m_pParent = this; prop->m_pThemeProvider = m_pScrollBarTP; - m_pVertScrollBar = - pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp, std::move(prop), this); + m_pVertScrollBar = pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp.Get(), + std::move(prop), this); } void CFWL_ListBox::InitHorizontalScrollBar() { @@ -643,8 +643,8 @@ void CFWL_ListBox::InitHorizontalScrollBar() { prop->m_dwStates = FWL_WGTSTATE_Invisible; prop->m_pParent = this; prop->m_pThemeProvider = m_pScrollBarTP; - m_pHorzScrollBar = - pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp, std::move(prop), this); + m_pHorzScrollBar = pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp.Get(), + std::move(prop), this); } bool CFWL_ListBox::IsShowScrollBar(bool bVert) { diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h index dd8fb5654b..9bcbf55cbc 100644 --- a/xfa/fwl/cfwl_widget.h +++ b/xfa/fwl/cfwl_widget.h @@ -104,7 +104,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate { return m_pDelegate ? m_pDelegate.Get() : this; } - const CFWL_App* GetOwnerApp() const { return m_pOwnerApp; } + const CFWL_App* GetOwnerApp() const { return m_pOwnerApp.Get(); } uint32_t GetEventKey() const { return m_nEventKey; } void SetEventKey(uint32_t key) { m_nEventKey = key; } @@ -148,8 +148,8 @@ class CFWL_Widget : public IFWL_WidgetDelegate { IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix); - const CFWL_App* const m_pOwnerApp; - CFWL_WidgetMgr* const m_pWidgetMgr; + CFX_UnownedPtr<const CFWL_App> const m_pOwnerApp; + CFX_UnownedPtr<CFWL_WidgetMgr> const m_pWidgetMgr; std::unique_ptr<CFWL_WidgetProperties> m_pProperties; CFWL_Widget* m_pOuter; int32_t m_iLock; diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h index c3dca31d76..4c12e707f6 100644 --- a/xfa/fwl/cfwl_widgetmgr.h +++ b/xfa/fwl/cfwl_widgetmgr.h @@ -116,7 +116,7 @@ class CFWL_WidgetMgr : public CFWL_WidgetMgrDelegate { uint32_t m_dwCapability; std::map<CFWL_Widget*, std::unique_ptr<Item>> m_mapWidgetItem; - CXFA_FWLAdapterWidgetMgr* const m_pAdapter; + CFX_UnownedPtr<CXFA_FWLAdapterWidgetMgr> const m_pAdapter; #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) CFX_RectF m_rtScreen; #endif |