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

Side by Side Diff: xfa/fde/css/fde_cssstylesheet.cpp

Issue 1990363003: Use std::unordered_map for CFDE_CSSStyleSheet::m_StringCache (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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/fde/css/fde_cssstylesheet.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fde/css/fde_cssstylesheet.h" 7 #include "xfa/fde/css/fde_cssstylesheet.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 case FDE_CSSRULETYPE_FontFace: 95 case FDE_CSSRULETYPE_FontFace:
96 ((CFDE_CSSFontFaceRule*)pRule)->~CFDE_CSSFontFaceRule(); 96 ((CFDE_CSSFontFaceRule*)pRule)->~CFDE_CSSFontFaceRule();
97 break; 97 break;
98 default: 98 default:
99 ASSERT(FALSE); 99 ASSERT(FALSE);
100 break; 100 break;
101 } 101 }
102 } 102 }
103 m_RuleArray.RemoveAll(); 103 m_RuleArray.RemoveAll();
104 m_Selectors.RemoveAll(); 104 m_Selectors.RemoveAll();
105 m_StringCache.RemoveAll(); 105 m_StringCache.clear();
106 delete m_pAllocator; 106 delete m_pAllocator;
107 m_pAllocator = nullptr; 107 m_pAllocator = nullptr;
108 } 108 }
109 uint32_t CFDE_CSSStyleSheet::AddRef() { 109 uint32_t CFDE_CSSStyleSheet::AddRef() {
110 return ++m_wRefCount; 110 return ++m_wRefCount;
111 } 111 }
112 uint32_t CFDE_CSSStyleSheet::Release() { 112 uint32_t CFDE_CSSStyleSheet::Release() {
113 uint32_t dwRefCount = --m_wRefCount; 113 uint32_t dwRefCount = --m_wRefCount;
114 if (dwRefCount == 0) { 114 if (dwRefCount == 0) {
115 delete this; 115 delete this;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 eStatus = LoadImportRule(pSyntax); 168 eStatus = LoadImportRule(pSyntax);
169 break; 169 break;
170 case FDE_CSSSYNTAXSTATUS_PageRule: 170 case FDE_CSSSYNTAXSTATUS_PageRule:
171 eStatus = LoadPageRule(pSyntax); 171 eStatus = LoadPageRule(pSyntax);
172 break; 172 break;
173 default: 173 default:
174 break; 174 break;
175 } 175 }
176 } while (eStatus >= FDE_CSSSYNTAXSTATUS_None); 176 } while (eStatus >= FDE_CSSSYNTAXSTATUS_None);
177 m_Selectors.RemoveAll(); 177 m_Selectors.RemoveAll();
178 m_StringCache.RemoveAll(); 178 m_StringCache.clear();
179 return eStatus != FDE_CSSSYNTAXSTATUS_Error; 179 return eStatus != FDE_CSSSYNTAXSTATUS_Error;
180 } 180 }
181 FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule( 181 FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule(
182 CFDE_CSSSyntaxParser* pSyntax) { 182 CFDE_CSSSyntaxParser* pSyntax) {
183 uint32_t dwMediaList = 0; 183 uint32_t dwMediaList = 0;
184 CFDE_CSSMediaRule* pMediaRule = NULL; 184 CFDE_CSSMediaRule* pMediaRule = NULL;
185 for (;;) { 185 for (;;) {
186 switch (pSyntax->DoSyntaxParse()) { 186 switch (pSyntax->DoSyntaxParse()) {
187 case FDE_CSSSYNTAXSTATUS_MediaType: { 187 case FDE_CSSSYNTAXSTATUS_MediaType: {
188 int32_t iLen; 188 int32_t iLen;
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 return NULL; 496 return NULL;
497 } 497 }
498 } 498 }
499 if (pPersudoFirst == NULL) { 499 if (pPersudoFirst == NULL) {
500 return pFirst; 500 return pFirst;
501 } else { 501 } else {
502 pPersudoLast->SetNext(pFirst); 502 pPersudoLast->SetNext(pFirst);
503 return pPersudoFirst; 503 return pPersudoFirst;
504 } 504 }
505 } 505 }
OLDNEW
« no previous file with comments | « xfa/fde/css/fde_cssstylesheet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698