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

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: style 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
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..dfb0083aa758585520f8853322cc8c8a1eb48aa1 100644
--- a/core/fxcodec/jbig2/JBig2_Context.h
+++ b/core/fxcodec/jbig2/JBig2_Context.h
@@ -40,13 +40,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 +57,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 +95,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::unique_ptr<JBig2ArithCtx, FxFreeDeleter> m_gbContext;
Lei Zhang 2016/07/16 01:30:38 vector?
Wei Li 2016/07/18 21:29:35 Done.
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;

Powered by Google App Engine
This is Rietveld 408576698