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

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

Issue 1092033004: Merge to XFA: Remove Release() combo patch. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 8 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
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 "pageint.h" 9 #include "pageint.h"
10 void CPDF_PageObject::Release()
11 {
12 delete this;
13 }
14 CPDF_PageObject* CPDF_PageObject::Create(int type) 10 CPDF_PageObject* CPDF_PageObject::Create(int type)
15 { 11 {
16 switch (type) { 12 switch (type) {
17 case PDFPAGE_TEXT: 13 case PDFPAGE_TEXT:
18 return FX_NEW CPDF_TextObject; 14 return FX_NEW CPDF_TextObject;
19 case PDFPAGE_IMAGE: 15 case PDFPAGE_IMAGE:
20 return FX_NEW CPDF_ImageObject; 16 return FX_NEW CPDF_ImageObject;
21 case PDFPAGE_PATH: 17 case PDFPAGE_PATH:
22 return FX_NEW CPDF_PathObject; 18 return FX_NEW CPDF_PathObject;
23 case PDFPAGE_SHADING: 19 case PDFPAGE_SHADING:
24 return FX_NEW CPDF_ShadingObject; 20 return FX_NEW CPDF_ShadingObject;
25 case PDFPAGE_FORM: 21 case PDFPAGE_FORM:
26 return FX_NEW CPDF_FormObject; 22 return FX_NEW CPDF_FormObject;
27 } 23 }
28 return NULL; 24 return NULL;
29 } 25 }
26 CPDF_PageObject::~CPDF_PageObject()
27 {
28 }
30 CPDF_PageObject* CPDF_PageObject::Clone() const 29 CPDF_PageObject* CPDF_PageObject::Clone() const
31 { 30 {
32 CPDF_PageObject* pObj = Create(m_Type); 31 CPDF_PageObject* pObj = Create(m_Type);
33 pObj->Copy(this); 32 pObj->Copy(this);
34 return pObj; 33 return pObj;
35 } 34 }
36 void CPDF_PageObject::Copy(const CPDF_PageObject* pSrc) 35 void CPDF_PageObject::Copy(const CPDF_PageObject* pSrc)
37 { 36 {
38 if (m_Type != pSrc->m_Type) { 37 if (m_Type != pSrc->m_Type) {
39 return; 38 return;
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 CPDF_PageObjects::~CPDF_PageObjects() 681 CPDF_PageObjects::~CPDF_PageObjects()
683 { 682 {
684 if (m_pParser) { 683 if (m_pParser) {
685 delete m_pParser; 684 delete m_pParser;
686 } 685 }
687 if (!m_bReleaseMembers) { 686 if (!m_bReleaseMembers) {
688 return; 687 return;
689 } 688 }
690 FX_POSITION pos = m_ObjectList.GetHeadPosition(); 689 FX_POSITION pos = m_ObjectList.GetHeadPosition();
691 while (pos) { 690 while (pos) {
692 CPDF_PageObject* pPageObj = (CPDF_PageObject*)m_ObjectList.GetNext(pos); 691 delete (CPDF_PageObject*)m_ObjectList.GetNext(pos);
693 if (!pPageObj) {
694 continue;
695 }
696 pPageObj->Release();
697 } 692 }
698 } 693 }
699 void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause) 694 void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause)
700 { 695 {
701 if (m_pParser == NULL) { 696 if (m_pParser == NULL) {
702 return; 697 return;
703 } 698 }
704 m_pParser->Continue(pPause); 699 m_pParser->Continue(pPause);
705 if (m_pParser->GetStatus() == CPDF_ContentParser::Done) { 700 if (m_pParser->GetStatus() == CPDF_ContentParser::Done) {
706 m_ParseState = PDF_CONTENT_PARSED; 701 m_ParseState = PDF_CONTENT_PARSED;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 void CPDF_PageObjects::ClearCacheObjects() 796 void CPDF_PageObjects::ClearCacheObjects()
802 { 797 {
803 m_ParseState = PDF_CONTENT_NOT_PARSED; 798 m_ParseState = PDF_CONTENT_NOT_PARSED;
804 if (m_pParser) { 799 if (m_pParser) {
805 delete m_pParser; 800 delete m_pParser;
806 } 801 }
807 m_pParser = NULL; 802 m_pParser = NULL;
808 if (m_bReleaseMembers) { 803 if (m_bReleaseMembers) {
809 FX_POSITION pos = m_ObjectList.GetHeadPosition(); 804 FX_POSITION pos = m_ObjectList.GetHeadPosition();
810 while (pos) { 805 while (pos) {
811 CPDF_PageObject* pPageObj = (CPDF_PageObject*)m_ObjectList.GetNext(p os); 806 delete (CPDF_PageObject*)m_ObjectList.GetNext(pos);
812 if (!pPageObj) {
813 continue;
814 }
815 pPageObj->Release();
816 } 807 }
817 } 808 }
818 m_ObjectList.RemoveAll(); 809 m_ObjectList.RemoveAll();
819 } 810 }
820 CPDF_Page::CPDF_Page() 811 CPDF_Page::CPDF_Page()
821 { 812 {
822 m_pPageRender = NULL; 813 m_pPageRender = NULL;
823 } 814 }
824 void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, FX_BO OL bPageCache) 815 void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, FX_BO OL bPageCache)
825 { 816 {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 matrix = m_PageMatrix; 1022 matrix = m_PageMatrix;
1032 matrix.Concat(display_matrix); 1023 matrix.Concat(display_matrix);
1033 } 1024 }
1034 CPDF_ParseOptions::CPDF_ParseOptions() 1025 CPDF_ParseOptions::CPDF_ParseOptions()
1035 { 1026 {
1036 m_bTextOnly = FALSE; 1027 m_bTextOnly = FALSE;
1037 m_bMarkedContent = TRUE; 1028 m_bMarkedContent = TRUE;
1038 m_bSeparateForm = TRUE; 1029 m_bSeparateForm = TRUE;
1039 m_bDecodeInlineImage = FALSE; 1030 m_bDecodeInlineImage = FALSE;
1040 } 1031 }
OLDNEW
« no previous file with comments | « core/include/fpdfapi/fpdf_pageobj.h ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698