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

Side by Side Diff: xfa/src/fdp/src/css/fde_csscache.cpp

Issue 1577503002: Merge to XFA: Switch most min/max macros to std::min/max. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: rebase Created 4 years, 11 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 | « fpdfsdk/src/pdfwindow/PWL_Utils.cpp ('k') | xfa/src/fdp/src/fde/fde_gedevice.cpp » ('j') | 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 <algorithm>
8
7 #include "xfa/src/foxitlib.h" 9 #include "xfa/src/foxitlib.h"
8 #include "fde_csscache.h" 10 #include "fde_csscache.h"
9 _FDE_CSSCACHEITEM::_FDE_CSSCACHEITEM(IFDE_CSSStyleSheet* p) 11 _FDE_CSSCACHEITEM::_FDE_CSSCACHEITEM(IFDE_CSSStyleSheet* p)
10 : pStylesheet(p), dwActivity(0) { 12 : pStylesheet(p), dwActivity(0) {
11 FXSYS_assert(pStylesheet); 13 FXSYS_assert(pStylesheet);
12 pStylesheet->AddRef(); 14 pStylesheet->AddRef();
13 } 15 }
14 _FDE_CSSCACHEITEM::~_FDE_CSSCACHEITEM() { 16 _FDE_CSSCACHEITEM::~_FDE_CSSCACHEITEM() {
15 pStylesheet->Release(); 17 pStylesheet->Release();
16 } 18 }
(...skipping 10 matching lines...) Expand all
27 } 29 }
28 m_Stylesheets.clear(); 30 m_Stylesheets.clear();
29 if (m_pFixedStore) { 31 if (m_pFixedStore) {
30 m_pFixedStore->Release(); 32 m_pFixedStore->Release();
31 } 33 }
32 } 34 }
33 void CFDE_CSSStyleSheetCache::AddStyleSheet(const CFX_ByteStringC& szKey, 35 void CFDE_CSSStyleSheetCache::AddStyleSheet(const CFX_ByteStringC& szKey,
34 IFDE_CSSStyleSheet* pStyleSheet) { 36 IFDE_CSSStyleSheet* pStyleSheet) {
35 FXSYS_assert(pStyleSheet != NULL); 37 FXSYS_assert(pStyleSheet != NULL);
36 if (m_pFixedStore == NULL) { 38 if (m_pFixedStore == NULL) {
37 m_pFixedStore = FX_CreateAllocator( 39 m_pFixedStore =
38 FX_ALLOCTYPE_Fixed, FX_MAX(10, m_iMaxItems), sizeof(FDE_CSSCACHEITEM)); 40 FX_CreateAllocator(FX_ALLOCTYPE_Fixed, std::max(10, m_iMaxItems),
41 sizeof(FDE_CSSCACHEITEM));
39 FXSYS_assert(m_pFixedStore != NULL); 42 FXSYS_assert(m_pFixedStore != NULL);
40 } 43 }
41 auto it = m_Stylesheets.find(szKey); 44 auto it = m_Stylesheets.find(szKey);
42 if (it != m_Stylesheets.end()) { 45 if (it != m_Stylesheets.end()) {
43 FDE_LPCSSCACHEITEM pItem = it->second; 46 FDE_LPCSSCACHEITEM pItem = it->second;
44 if (pItem->pStylesheet != pStyleSheet) { 47 if (pItem->pStylesheet != pStyleSheet) {
45 pItem->pStylesheet->Release(); 48 pItem->pStylesheet->Release();
46 pItem->pStylesheet = pStyleSheet; 49 pItem->pStylesheet = pStyleSheet;
47 pItem->pStylesheet->AddRef(); 50 pItem->pStylesheet->AddRef();
48 pItem->dwActivity = 0; 51 pItem->dwActivity = 0;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 void CFDE_CSSAccelerator::OnEnterTag(IFDE_CSSTagProvider* pTag) { 138 void CFDE_CSSAccelerator::OnEnterTag(IFDE_CSSTagProvider* pTag) {
136 FDE_CSSTAGCACHE* pTop = GetTopElement(); 139 FDE_CSSTAGCACHE* pTop = GetTopElement();
137 FDE_CSSTAGCACHE item(pTop, pTag); 140 FDE_CSSTAGCACHE item(pTop, pTag);
138 m_Stack.Push(item); 141 m_Stack.Push(item);
139 } 142 }
140 void CFDE_CSSAccelerator::OnLeaveTag(IFDE_CSSTagProvider* pTag) { 143 void CFDE_CSSAccelerator::OnLeaveTag(IFDE_CSSTagProvider* pTag) {
141 FDE_CSSTAGCACHE* pItem = m_Stack.GetTopElement(); 144 FDE_CSSTAGCACHE* pItem = m_Stack.GetTopElement();
142 FXSYS_assert(pItem && pItem->GetTag() == pTag); 145 FXSYS_assert(pItem && pItem->GetTag() == pTag);
143 m_Stack.Pop(); 146 m_Stack.Pop();
144 } 147 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_Utils.cpp ('k') | xfa/src/fdp/src/fde/fde_gedevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698