Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(977)

Unified Diff: xfa/fwl/core/fwl_widgetmgrimp.h

Issue 1998303002: Use std::map, std::unique_ptr in fwl_widgetmgrimp.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: explicit ctor Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | xfa/fwl/core/fwl_widgetmgrimp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/core/fwl_widgetmgrimp.h
diff --git a/xfa/fwl/core/fwl_widgetmgrimp.h b/xfa/fwl/core/fwl_widgetmgrimp.h
index fe17613364399651a77453624210b9a4da800833..6e4fffeca15962e14c26298b227cacf1ce7232bc 100644
--- a/xfa/fwl/core/fwl_widgetmgrimp.h
+++ b/xfa/fwl/core/fwl_widgetmgrimp.h
@@ -7,6 +7,9 @@
#ifndef XFA_FWL_CORE_FWL_WIDGETMGRIMP_H_
#define XFA_FWL_CORE_FWL_WIDGETMGRIMP_H_
+#include <map>
+#include <memory>
+
#include "core/fxcrt/include/fx_system.h"
#include "xfa/fwl/core/fwl_error.h"
#include "xfa/fwl/core/ifwl_widgetmgr.h"
@@ -25,14 +28,14 @@ class IFWL_Widget;
class CFWL_WidgetMgrItem {
public:
- CFWL_WidgetMgrItem()
- : pParent(NULL),
- pOwner(NULL),
- pChild(NULL),
- pPrevious(NULL),
- pNext(NULL),
- pWidget(NULL),
- pOffscreen(NULL),
+ CFWL_WidgetMgrItem() : CFWL_WidgetMgrItem(nullptr) {}
+ explicit CFWL_WidgetMgrItem(IFWL_Widget* widget)
+ : pParent(nullptr),
+ pOwner(nullptr),
+ pChild(nullptr),
+ pPrevious(nullptr),
+ pNext(nullptr),
+ pWidget(widget),
iRedrawCounter(0)
#if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
,
@@ -40,19 +43,15 @@ class CFWL_WidgetMgrItem {
#endif
{
}
- ~CFWL_WidgetMgrItem() {
- if (pOffscreen) {
- delete pOffscreen;
- pOffscreen = NULL;
- }
- }
+ ~CFWL_WidgetMgrItem() {}
+
CFWL_WidgetMgrItem* pParent;
CFWL_WidgetMgrItem* pOwner;
CFWL_WidgetMgrItem* pChild;
CFWL_WidgetMgrItem* pPrevious;
CFWL_WidgetMgrItem* pNext;
- IFWL_Widget* pWidget;
- CFX_Graphics* pOffscreen;
+ IFWL_Widget* const pWidget;
+ std::unique_ptr<CFX_Graphics> pOffscreen;
int32_t iRedrawCounter;
#if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
FX_BOOL bOutsideChanged;
@@ -96,8 +95,8 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr {
void AddRedrawCounts(IFWL_Widget* pWidget);
void ResetRedrawCounts(IFWL_Widget* pWidget);
CXFA_FWLAdapterWidgetMgr* GetAdapterWidgetMgr() const { return m_pAdapter; }
- CFWL_WidgetMgrDelegate* GetDelegate() const { return m_pDelegate; }
- CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget);
+ CFWL_WidgetMgrDelegate* GetDelegate() const { return m_pDelegate.get(); }
+ CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget) const;
bool IsThreadEnabled();
bool IsFormDisabled();
FX_BOOL GetAdapterPopupPos(IFWL_Widget* pWidget,
@@ -112,14 +111,15 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr {
CFWL_WidgetMgrItem* pItem,
IFWL_Widget** pWidget = NULL);
FX_BOOL IsAbleNative(IFWL_Widget* pWidget);
- CFX_MapPtrToPtr m_mapWidgetItem;
- CXFA_FWLAdapterWidgetMgr* m_pAdapter;
- CFWL_WidgetMgrDelegate* m_pDelegate;
- friend class CFWL_WidgetMgrDelegate;
+
uint32_t m_dwCapability;
+ std::unique_ptr<CFWL_WidgetMgrDelegate> m_pDelegate;
+ std::map<IFWL_Widget*, std::unique_ptr<CFWL_WidgetMgrItem>> m_mapWidgetItem;
+ CXFA_FWLAdapterWidgetMgr* const m_pAdapter;
#if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
CFX_RectF m_rtScreen;
#endif
+ friend class CFWL_WidgetMgrDelegate;
};
class CFWL_WidgetMgrDelegate {
« no previous file with comments | « no previous file | xfa/fwl/core/fwl_widgetmgrimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698