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

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

Issue 2386273004: Add ptr_util.h from base until std::make_unique<> available (Closed)
Patch Set: 2016 Created 4 years, 2 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
« no previous file with comments | « core/fpdfapi/fpdf_parser/cfdf_document.cpp ('k') | core/fpdfdoc/cpdf_annot.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/fpdfapi/fpdf_parser/cpdf_document.h" 7 #include "core/fpdfapi/fpdf_parser/cpdf_document.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 #include <vector> 11 #include <vector>
12 12
13 #include "core/fpdfapi/cpdf_modulemgr.h" 13 #include "core/fpdfapi/cpdf_modulemgr.h"
14 #include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h" 14 #include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h"
15 #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" 15 #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h"
16 #include "core/fpdfapi/fpdf_page/pageint.h" 16 #include "core/fpdfapi/fpdf_page/pageint.h"
17 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" 17 #include "core/fpdfapi/fpdf_parser/cpdf_array.h"
18 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" 18 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h"
19 #include "core/fpdfapi/fpdf_parser/cpdf_parser.h" 19 #include "core/fpdfapi/fpdf_parser/cpdf_parser.h"
20 #include "core/fpdfapi/fpdf_parser/cpdf_reference.h" 20 #include "core/fpdfapi/fpdf_parser/cpdf_reference.h"
21 #include "core/fpdfapi/fpdf_parser/cpdf_stream.h" 21 #include "core/fpdfapi/fpdf_parser/cpdf_stream.h"
22 #include "core/fpdfapi/fpdf_render/render_int.h" 22 #include "core/fpdfapi/fpdf_render/render_int.h"
23 #include "core/fxcodec/JBig2_DocumentContext.h" 23 #include "core/fxcodec/JBig2_DocumentContext.h"
24 #include "core/fxge/cfx_unicodeencoding.h" 24 #include "core/fxge/cfx_unicodeencoding.h"
25 #include "core/fxge/fx_font.h" 25 #include "core/fxge/fx_font.h"
26 #include "third_party/base/ptr_util.h"
26 #include "third_party/base/stl_util.h" 27 #include "third_party/base/stl_util.h"
27 28
28 namespace { 29 namespace {
29 30
30 const int FX_MAX_PAGE_LEVEL = 1024; 31 const int FX_MAX_PAGE_LEVEL = 1024;
31 32
32 const uint16_t g_FX_CP874Unicodes[128] = { 33 const uint16_t g_FX_CP874Unicodes[128] = {
33 0x20AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x2026, 0x0000, 0x0000, 0x0000, 34 0x20AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x2026, 0x0000, 0x0000, 0x0000,
34 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2018, 35 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2018,
35 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x0000, 0x0000, 36 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x0000, 0x0000,
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 CPDF_Document::CPDF_Document(std::unique_ptr<CPDF_Parser> pParser) 409 CPDF_Document::CPDF_Document(std::unique_ptr<CPDF_Parser> pParser)
409 : CPDF_IndirectObjectHolder(), 410 : CPDF_IndirectObjectHolder(),
410 m_pParser(std::move(pParser)), 411 m_pParser(std::move(pParser)),
411 m_pRootDict(nullptr), 412 m_pRootDict(nullptr),
412 m_pInfoDict(nullptr), 413 m_pInfoDict(nullptr),
413 m_bLinearized(false), 414 m_bLinearized(false),
414 m_iFirstPageNo(0), 415 m_iFirstPageNo(0),
415 m_dwFirstPageObjNum(0), 416 m_dwFirstPageObjNum(0),
416 m_pDocPage(new CPDF_DocPageData(this)), 417 m_pDocPage(new CPDF_DocPageData(this)),
417 m_pDocRender(new CPDF_DocRenderData(this)), 418 m_pDocRender(new CPDF_DocRenderData(this)),
418 m_pByteStringPool(WrapUnique(new CFX_ByteStringPool)) { 419 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) {
419 if (pParser) 420 if (pParser)
420 SetLastObjNum(m_pParser->GetLastObjNum()); 421 SetLastObjNum(m_pParser->GetLastObjNum());
421 } 422 }
422 423
423 CPDF_Document::~CPDF_Document() { 424 CPDF_Document::~CPDF_Document() {
424 delete m_pDocPage; 425 delete m_pDocPage;
425 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); 426 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this);
426 m_pByteStringPool.Clear(); // Make weak. 427 m_pByteStringPool.Clear(); // Make weak.
427 } 428 }
428 429
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 pBBox, pLogFont->lfWeight / 5); 1011 pBBox, pLogFont->lfWeight / 5);
1011 pFontDesc->SetIntegerFor("CapHeight", capheight); 1012 pFontDesc->SetIntegerFor("CapHeight", capheight);
1012 pFontDict->SetReferenceFor("FontDescriptor", this, 1013 pFontDict->SetReferenceFor("FontDescriptor", this,
1013 AddIndirectObject(pFontDesc)); 1014 AddIndirectObject(pFontDesc));
1014 hFont = SelectObject(hDC, hFont); 1015 hFont = SelectObject(hDC, hFont);
1015 DeleteObject(hFont); 1016 DeleteObject(hFont);
1016 DeleteDC(hDC); 1017 DeleteDC(hDC);
1017 return LoadFont(pBaseDict); 1018 return LoadFont(pBaseDict);
1018 } 1019 }
1019 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 1020 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cfdf_document.cpp ('k') | core/fpdfdoc/cpdf_annot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698