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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_parser.cpp

Issue 2250163002: Rename async to linearized when parsing (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: review cleanups Created 4 years, 4 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 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/fpdf_parser/include/cpdf_parser.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 if (CPDF_Number* pTable = ToNumber(pDict->GetObjectBy("T"))) 1538 if (CPDF_Number* pTable = ToNumber(pDict->GetObjectBy("T")))
1539 m_LastXRefOffset = pTable->GetInteger(); 1539 m_LastXRefOffset = pTable->GetInteger();
1540 1540
1541 return TRUE; 1541 return TRUE;
1542 } 1542 }
1543 m_pLinearized->Release(); 1543 m_pLinearized->Release();
1544 m_pLinearized = nullptr; 1544 m_pLinearized = nullptr;
1545 return FALSE; 1545 return FALSE;
1546 } 1546 }
1547 1547
1548 CPDF_Parser::Error CPDF_Parser::StartAsyncParse( 1548 CPDF_Parser::Error CPDF_Parser::StartLinearizedParse(
1549 IFX_FileRead* pFileAccess, 1549 IFX_FileRead* pFileAccess,
1550 std::unique_ptr<CPDF_Document> pDocument) { 1550 std::unique_ptr<CPDF_Document> pDocument) {
1551 CloseParser(); 1551 CloseParser();
1552 m_bXRefStream = FALSE; 1552 m_bXRefStream = FALSE;
1553 m_LastXRefOffset = 0; 1553 m_LastXRefOffset = 0;
1554 m_bOwnFileRead = true; 1554 m_bOwnFileRead = true;
1555 1555
1556 int32_t offset = GetHeaderOffset(pFileAccess); 1556 int32_t offset = GetHeaderOffset(pFileAccess);
1557 if (offset == -1) 1557 if (offset == -1)
1558 return FORMAT_ERROR; 1558 return FORMAT_ERROR;
(...skipping 23 matching lines...) Expand all
1582 1582
1583 int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size"); 1583 int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size");
1584 if (xrefsize > 0) 1584 if (xrefsize > 0)
1585 ShrinkObjectMap(xrefsize); 1585 ShrinkObjectMap(xrefsize);
1586 } 1586 }
1587 1587
1588 Error eRet = SetEncryptHandler(); 1588 Error eRet = SetEncryptHandler();
1589 if (eRet != SUCCESS) 1589 if (eRet != SUCCESS)
1590 return eRet; 1590 return eRet;
1591 1591
1592 m_pDocument->LoadAsynDoc(m_pLinearized->GetDict()); 1592 m_pDocument->LoadLinearizedDoc(m_pLinearized->GetDict());
1593 if (!m_pDocument->GetRoot() || m_pDocument->GetPageCount() == 0) { 1593 if (!m_pDocument->GetRoot() || m_pDocument->GetPageCount() == 0) {
1594 if (bXRefRebuilt) 1594 if (bXRefRebuilt)
1595 return FORMAT_ERROR; 1595 return FORMAT_ERROR;
1596 1596
1597 ReleaseEncryptHandler(); 1597 ReleaseEncryptHandler();
1598 if (!RebuildCrossRef()) 1598 if (!RebuildCrossRef())
1599 return FORMAT_ERROR; 1599 return FORMAT_ERROR;
1600 1600
1601 eRet = SetEncryptHandler(); 1601 eRet = SetEncryptHandler();
1602 if (eRet != SUCCESS) 1602 if (eRet != SUCCESS)
1603 return eRet; 1603 return eRet;
1604 1604
1605 m_pDocument->LoadAsynDoc(m_pLinearized->GetDict()); 1605 m_pDocument->LoadLinearizedDoc(m_pLinearized->GetDict());
1606 if (!m_pDocument->GetRoot()) 1606 if (!m_pDocument->GetRoot())
1607 return FORMAT_ERROR; 1607 return FORMAT_ERROR;
1608 } 1608 }
1609 1609
1610 if (GetRootObjNum() == 0) { 1610 if (GetRootObjNum() == 0) {
1611 ReleaseEncryptHandler(); 1611 ReleaseEncryptHandler();
1612 if (!RebuildCrossRef() || GetRootObjNum() == 0) 1612 if (!RebuildCrossRef() || GetRootObjNum() == 0)
1613 return FORMAT_ERROR; 1613 return FORMAT_ERROR;
1614 1614
1615 eRet = SetEncryptHandler(); 1615 eRet = SetEncryptHandler();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && 1671 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) &&
1672 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { 1672 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) {
1673 m_LastXRefOffset = 0; 1673 m_LastXRefOffset = 0;
1674 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; 1674 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum;
1675 return FORMAT_ERROR; 1675 return FORMAT_ERROR;
1676 } 1676 }
1677 1677
1678 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; 1678 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum;
1679 return SUCCESS; 1679 return SUCCESS;
1680 } 1680 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_document.cpp ('k') | core/fpdfapi/fpdf_parser/include/cpdf_document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698