X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2Fpdfium%2Fcore%2Fsrc%2Ffpdfapi%2Ffpdf_page%2Ffpdf_page_doc.cpp;h=fe5665d1fb8119da8662ddd66e8ba95d221b3140;hb=f5180d0a4dfe13ef74567dc9aa75047c1a9cd6de;hp=8e578f6f8f2eb0d6bb7b49f876ee48c5c3525a20;hpb=669bbc0a54393464248e6bac22558cda42a9a350;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/pdfium/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/src/third_party/pdfium/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp index 8e578f6..fe5665d 100644 --- a/src/third_party/pdfium/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/src/third_party/pdfium/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -147,15 +147,52 @@ CPDF_DocPageData::~CPDF_DocPageData() { Clear(FALSE); Clear(TRUE); + FX_POSITION pos = m_PatternMap.GetStartPosition(); + while (pos) + { + CPDF_Object* ptObj; + CPDF_CountedObject* ptData; + m_PatternMap.GetNextAssoc(pos, ptObj, ptData); + delete ptData; + } + m_PatternMap.RemoveAll(); + pos = m_FontMap.GetStartPosition(); + while (pos) + { + CPDF_Dictionary* fontDict; + CPDF_CountedObject* fontData; + m_FontMap.GetNextAssoc(pos, fontDict, fontData); + delete fontData; + } + m_FontMap.RemoveAll(); + pos = m_ColorSpaceMap.GetStartPosition(); + while (pos) + { + CPDF_Object* csKey; + CPDF_CountedObject* csData; + m_ColorSpaceMap.GetNextAssoc(pos, csKey, csData); + delete csData; + } + m_ColorSpaceMap.RemoveAll(); } void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) { FX_POSITION pos; - m_bForceClear = bForceRelease; - - // Release objects saved in the resource maps like font map and color space map. - // The compound objects shall be released before simple ones. + pos = m_PatternMap.GetStartPosition(); + while (pos) { + CPDF_Object* ptObj; + CPDF_CountedObject* ptData; + m_PatternMap.GetNextAssoc(pos, ptObj, ptData); + if (!ptData->m_Obj) { + continue; + } + if (bForceRelease || ptData->m_nCount < 2) { + ptData->m_Obj->SetForceClear(bForceRelease); + delete ptData->m_Obj; + ptData->m_Obj = NULL; + } + } pos = m_FontMap.GetStartPosition(); while (pos) { CPDF_Dictionary* fontDict; @@ -203,7 +240,6 @@ void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) } } delete ipData->m_Obj; - ipData->m_Obj = NULL; delete ipData; m_IccProfileMap.RemoveKey(ipKey); } @@ -218,25 +254,10 @@ void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) } if (bForceRelease || ftData->m_nCount < 2) { delete ftData->m_Obj; - ftData->m_Obj = NULL; delete ftData; m_FontFileMap.RemoveKey(ftKey); } } - pos = m_PatternMap.GetStartPosition(); - while (pos) { - CPDF_Object* ptObj; - CPDF_CountedObject* ptData; - m_PatternMap.GetNextAssoc(pos, ptObj, ptData); - if (!ptData->m_Obj) { - continue; - } - if (bForceRelease || ptData->m_nCount < 2) { - ptData->m_Obj->SetForceClear(bForceRelease); - delete ptData->m_Obj; - ptData->m_Obj = NULL; - } - } pos = m_ImageMap.GetStartPosition(); while (pos) { FX_DWORD objNum; @@ -247,7 +268,6 @@ void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) } if (bForceRelease || imageData->m_nCount < 2) { delete imageData->m_Obj; - imageData->m_Obj = NULL; delete imageData; m_ImageMap.RemoveKey(objNum); } @@ -653,4 +673,24 @@ void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOO return; } PDF_DocPageData_Release(m_FontFileMap, pFontStream, NULL, bForce); +} +CPDF_CountedColorSpace* CPDF_DocPageData::FindColorSpacePtr(CPDF_Object* pCSObj) const +{ + if (!pCSObj) return NULL; + CPDF_CountedObject* csData; + if (m_ColorSpaceMap.Lookup(pCSObj, csData)) + { + return csData; + } + return NULL; } +CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr(CPDF_Object* pPatternObj) const +{ + if (!pPatternObj) return NULL; + CPDF_CountedObject* ptData; + if (m_PatternMap.Lookup(pPatternObj, ptData)) + { + return ptData; + } + return NULL; +}