summaryrefslogtreecommitdiff
path: root/xfa/src/fde/css/fde_csscache.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-03-09 13:24:25 -0800
committerTom Sepez <tsepez@chromium.org>2016-03-09 13:24:25 -0800
commit4f6fdbe6adf0d90886b9deb5666996603cf1207c (patch)
tree4fee37f0d6711efbfdebbb72e0ba1746c95ad05e /xfa/src/fde/css/fde_csscache.h
parent2e95951e06bd4d11459fb257c7c2b8fc881854e8 (diff)
downloadpdfium-4f6fdbe6adf0d90886b9deb5666996603cf1207c.tar.xz
Structs shouldn't inherit from CFX_Target.
There are some assumptions in the code that CAPS_NAMED structs are POD, and can be memcpy'd, malloc'd, etc. CFX_Target adds a virtual dtor, which is not what is desired for many of these, so resolve by making each a CAPS_Named class or by removing the inheritence. In the process XFA_TextPiece was found to be malloc'd despite having a ctor. Move this to |new|, noting that the object is never freed (and goes out of existence when the allocator's pool is destroyed). BUG=pdfium:432 R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1780753002 .
Diffstat (limited to 'xfa/src/fde/css/fde_csscache.h')
-rw-r--r--xfa/src/fde/css/fde_csscache.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/xfa/src/fde/css/fde_csscache.h b/xfa/src/fde/css/fde_csscache.h
index ac3d68c071..e10bea77f5 100644
--- a/xfa/src/fde/css/fde_csscache.h
+++ b/xfa/src/fde/css/fde_csscache.h
@@ -12,9 +12,10 @@
#include "xfa/src/fde/css/fde_css.h"
#include "xfa/src/fgas/crt/fgas_memory.h"
-struct FDE_CSSCACHEITEM : public CFX_Target {
- FDE_CSSCACHEITEM(IFDE_CSSStyleSheet* p);
- ~FDE_CSSCACHEITEM();
+class FDE_CSSCacheItem : public CFX_Target {
+ public:
+ explicit FDE_CSSCacheItem(IFDE_CSSStyleSheet* p);
+ ~FDE_CSSCacheItem();
IFDE_CSSStyleSheet* pStylesheet;
FX_DWORD dwActivity;
@@ -39,16 +40,16 @@ class CFDE_CSSStyleSheetCache : public IFDE_CSSStyleSheetCache,
protected:
void RemoveLowestActivityItem();
- std::map<CFX_ByteString, FDE_CSSCACHEITEM*> m_Stylesheets;
+ std::map<CFX_ByteString, FDE_CSSCacheItem*> m_Stylesheets;
IFX_MEMAllocator* m_pFixedStore;
int32_t m_iMaxItems;
};
-struct FDE_CSSTAGCACHE : public CFX_Target {
+class FDE_CSSTagCache : public CFX_Target {
public:
- FDE_CSSTAGCACHE(FDE_CSSTAGCACHE* parent, IFDE_CSSTagProvider* tag);
- FDE_CSSTAGCACHE(const FDE_CSSTAGCACHE& it);
- FDE_CSSTAGCACHE* GetParent() const { return pParent; }
+ FDE_CSSTagCache(FDE_CSSTagCache* parent, IFDE_CSSTagProvider* tag);
+ FDE_CSSTagCache(const FDE_CSSTagCache& it);
+ FDE_CSSTagCache* GetParent() const { return pParent; }
IFDE_CSSTagProvider* GetTag() const { return pTag; }
FX_DWORD HashID() const { return dwIDHash; }
FX_DWORD HashTag() const { return dwTagHash; }
@@ -62,20 +63,20 @@ struct FDE_CSSTAGCACHE : public CFX_Target {
protected:
IFDE_CSSTagProvider* pTag;
- FDE_CSSTAGCACHE* pParent;
+ FDE_CSSTagCache* pParent;
FX_DWORD dwIDHash;
FX_DWORD dwTagHash;
int32_t iClassIndex;
CFDE_DWordArray dwClassHashs;
};
-typedef CFX_ObjectStackTemplate<FDE_CSSTAGCACHE> CFDE_CSSTagStack;
+typedef CFX_ObjectStackTemplate<FDE_CSSTagCache> CFDE_CSSTagStack;
class CFDE_CSSAccelerator : public IFDE_CSSAccelerator, public CFX_Target {
public:
virtual void OnEnterTag(IFDE_CSSTagProvider* pTag);
virtual void OnLeaveTag(IFDE_CSSTagProvider* pTag);
void Clear() { m_Stack.RemoveAll(); }
- FDE_CSSTAGCACHE* GetTopElement() const { return m_Stack.GetTopElement(); }
+ FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); }
protected:
CFDE_CSSTagStack m_Stack;