diff options
author | Ryan Harrison <rharrison@chromium.org> | 2018-09-12 19:09:06 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-09-12 19:09:06 +0000 |
commit | 5b9a0a9c12960e303d312656da4d49c8997b617d (patch) | |
tree | d3911fc466227fc2d94d3f743b47c42bf60142f3 /core/fpdfapi/font/cpdf_cmap.h | |
parent | 987416db22712d0b5c666be08a148946ce4b9bdb (diff) | |
download | pdfium-5b9a0a9c12960e303d312656da4d49c8997b617d.tar.xz |
Optimize CPDF_CMapParser
In this parser, a vector of CodeRange values are built up during
operations that need to be sync'd with the CPDF_CMap that is being
initialized. In the existing implementation, the vector being built as
a member var for the parser, and copying the values over to the cmap
whenever there is a change. When profiling, this copy is where the code
spends most of its time.
The code has been rewritten to have the parser reference/modify the
instance of the vector in the cmap instead of having its own copy. This
removes all of the copies and significantly speeds things up.
BUG=chromium:881678
Change-Id: Ib8e75962507ca3d3b1ed066fd1faa4fbb7141122
Reviewed-on: https://pdfium-review.googlesource.com/42350
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi/font/cpdf_cmap.h')
-rw-r--r-- | core/fpdfapi/font/cpdf_cmap.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/fpdfapi/font/cpdf_cmap.h b/core/fpdfapi/font/cpdf_cmap.h index 228c207876..68ad26cfa3 100644 --- a/core/fpdfapi/font/cpdf_cmap.h +++ b/core/fpdfapi/font/cpdf_cmap.h @@ -66,8 +66,11 @@ class CPDF_CMap final : public Retainable { void SetVertical(bool vert) { m_bVertical = vert; } void SetCodingScheme(CodingScheme scheme) { m_CodingScheme = scheme; } - void SetMixedFourByteLeadingRanges(std::vector<CodeRange> range) { - m_MixedFourByteLeadingRanges = range; + const std::vector<CodeRange>& GetMixedFourByteLeadingRanges() { + return m_MixedFourByteLeadingRanges; + } + void AppendMixedFourByteLeadingRanges(const CodeRange& range) { + m_MixedFourByteLeadingRanges.push_back(range); } int GetCoding() const { return m_Coding; } |