Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/fpdfapi/parser/cpdf_data_avail.h" | 7 #include "core/fpdfapi/parser/cpdf_data_avail.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1756 FX_FILESIZE szPageStartPos = 0; | 1756 FX_FILESIZE szPageStartPos = 0; |
| 1757 FX_FILESIZE szPageLength = 0; | 1757 FX_FILESIZE szPageLength = 0; |
| 1758 uint32_t dwObjNum = 0; | 1758 uint32_t dwObjNum = 0; |
| 1759 const bool bPagePosGot = m_pHintTables->GetPagePos(index, &szPageStartPos, | 1759 const bool bPagePosGot = m_pHintTables->GetPagePos(index, &szPageStartPos, |
| 1760 &szPageLength, &dwObjNum); | 1760 &szPageLength, &dwObjNum); |
| 1761 if (!bPagePosGot || !dwObjNum) | 1761 if (!bPagePosGot || !dwObjNum) |
| 1762 return nullptr; | 1762 return nullptr; |
| 1763 // We should say to the document, which object is the page. | 1763 // We should say to the document, which object is the page. |
| 1764 m_pDocument->SetPageObjNum(index, dwObjNum); | 1764 m_pDocument->SetPageObjNum(index, dwObjNum); |
| 1765 // Page object already can be parsed in document. | 1765 // Page object already can be parsed in document. |
| 1766 CPDF_Object* pPageDict = m_pDocument->GetIndirectObject(dwObjNum); | 1766 if (!m_pDocument->GetIndirectObject(dwObjNum)) { |
| 1767 if (!pPageDict) { | |
| 1768 m_syntaxParser.InitParser(m_pFileRead, (uint32_t)szPageStartPos); | 1767 m_syntaxParser.InitParser(m_pFileRead, (uint32_t)szPageStartPos); |
| 1769 pPageDict = ParseIndirectObjectAt(0, dwObjNum, m_pDocument); | 1768 m_pDocument->ReplaceIndirectObjectIfHigherGeneration( |
| 1770 if (pPageDict) { | 1769 dwObjNum, pdfium::WrapUnique<CPDF_Object>( |
|
Tom Sepez
2016/11/04 19:25:29
RIOIHG() does this check for us.
| |
| 1771 m_pDocument->ReplaceIndirectObjectIfHigherGeneration(dwObjNum, pPageDict); | 1770 ParseIndirectObjectAt(0, dwObjNum, m_pDocument))); |
| 1772 } | |
| 1773 } | 1771 } |
| 1774 return m_pDocument->GetPage(index); | 1772 return m_pDocument->GetPage(index); |
| 1775 } | 1773 } |
| 1776 | 1774 |
| 1777 CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( | 1775 CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( |
| 1778 DownloadHints* pHints) { | 1776 DownloadHints* pHints) { |
| 1779 if (!m_pDocument) | 1777 if (!m_pDocument) |
| 1780 return FormAvailable; | 1778 return FormAvailable; |
| 1781 | 1779 |
| 1782 if (!m_bLinearizedFormParamLoad) { | 1780 if (!m_bLinearizedFormParamLoad) { |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1809 return FormAvailable; | 1807 return FormAvailable; |
| 1810 } | 1808 } |
| 1811 | 1809 |
| 1812 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} | 1810 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} |
| 1813 | 1811 |
| 1814 CPDF_DataAvail::PageNode::~PageNode() { | 1812 CPDF_DataAvail::PageNode::~PageNode() { |
| 1815 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) | 1813 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) |
| 1816 delete m_childNode[i]; | 1814 delete m_childNode[i]; |
| 1817 m_childNode.RemoveAll(); | 1815 m_childNode.RemoveAll(); |
| 1818 } | 1816 } |
| OLD | NEW |