From a54bc400fa69491ad72ad97f74742ec28cbe849a Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 27 May 2016 11:13:09 -0700 Subject: Add back-pointer to "Associated widget" to CFWL_WidgetImp. This is the last use of CFX_PrivateData, which is now removed. Review-Url: https://codereview.chromium.org/2016743002 --- core/fxcrt/fx_basic_util.cpp | 81 ------------------------------------------- core/fxcrt/include/fx_basic.h | 48 ------------------------- 2 files changed, 129 deletions(-) (limited to 'core') diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp index 02e09ce057..8eba2cce0e 100644 --- a/core/fxcrt/fx_basic_util.cpp +++ b/core/fxcrt/fx_basic_util.cpp @@ -18,87 +18,6 @@ #include #include -#ifdef PDF_ENABLE_XFA -CFX_PrivateData::CFX_PrivateData() {} - -CFX_PrivateData::~CFX_PrivateData() { - ClearAll(); -} -void FX_PRIVATEDATA::FreeData() { - if (!m_pData) { - return; - } - if (m_bSelfDestruct) { - delete static_cast(m_pData); - } else if (m_pCallback) { - m_pCallback(m_pData); - } -} -void CFX_PrivateData::AddData(void* pModuleId, - void* pData, - PD_CALLBACK_FREEDATA callback, - FX_BOOL bSelfDestruct) { - if (!pModuleId) { - return; - } - FX_PRIVATEDATA* pList = m_DataList.GetData(); - int count = m_DataList.GetSize(); - for (int i = 0; i < count; i++) { - if (pList[i].m_pModuleId == pModuleId) { - pList[i].FreeData(); - pList[i].m_pData = pData; - pList[i].m_pCallback = callback; - return; - } - } - FX_PRIVATEDATA data = {pModuleId, pData, callback, bSelfDestruct}; - m_DataList.Add(data); -} -void CFX_PrivateData::SetPrivateData(void* pModuleId, - void* pData, - PD_CALLBACK_FREEDATA callback) { - AddData(pModuleId, pData, callback, FALSE); -} -void CFX_PrivateData::SetPrivateObj(void* pModuleId, CFX_Deletable* pObj) { - AddData(pModuleId, pObj, NULL, TRUE); -} -FX_BOOL CFX_PrivateData::RemovePrivateData(void* pModuleId) { - if (!pModuleId) { - return FALSE; - } - FX_PRIVATEDATA* pList = m_DataList.GetData(); - int count = m_DataList.GetSize(); - for (int i = 0; i < count; i++) { - if (pList[i].m_pModuleId == pModuleId) { - m_DataList.RemoveAt(i); - return TRUE; - } - } - return FALSE; -} -void* CFX_PrivateData::GetPrivateData(void* pModuleId) { - if (!pModuleId) { - return NULL; - } - FX_PRIVATEDATA* pList = m_DataList.GetData(); - int count = m_DataList.GetSize(); - for (int i = 0; i < count; i++) { - if (pList[i].m_pModuleId == pModuleId) { - return pList[i].m_pData; - } - } - return NULL; -} -void CFX_PrivateData::ClearAll() { - FX_PRIVATEDATA* pList = m_DataList.GetData(); - int count = m_DataList.GetSize(); - for (int i = 0; i < count; i++) { - pList[i].FreeData(); - } - m_DataList.RemoveAll(); -} -#endif // PDF_ENABLE_XFA - void FX_atonum(const CFX_ByteStringC& strc, FX_BOOL& bInteger, void* pData) { if (strc.Find('.') == -1) { bInteger = TRUE; diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h index 73cb648a46..13b51bd3fa 100644 --- a/core/fxcrt/include/fx_basic.h +++ b/core/fxcrt/include/fx_basic.h @@ -324,9 +324,7 @@ typedef CFX_ArrayTemplate CFX_WideStringCArray; typedef CFX_ArrayTemplate CFX_FloatArray; typedef CFX_ArrayTemplate CFX_ByteArray; typedef CFX_ArrayTemplate CFX_Int32Array; -#endif // PDF_ENABLE_XFA -#ifdef PDF_ENABLE_XFA template class CFX_ObjectArray : public CFX_BasicArray { public: @@ -621,52 +619,6 @@ class CFX_PtrList { #ifdef PDF_ENABLE_XFA typedef void (*PD_CALLBACK_FREEDATA)(void* pData); -struct FX_PRIVATEDATA { - void FreeData(); - - void* m_pModuleId; - void* m_pData; - PD_CALLBACK_FREEDATA m_pCallback; - FX_BOOL m_bSelfDestruct; -}; - -class CFX_PrivateData { - public: - CFX_PrivateData(); - ~CFX_PrivateData(); - - void ClearAll(); - - void SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback); - void SetPrivateObj(void* module_id, CFX_Deletable* pObj); - - void* GetPrivateData(void* module_id); - FX_BOOL LookupPrivateData(void* module_id, void*& pData) const { - if (!module_id) { - return FALSE; - } - uint32_t nCount = m_DataList.GetSize(); - for (uint32_t n = 0; n < nCount; n++) { - if (m_DataList[n].m_pModuleId == module_id) { - pData = m_DataList[n].m_pData; - return TRUE; - } - } - return FALSE; - } - - FX_BOOL RemovePrivateData(void* module_id); - - protected: - CFX_ArrayTemplate m_DataList; - - void AddData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback, - FX_BOOL bSelfDestruct); -}; #endif // PDF_ENABLE_XFA class CFX_BitStream { -- cgit v1.2.3