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

Unified Diff: xfa/src/fwl/src/core/fwl_widgetimp.cpp

Issue 1453473002: FWL refcounts never incremented (part 2). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebased Created 5 years 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 | « xfa/src/fwl/src/core/fwl_targetimp.cpp ('k') | xfa/src/fwl/src/core/include/fwl_contentimp.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/src/fwl/src/core/fwl_widgetimp.cpp
diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
index 4cba92a1cfbb6d8826cd9db142653f06e86d22f2..95e235d12a309977e226b6012e27b0912d0cfaaa 100644
--- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
@@ -499,30 +499,15 @@ IFWL_Widget* CFWL_WidgetImp::GetInterface() const {
void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) {
m_pInterface = pInterface;
}
-CFWL_WidgetImp::CFWL_WidgetImp(IFWL_Widget* pOuter)
- : m_pProperties(NULL),
- m_pPrivateData(NULL),
- m_pDelegate(NULL),
- m_pCurDelegate(NULL),
- m_pOuter(pOuter),
- m_pInterface(NULL),
- m_iLock(0) {
- m_pProperties = new CFWL_WidgetImpProperties;
- m_pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- FXSYS_assert(m_pWidgetMgr != NULL);
-}
CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
- : m_pProperties(NULL),
+ : m_pProperties(new CFWL_WidgetImpProperties),
m_pPrivateData(NULL),
m_pDelegate(NULL),
m_pCurDelegate(NULL),
m_pOuter(pOuter),
m_pInterface(NULL),
m_iLock(0) {
- if (!m_pProperties) {
- m_pProperties = new CFWL_WidgetImpProperties;
- }
*m_pProperties = properties;
m_pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
FXSYS_assert(m_pWidgetMgr != NULL);
@@ -1040,9 +1025,8 @@ FWL_ERR CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
}
class CFWL_CustomImp : public CFWL_WidgetImp {
public:
- CFWL_CustomImp(IFWL_Widget* pOuter = NULL);
CFWL_CustomImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
virtual FWL_ERR Update();
virtual FWL_ERR SetProxy(IFWL_Proxy* pProxy);
@@ -1050,8 +1034,6 @@ class CFWL_CustomImp : public CFWL_WidgetImp {
protected:
IFWL_Proxy* m_pProxy;
};
-CFWL_CustomImp::CFWL_CustomImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter), m_pProxy(NULL) {}
CFWL_CustomImp::CFWL_CustomImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_WidgetImp(properties, pOuter), m_pProxy(NULL) {}
@@ -1072,15 +1054,17 @@ FWL_ERR CFWL_CustomImp::SetProxy(IFWL_Proxy* pProxy) {
m_pProxy = pProxy;
return FWL_ERR_Succeeded;
}
-IFWL_Custom::IFWL_Custom() {
-}
-FWL_ERR IFWL_Custom::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
+
+// static
+IFWL_Custom* IFWL_Custom::Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_Custom* pCustom = new IFWL_Custom;
CFWL_CustomImp* pCustomImpl = new CFWL_CustomImp(properties, pOuter);
- SetImpl(pCustomImpl);
- pCustomImpl->SetInterface(this);
- return pCustomImpl->Initialize();
+ pCustom->SetImpl(pCustomImpl);
+ pCustomImpl->SetInterface(pCustom);
+ return pCustom;
}
+IFWL_Custom::IFWL_Custom() {}
FWL_ERR IFWL_Custom::SetProxy(IFWL_Proxy* pProxy) {
return static_cast<CFWL_CustomImp*>(GetImpl())->SetProxy(pProxy);
}
« no previous file with comments | « xfa/src/fwl/src/core/fwl_targetimp.cpp ('k') | xfa/src/fwl/src/core/include/fwl_contentimp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698