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

Side by Side Diff: xfa/src/fde/css/fde_csscache.h

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « xfa/src/fde/css/fde_css.h ('k') | xfa/src/fde/css/fde_csscache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef XFA_SRC_FDE_CSS_FDE_CSSCACHE_H_
8 #define XFA_SRC_FDE_CSS_FDE_CSSCACHE_H_
9
10 #include <map>
11
12 #include "xfa/src/fde/css/fde_css.h"
13 #include "xfa/src/fgas/crt/fgas_memory.h"
14
15 class FDE_CSSCacheItem : public CFX_Target {
16 public:
17 explicit FDE_CSSCacheItem(IFDE_CSSStyleSheet* p);
18 ~FDE_CSSCacheItem();
19
20 IFDE_CSSStyleSheet* pStylesheet;
21 FX_DWORD dwActivity;
22 };
23
24 class CFDE_CSSStyleSheetCache : public IFDE_CSSStyleSheetCache,
25 public CFX_Target {
26 public:
27 CFDE_CSSStyleSheetCache();
28 ~CFDE_CSSStyleSheetCache();
29 virtual void Release() { delete this; }
30
31 virtual void SetMaxItems(int32_t iMaxCount = 5) {
32 FXSYS_assert(iMaxCount >= 3);
33 m_iMaxItems = iMaxCount;
34 }
35
36 virtual void AddStyleSheet(const CFX_ByteStringC& szKey,
37 IFDE_CSSStyleSheet* pStyleSheet);
38 virtual IFDE_CSSStyleSheet* GetStyleSheet(const CFX_ByteStringC& szKey) const;
39 virtual void RemoveStyleSheet(const CFX_ByteStringC& szKey);
40
41 protected:
42 void RemoveLowestActivityItem();
43 std::map<CFX_ByteString, FDE_CSSCacheItem*> m_Stylesheets;
44 IFX_MEMAllocator* m_pFixedStore;
45 int32_t m_iMaxItems;
46 };
47
48 class FDE_CSSTagCache : public CFX_Target {
49 public:
50 FDE_CSSTagCache(FDE_CSSTagCache* parent, IFDE_CSSTagProvider* tag);
51 FDE_CSSTagCache(const FDE_CSSTagCache& it);
52 FDE_CSSTagCache* GetParent() const { return pParent; }
53 IFDE_CSSTagProvider* GetTag() const { return pTag; }
54 FX_DWORD HashID() const { return dwIDHash; }
55 FX_DWORD HashTag() const { return dwTagHash; }
56 int32_t CountHashClass() const { return dwClassHashs.GetSize(); }
57 void SetClassIndex(int32_t index) { iClassIndex = index; }
58 FX_DWORD HashClass() const {
59 return iClassIndex < dwClassHashs.GetSize()
60 ? dwClassHashs.GetAt(iClassIndex)
61 : 0;
62 }
63
64 protected:
65 IFDE_CSSTagProvider* pTag;
66 FDE_CSSTagCache* pParent;
67 FX_DWORD dwIDHash;
68 FX_DWORD dwTagHash;
69 int32_t iClassIndex;
70 CFDE_DWordArray dwClassHashs;
71 };
72 typedef CFX_ObjectStackTemplate<FDE_CSSTagCache> CFDE_CSSTagStack;
73
74 class CFDE_CSSAccelerator : public IFDE_CSSAccelerator, public CFX_Target {
75 public:
76 virtual void OnEnterTag(IFDE_CSSTagProvider* pTag);
77 virtual void OnLeaveTag(IFDE_CSSTagProvider* pTag);
78 void Clear() { m_Stack.RemoveAll(); }
79 FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); }
80
81 protected:
82 CFDE_CSSTagStack m_Stack;
83 };
84
85 #endif // XFA_SRC_FDE_CSS_FDE_CSSCACHE_H_
OLDNEW
« no previous file with comments | « xfa/src/fde/css/fde_css.h ('k') | xfa/src/fde/css/fde_csscache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698