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

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

Issue 1093213002: Remove Release() from CPDF_PageObject (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
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 new CPDF_TextObject; 14 return new CPDF_TextObject;
19 case PDFPAGE_IMAGE: 15 case PDFPAGE_IMAGE:
20 return new CPDF_ImageObject; 16 return new CPDF_ImageObject;
21 case PDFPAGE_PATH: 17 case PDFPAGE_PATH:
22 return new CPDF_PathObject; 18 return new CPDF_PathObject;
23 case PDFPAGE_SHADING: 19 case PDFPAGE_SHADING:
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 CPDF_PageObjects::~CPDF_PageObjects() 678 CPDF_PageObjects::~CPDF_PageObjects()
683 { 679 {
684 if (m_pParser) { 680 if (m_pParser) {
685 delete m_pParser; 681 delete m_pParser;
686 } 682 }
687 if (!m_bReleaseMembers) { 683 if (!m_bReleaseMembers) {
688 return; 684 return;
689 } 685 }
690 FX_POSITION pos = m_ObjectList.GetHeadPosition(); 686 FX_POSITION pos = m_ObjectList.GetHeadPosition();
691 while (pos) { 687 while (pos) {
692 CPDF_PageObject* pPageObj = (CPDF_PageObject*)m_ObjectList.GetNext(pos); 688 delete (CPDF_PageObject*)m_ObjectList.GetNext(pos);
693 if (!pPageObj) {
694 continue;
695 }
696 pPageObj->Release();
697 } 689 }
698 } 690 }
699 void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause) 691 void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause)
700 { 692 {
701 if (m_pParser == NULL) { 693 if (m_pParser == NULL) {
702 return; 694 return;
703 } 695 }
704 m_pParser->Continue(pPause); 696 m_pParser->Continue(pPause);
705 if (m_pParser->GetStatus() == CPDF_ContentParser::Done) { 697 if (m_pParser->GetStatus() == CPDF_ContentParser::Done) {
706 m_ParseState = PDF_CONTENT_PARSED; 698 m_ParseState = PDF_CONTENT_PARSED;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 void CPDF_PageObjects::ClearCacheObjects() 793 void CPDF_PageObjects::ClearCacheObjects()
802 { 794 {
803 m_ParseState = PDF_CONTENT_NOT_PARSED; 795 m_ParseState = PDF_CONTENT_NOT_PARSED;
804 if (m_pParser) { 796 if (m_pParser) {
805 delete m_pParser; 797 delete m_pParser;
806 } 798 }
807 m_pParser = NULL; 799 m_pParser = NULL;
808 if (m_bReleaseMembers) { 800 if (m_bReleaseMembers) {
809 FX_POSITION pos = m_ObjectList.GetHeadPosition(); 801 FX_POSITION pos = m_ObjectList.GetHeadPosition();
810 while (pos) { 802 while (pos) {
811 CPDF_PageObject* pPageObj = (CPDF_PageObject*)m_ObjectList.GetNext(p os); 803 delete (CPDF_PageObject*)m_ObjectList.GetNext(pos);
812 if (!pPageObj) {
813 continue;
814 }
815 pPageObj->Release();
816 } 804 }
817 } 805 }
818 m_ObjectList.RemoveAll(); 806 m_ObjectList.RemoveAll();
819 } 807 }
820 CPDF_Page::CPDF_Page() 808 CPDF_Page::CPDF_Page()
821 { 809 {
822 m_pPageRender = NULL; 810 m_pPageRender = NULL;
823 } 811 }
824 void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, FX_BO OL bPageCache) 812 void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, FX_BO OL bPageCache)
825 { 813 {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 matrix = m_PageMatrix; 1019 matrix = m_PageMatrix;
1032 matrix.Concat(display_matrix); 1020 matrix.Concat(display_matrix);
1033 } 1021 }
1034 CPDF_ParseOptions::CPDF_ParseOptions() 1022 CPDF_ParseOptions::CPDF_ParseOptions()
1035 { 1023 {
1036 m_bTextOnly = FALSE; 1024 m_bTextOnly = FALSE;
1037 m_bMarkedContent = TRUE; 1025 m_bMarkedContent = TRUE;
1038 m_bSeparateForm = TRUE; 1026 m_bSeparateForm = TRUE;
1039 m_bDecodeInlineImage = FALSE; 1027 m_bDecodeInlineImage = FALSE;
1040 } 1028 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698