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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp

Issue 554913003: Change the forced clear order of CPDF_DocPageData::Clear, and remove m_pDocument in CPDF_Color (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nit Created 6 years, 3 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 | « core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp ('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 "../../../include/fpdfapi/fpdf_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fdrm/fx_crypt.h" 9 #include "../../../include/fdrm/fx_crypt.h"
10 #include "../fpdf_font/font_int.h" 10 #include "../fpdf_font/font_int.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 { 147 {
148 Clear(FALSE); 148 Clear(FALSE);
149 Clear(TRUE); 149 Clear(TRUE);
150 } 150 }
151 void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) 151 void CPDF_DocPageData::Clear(FX_BOOL bForceRelease)
152 { 152 {
153 FX_POSITION pos; 153 FX_POSITION pos;
154 FX_DWORD nCount; 154 FX_DWORD nCount;
155 155
156 m_bForceClear = bForceRelease; 156 m_bForceClear = bForceRelease;
157 pos = m_PatternMap.GetStartPosition();
158 while (pos) {
159 CPDF_Object* ptObj;
160 CPDF_CountedObject<CPDF_Pattern*>* ptData;
161 m_PatternMap.GetNextAssoc(pos, ptObj, ptData);
162 nCount = ptData->m_nCount;
163 if (bForceRelease || nCount < 2) {
164 delete ptData->m_Obj;
165 ptData->m_Obj = NULL;
166 }
167 }
168 pos = m_FontMap.GetStartPosition(); 157 pos = m_FontMap.GetStartPosition();
169 while (pos) { 158 while (pos) {
170 CPDF_Dictionary* fontDict; 159 CPDF_Dictionary* fontDict;
171 CPDF_CountedObject<CPDF_Font*>* fontData; 160 CPDF_CountedObject<CPDF_Font*>* fontData;
172 m_FontMap.GetNextAssoc(pos, fontDict, fontData); 161 m_FontMap.GetNextAssoc(pos, fontDict, fontData);
173 nCount = fontData->m_nCount; 162 nCount = fontData->m_nCount;
174 if (bForceRelease || nCount < 2) { 163 if (bForceRelease || nCount < 2) {
175 delete fontData->m_Obj; 164 delete fontData->m_Obj;
176 fontData->m_Obj = NULL; 165 fontData->m_Obj = NULL;
177 } 166 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 CPDF_Stream* ftKey; 215 CPDF_Stream* ftKey;
227 CPDF_CountedObject<CPDF_StreamAcc*>* ftData; 216 CPDF_CountedObject<CPDF_StreamAcc*>* ftData;
228 m_FontFileMap.GetNextAssoc(pos, ftKey, ftData); 217 m_FontFileMap.GetNextAssoc(pos, ftKey, ftData);
229 nCount = ftData->m_nCount; 218 nCount = ftData->m_nCount;
230 if (bForceRelease || nCount < 2) { 219 if (bForceRelease || nCount < 2) {
231 delete ftData->m_Obj; 220 delete ftData->m_Obj;
232 delete ftData; 221 delete ftData;
233 m_FontFileMap.RemoveKey(ftKey); 222 m_FontFileMap.RemoveKey(ftKey);
234 } 223 }
235 } 224 }
225 pos = m_PatternMap.GetStartPosition();
226 while (pos) {
227 CPDF_Object* ptObj;
228 CPDF_CountedObject<CPDF_Pattern*>* ptData;
229 m_PatternMap.GetNextAssoc(pos, ptObj, ptData);
230 nCount = ptData->m_nCount;
231 if (bForceRelease || nCount < 2) {
232 delete ptData->m_Obj;
233 ptData->m_Obj = NULL;
234 }
235 }
236 } 236 }
237 CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, FX_BOOL findOnl y) 237 CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, FX_BOOL findOnl y)
238 { 238 {
239 if (!pFontDict) { 239 if (!pFontDict) {
240 return NULL; 240 return NULL;
241 } 241 }
242 if (findOnly) { 242 if (findOnly) {
243 CPDF_CountedObject<CPDF_Font*>* fontData; 243 CPDF_CountedObject<CPDF_Font*>* fontData;
244 if (m_FontMap.Lookup(pFontDict, fontData)) { 244 if (m_FontMap.Lookup(pFontDict, fontData)) {
245 if (!fontData->m_Obj) { 245 if (!fontData->m_Obj) {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 m_FontFileMap.SetAt(pFontStream, ftData); 628 m_FontFileMap.SetAt(pFontStream, ftData);
629 return pFontFile; 629 return pFontFile;
630 } 630 }
631 void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOO L bForce) 631 void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOO L bForce)
632 { 632 {
633 if (!pFontStream) { 633 if (!pFontStream) {
634 return; 634 return;
635 } 635 }
636 PDF_DocPageData_Release<CPDF_Stream*, CPDF_StreamAcc*>(m_FontFileMap, pFontS tream, NULL, bForce); 636 PDF_DocPageData_Release<CPDF_Stream*, CPDF_StreamAcc*>(m_FontFileMap, pFontS tream, NULL, bForce);
637 } 637 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698