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

Unified Diff: core/fxcodec/jbig2/JBig2_Context.h

Issue 2149903002: Use smart pointers for various Jbig2 decoding contexts (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxcodec/codec/fx_codec_jbig.cpp ('k') | core/fxcodec/jbig2/JBig2_Context.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcodec/jbig2/JBig2_Context.h
diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h
index 950ad130d7904bb0135b675b0f0cf5ff330bd66b..1577b22d37e6a524136bad22338db2c89fcddc4e 100644
--- a/core/fxcodec/jbig2/JBig2_Context.h
+++ b/core/fxcodec/jbig2/JBig2_Context.h
@@ -10,6 +10,7 @@
#include <list>
#include <memory>
#include <utility>
+#include <vector>
#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h"
#include "core/fxcodec/include/fx_codec_def.h"
@@ -40,13 +41,12 @@ using CJBig2_CachePair = std::pair<CJBig2_CacheKey, CJBig2_SymbolDict*>;
class CJBig2_Context {
public:
- static CJBig2_Context* CreateContext(
- CPDF_StreamAcc* pGlobalStream,
- CPDF_StreamAcc* pSrcStream,
- std::list<CJBig2_CachePair>* pSymbolDictCache,
- IFX_Pause* pPause = nullptr);
-
- static void DestroyContext(CJBig2_Context* pContext);
+ CJBig2_Context(CPDF_StreamAcc* pGlobalStream,
+ CPDF_StreamAcc* pSrcStream,
+ std::list<CJBig2_CachePair>* pSymbolDictCache,
+ IFX_Pause* pPause,
+ bool bIsGlobal);
+ ~CJBig2_Context();
int32_t getFirstPage(uint8_t* pBuf,
int32_t width,
@@ -58,59 +58,36 @@ class CJBig2_Context {
FXCODEC_STATUS GetProcessingStatus() { return m_ProcessingStatus; }
private:
- CJBig2_Context(CPDF_StreamAcc* pGlobalStream,
- CPDF_StreamAcc* pSrcStream,
- std::list<CJBig2_CachePair>* pSymbolDictCache,
- IFX_Pause* pPause,
- bool bIsGlobal);
-
- ~CJBig2_Context();
-
int32_t decode_SquentialOrgnazation(IFX_Pause* pPause);
-
int32_t decode_EmbedOrgnazation(IFX_Pause* pPause);
-
int32_t decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause);
-
int32_t decode_RandomOrgnazation(IFX_Pause* pPause);
CJBig2_Segment* findSegmentByNumber(uint32_t dwNumber);
-
CJBig2_Segment* findReferredSegmentByTypeAndIndex(CJBig2_Segment* pSegment,
uint8_t cType,
int32_t nIndex);
int32_t parseSegmentHeader(CJBig2_Segment* pSegment);
-
int32_t parseSegmentData(CJBig2_Segment* pSegment, IFX_Pause* pPause);
int32_t ProcessingParseSegmentData(CJBig2_Segment* pSegment,
IFX_Pause* pPause);
-
int32_t parseSymbolDict(CJBig2_Segment* pSegment, IFX_Pause* pPause);
-
int32_t parseTextRegion(CJBig2_Segment* pSegment);
-
int32_t parsePatternDict(CJBig2_Segment* pSegment, IFX_Pause* pPause);
-
int32_t parseHalftoneRegion(CJBig2_Segment* pSegment, IFX_Pause* pPause);
-
int32_t parseGenericRegion(CJBig2_Segment* pSegment, IFX_Pause* pPause);
-
int32_t parseGenericRefinementRegion(CJBig2_Segment* pSegment);
-
int32_t parseTable(CJBig2_Segment* pSegment);
-
int32_t parseRegionInfo(JBig2RegionInfo* pRI);
JBig2HuffmanCode* decodeSymbolIDHuffmanTable(CJBig2_BitStream* pStream,
uint32_t SBNUMSYMS);
void huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP);
-
void huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, int NTEMP);
- private:
- CJBig2_Context* m_pGlobalContext;
+ std::unique_ptr<CJBig2_Context> m_pGlobalContext;
std::unique_ptr<CJBig2_BitStream> m_pStream;
CJBig2_List<CJBig2_Segment> m_SegmentList;
CJBig2_List<JBig2PageInfo> m_PageInfoList;
@@ -119,11 +96,11 @@ class CJBig2_Context {
bool m_bInPage;
bool m_bBufSpecified;
int32_t m_PauseStep;
- IFX_Pause* m_pPause;
+ IFX_Pause* const m_pPause;
FXCODEC_STATUS m_ProcessingStatus;
+ std::vector<JBig2ArithCtx> m_gbContext;
std::unique_ptr<CJBig2_ArithDecoder> m_pArithDecoder;
std::unique_ptr<CJBig2_GRDProc> m_pGRD;
- JBig2ArithCtx* m_gbContext;
std::unique_ptr<CJBig2_Segment> m_pSegment;
uint32_t m_dwOffset;
JBig2RegionInfo m_ri;
« no previous file with comments | « core/fxcodec/codec/fx_codec_jbig.cpp ('k') | core/fxcodec/jbig2/JBig2_Context.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698