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

Side by Side Diff: core/fpdfapi/parser/cpdf_stream.h

Issue 2425783002: Revert "Make CPDF_Object containers hold objects via unique pointers." (Closed)
Patch Set: 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/parser/cpdf_reference.h ('k') | core/fpdfapi/parser/fpdf_parser_utility.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 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 #ifndef CORE_FPDFAPI_PARSER_CPDF_STREAM_H_ 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_STREAM_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_STREAM_H_ 8 #define CORE_FPDFAPI_PARSER_CPDF_STREAM_H_
9 9
10 #include <memory> 10 #include <memory>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 uint32_t buf_size) const; 44 uint32_t buf_size) const;
45 45
46 bool IsMemoryBased() const { return m_bMemoryBased; } 46 bool IsMemoryBased() const { return m_bMemoryBased; }
47 47
48 protected: 48 protected:
49 ~CPDF_Stream() override; 49 ~CPDF_Stream() override;
50 CPDF_Object* CloneNonCyclic( 50 CPDF_Object* CloneNonCyclic(
51 bool bDirect, 51 bool bDirect,
52 std::set<const CPDF_Object*>* pVisited) const override; 52 std::set<const CPDF_Object*>* pVisited) const override;
53 53
54 UniqueDictionary m_pDict; 54 std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> m_pDict;
55 bool m_bMemoryBased = true; 55 bool m_bMemoryBased = true;
56 uint32_t m_dwSize = 0; 56 uint32_t m_dwSize = 0;
57 std::unique_ptr<uint8_t, FxFreeDeleter> m_pDataBuf; 57 std::unique_ptr<uint8_t, FxFreeDeleter> m_pDataBuf;
58 IFX_FileRead* m_pFile = nullptr; 58 IFX_FileRead* m_pFile = nullptr;
59 }; 59 };
60 60
61 using UniqueStream = std::unique_ptr<CPDF_Stream, ReleaseDeleter<CPDF_Object>>; 61 using UniqueStream = std::unique_ptr<CPDF_Stream, ReleaseDeleter<CPDF_Object>>;
62 62
63 inline CPDF_Stream* ToStream(CPDF_Object* obj) { 63 inline CPDF_Stream* ToStream(CPDF_Object* obj) {
64 return obj ? obj->AsStream() : nullptr; 64 return obj ? obj->AsStream() : nullptr;
65 } 65 }
66 66
67 inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { 67 inline const CPDF_Stream* ToStream(const CPDF_Object* obj) {
68 return obj ? obj->AsStream() : nullptr; 68 return obj ? obj->AsStream() : nullptr;
69 } 69 }
70 70
71 inline UniqueStream ToStream(UniqueObject obj) { 71 inline UniqueStream ToStream(UniqueObject obj) {
72 CPDF_Stream* pStream = ToStream(obj.get()); 72 CPDF_Stream* pStream = ToStream(obj.get());
73 if (!pStream) 73 if (!pStream)
74 return nullptr; 74 return nullptr;
75 obj.release(); 75 obj.release();
76 return UniqueStream(pStream); 76 return UniqueStream(pStream);
77 } 77 }
78 78
79 #endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_H_ 79 #endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_reference.h ('k') | core/fpdfapi/parser/fpdf_parser_utility.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698