summaryrefslogtreecommitdiff
path: root/core/fxcrt/cfx_blockbuffer.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-04-24 18:03:27 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-24 18:03:27 +0000
commit6453a67d84dc321a5f28728e04929dc2ff35ff88 (patch)
treee2bc524cf9cea16aff853e4ed7afed11efa8fd20 /core/fxcrt/cfx_blockbuffer.h
parentdf96bf69f22d63a0ab6c5e48556682b0532c3079 (diff)
downloadpdfium-6453a67d84dc321a5f28728e04929dc2ff35ff88.tar.xz
Remove CFX_BlockBufferchromium/3406
This CL removes the usage of CFX_BlockBuffer from CFX_XMLParser. The block buffer has been replaced by a vector which is emptied out after the characters are removed. This should use less memory when parsing XML as the block buffer was previously storing all text characters seen in the file. Change-Id: I89568c664c762bb9feb034348524e5e86c2d9078 Reviewed-on: https://pdfium-review.googlesource.com/31275 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_blockbuffer.h')
-rw-r--r--core/fxcrt/cfx_blockbuffer.h50
1 files changed, 0 insertions, 50 deletions
diff --git a/core/fxcrt/cfx_blockbuffer.h b/core/fxcrt/cfx_blockbuffer.h
deleted file mode 100644
index 1673136643..0000000000
--- a/core/fxcrt/cfx_blockbuffer.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FXCRT_CFX_BLOCKBUFFER_H_
-#define CORE_FXCRT_CFX_BLOCKBUFFER_H_
-
-#include <stdint.h>
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "core/fxcrt/fx_string.h"
-
-class CFX_BlockBuffer {
- public:
- CFX_BlockBuffer();
- ~CFX_BlockBuffer();
-
- bool InitBuffer();
-
- std::pair<wchar_t*, size_t> GetAvailableBlock();
- size_t GetAllocStep() const;
- size_t GetDataLength() const { return m_DataLength; }
- void IncrementDataLength() { m_DataLength++; }
- bool IsEmpty() const { return m_DataLength == 0; }
-
- void Reset(bool bReserveData) {
- if (!bReserveData)
- m_StartPosition = 0;
- m_DataLength = 0;
- }
-
- void SetTextChar(size_t iIndex, wchar_t ch);
- void DeleteTextChars(size_t iCount);
- WideString GetTextData(size_t iStart, size_t iLength) const;
-
- private:
- std::pair<size_t, size_t> TextDataIndex2BufIndex(const size_t iIndex) const;
-
- std::vector<std::unique_ptr<wchar_t, FxFreeDeleter>> m_BlockArray;
- size_t m_DataLength;
- size_t m_BufferSize;
- size_t m_StartPosition;
-};
-
-#endif // CORE_FXCRT_CFX_BLOCKBUFFER_H_