diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-05-16 16:33:02 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-16 16:33:02 +0000 |
commit | 67268cd0efa2ebd3b27e963718e90b461e9f73b2 (patch) | |
tree | 549be5bfa1c0bac8a53e3a3ccdaebffe2687184b /core/fpdfapi/page/cpdf_contentparser.h | |
parent | 977f9370ea6c8da403ddd73f8c13317520b5bf69 (diff) | |
download | pdfium-67268cd0efa2ebd3b27e963718e90b461e9f73b2.tar.xz |
Cleanup CPDF_ContentParser
This CL cleans up the CPDF_ContentParser code. The m_bIsDone flag has
been removed and a kComplete stage added. Each of the processing methods
returns the next stage instead of setting the internal flag
automatically. The infinite loop is removed for simpler straight line
code.
Change-Id: Id817a5fa054e28c331c68c63ec2c12b369cb0233
Reviewed-on: https://pdfium-review.googlesource.com/32611
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_contentparser.h')
-rw-r--r-- | core/fpdfapi/page/cpdf_contentparser.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/core/fpdfapi/page/cpdf_contentparser.h b/core/fpdfapi/page/cpdf_contentparser.h index d530a1407e..f9b491defa 100644 --- a/core/fpdfapi/page/cpdf_contentparser.h +++ b/core/fpdfapi/page/cpdf_contentparser.h @@ -40,24 +40,26 @@ class CPDF_ContentParser { bool Continue(PauseIndicatorIface* pPause); private: - enum InternalStage { - STAGE_GETCONTENT = 1, - STAGE_PARSE, - STAGE_CHECKCLIP, + enum class Stage : uint8_t { + kGetContent = 1, + kPrepareContent, + kParse, + kCheckClip, + kComplete, }; - void StageGetContent(); - void StageParse(); - void StageCheckClip(); + Stage GetContent(); + Stage PrepareContent(); + Stage Parse(); + Stage CheckClip(); - bool m_bIsDone = false; - InternalStage m_InternalStage; + Stage m_CurrentStage; UnownedPtr<CPDF_PageObjectHolder> const m_pObjectHolder; UnownedPtr<CPDF_Type3Char> m_pType3Char; // Only used when parsing forms. - uint32_t m_nStreams = 0; RetainPtr<CPDF_StreamAcc> m_pSingleStream; std::vector<RetainPtr<CPDF_StreamAcc>> m_StreamArray; MaybeOwned<uint8_t, FxFreeDeleter> m_pData; + uint32_t m_nStreams = 0; uint32_t m_Size = 0; uint32_t m_CurrentOffset = 0; |