summaryrefslogtreecommitdiff
path: root/core/fxge/include/cfx_fontcache.h
diff options
context:
space:
mode:
authorart-snake <art-snake@yandex-team.ru>2016-09-20 07:46:25 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-20 07:46:26 -0700
commit9972ff99285cea12a20026136e98c1e635a15010 (patch)
tree7ddd9c0a49329baccd0e570fe064527b794c1fde /core/fxge/include/cfx_fontcache.h
parent717d1330bafb846e4cd25bfb4952bfdedce0db91 (diff)
downloadpdfium-9972ff99285cea12a20026136e98c1e635a15010.tar.xz
Refactor CFX_FontCache to have only one in GE Module.
After this CL: only one global CFX_FontCache used. Any cached items from it, are released, when they are not being used. This is restore part of reverted CL: Original CL: https://codereview.chromium.org/2158023002 Revert reason: BUG=647612 Fix bug CL: https://codereview.chromium.org/2350193003 Review-Url: https://codereview.chromium.org/2350243002
Diffstat (limited to 'core/fxge/include/cfx_fontcache.h')
-rw-r--r--core/fxge/include/cfx_fontcache.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/core/fxge/include/cfx_fontcache.h b/core/fxge/include/cfx_fontcache.h
index d4a4dddaa5..dd9a176d19 100644
--- a/core/fxge/include/cfx_fontcache.h
+++ b/core/fxge/include/cfx_fontcache.h
@@ -8,6 +8,7 @@
#define CORE_FXGE_INCLUDE_CFX_FONTCACHE_H_
#include <map>
+#include <memory>
#include "core/fxcrt/include/fx_system.h"
#include "core/fxge/include/fx_font.h"
@@ -19,15 +20,21 @@ class CFX_FontCache {
public:
CFX_FontCache();
~CFX_FontCache();
- CFX_FaceCache* GetCachedFace(CFX_Font* pFont);
- void ReleaseCachedFace(CFX_Font* pFont);
- void FreeCache(FX_BOOL bRelease = FALSE);
+ CFX_FaceCache* GetCachedFace(const CFX_Font* pFont);
+ void ReleaseCachedFace(const CFX_Font* pFont);
#ifdef _SKIA_SUPPORT_
- CFX_TypeFace* GetDeviceCache(CFX_Font* pFont);
+ CFX_TypeFace* GetDeviceCache(const CFX_Font* pFont);
#endif
private:
- using CFX_FTCacheMap = std::map<FXFT_Face, CFX_CountedFaceCache*>;
+ struct CountedFaceCache {
+ CountedFaceCache();
+ ~CountedFaceCache();
+ std::unique_ptr<CFX_FaceCache> m_Obj;
+ uint32_t m_nCount;
+ };
+
+ using CFX_FTCacheMap = std::map<FXFT_Face, std::unique_ptr<CountedFaceCache>>;
CFX_FTCacheMap m_FTFaceMap;
CFX_FTCacheMap m_ExtFaceMap;
};