diff options
author | Lei Zhang <thestig@chromium.org> | 2015-10-08 15:14:24 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-10-08 15:14:24 -0700 |
commit | 921cc2403a9e643dfb29d70564fa435a1d79f972 (patch) | |
tree | 005543a896eb07b52a416abc2bc681d286fc24db /core/src/fxcodec/jbig2/JBig2_BitStream.cpp | |
parent | d1cb813d23df38a8e21df3314658995ded7c4b45 (diff) | |
download | pdfium-921cc2403a9e643dfb29d70564fa435a1d79f972.tar.xz |
Merge to XFA: Various changes to JBig2 cache:
- Makes the cache be per-document
- Keys the cache on ObjNum and stream offset instead of keying on a pointer to the data (which can result in false cache hits).
- Makes it so the cache is only used for the globals stream.
- Reenable the cache.
R=dml@google.com
TBR=dml@google.com
BUG=pdfium:207
Review URL: https://codereview.chromium.org/1380243004 .
(cherry picked from commit f1b88e76134808f36f16b9e53a2e9dd89b12c8fd)
Review URL: https://codereview.chromium.org/1394373002 .
Diffstat (limited to 'core/src/fxcodec/jbig2/JBig2_BitStream.cpp')
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_BitStream.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/src/fxcodec/jbig2/JBig2_BitStream.cpp b/core/src/fxcodec/jbig2/JBig2_BitStream.cpp index 4a4ed992c7..f39a396e71 100644 --- a/core/src/fxcodec/jbig2/JBig2_BitStream.cpp +++ b/core/src/fxcodec/jbig2/JBig2_BitStream.cpp @@ -4,12 +4,18 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "../../../include/fpdfapi/fpdf_objects.h" #include "JBig2_BitStream.h" #include <algorithm> -CJBig2_BitStream::CJBig2_BitStream(const uint8_t* pBuffer, FX_DWORD dwLength) - : m_pBuf(pBuffer), m_dwLength(dwLength), m_dwByteIdx(0), m_dwBitIdx(0) { +CJBig2_BitStream::CJBig2_BitStream(CPDF_StreamAcc* pSrcStream) + : m_pBuf(pSrcStream->GetData()), + m_dwLength(pSrcStream->GetSize()), + m_dwByteIdx(0), + m_dwBitIdx(0), + m_dwObjNum(pSrcStream->GetStream() ? pSrcStream->GetStream()->GetObjNum() + : 0) { if (m_dwLength > 256 * 1024 * 1024) { m_dwLength = 0; m_pBuf = nullptr; @@ -176,3 +182,7 @@ bool CJBig2_BitStream::IsInBound() const { FX_DWORD CJBig2_BitStream::LengthInBits() const { return m_dwLength << 3; } + +FX_DWORD CJBig2_BitStream::getObjNum() const { + return m_dwObjNum; +} |