Use FixedUninitDataVector in CFX_FontMapper and CFX_FontMgr.
This is a reland of https://pdfium-review.googlesource.com/97691.
By introducing a simple FixedUninitDataVector that does not have slow
downs from initializing its data, this avoids the performance issues
that affected the first iteration of this CL.
Also removed the now unused CFX_MemoryStream ctor and add some extra
checks to verify font data retrieval worked as expected.
Bug: pdfium:1872
Change-Id: If1e97be6991f033ad6395ad79596cbd3f64767bd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/97976
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/cfx_fontmapper.h b/core/fxge/cfx_fontmapper.h
index e8deaf5..5a3dc23 100644
--- a/core/fxge/cfx_fontmapper.h
+++ b/core/fxge/cfx_fontmapper.h
@@ -14,12 +14,15 @@
#include "build/build_config.h"
#include "core/fxcrt/bytestring.h"
#include "core/fxcrt/fx_codepage_forward.h"
-#include "core/fxcrt/fx_memory_wrappers.h"
#include "core/fxcrt/retain_ptr.h"
#include "core/fxcrt/unowned_ptr.h"
#include "core/fxge/cfx_face.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
+#ifdef PDF_ENABLE_XFA
+#include "core/fxcrt/fixed_uninit_data_vector.h"
+#endif
+
class CFX_FontMgr;
class CFX_SubstFont;
class SystemFontInfoIface;
@@ -85,9 +88,7 @@
#ifdef PDF_ENABLE_XFA
// `index` must be less than GetFaceSize().
- std::unique_ptr<uint8_t, FxFreeDeleter> RawBytesForIndex(
- size_t index,
- size_t* returned_length);
+ FixedUninitDataVector<uint8_t> RawBytesForIndex(size_t index);
#endif // PDF_ENABLE_XFA
private: