Make FixedSizeDataVector more similar to base::HeapArray.

In base::HeapArray, we have decided that the initialization state
is not part of the type, but rather a consequence of how the vector
was created. This allows a significant reduction in the amount of
test code, for example.

Change-Id: I361e6ea51441937522caca5f05b40e0a5d68aac3
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/115712
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index c47cb0f..f540505 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -23,7 +23,7 @@
 #include "core/fpdfapi/parser/cpdf_dictionary.h"
 #include "core/fpdfapi/parser/cpdf_stream.h"
 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
-#include "core/fxcrt/fixed_uninit_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_safe_types.h"
@@ -662,7 +662,7 @@
     return index;
   }
 
-  FixedUninitDataVector<uint8_t> sub_data(length);
+  auto sub_data = FixedSizeDataVector<uint8_t>::Uninit(length);
   if (!face->GetSfntTable(kGsubTag, sub_data.span())) {
     return index;
   }
diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp
index a830c8b..cad2db8 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -318,14 +318,15 @@
 }
 
 CPDF_CMap::CPDF_CMap(pdfium::span<const uint8_t> spEmbeddedData)
-    : m_DirectCharcodeToCIDTable(kDirectMapTableSize) {
+    : m_DirectCharcodeToCIDTable(
+          FixedSizeDataVector<uint16_t>::Zeroed(kDirectMapTableSize)) {
   CPDF_CMapParser parser(this);
   CPDF_SimpleParser syntax(spEmbeddedData);
   while (true) {
     ByteStringView word = syntax.GetWord();
-    if (word.IsEmpty())
+    if (word.IsEmpty()) {
       break;
-
+    }
     parser.ParseWord(word);
   }
 }
diff --git a/core/fpdfapi/font/cpdf_cmap.h b/core/fpdfapi/font/cpdf_cmap.h
index 5469979..0eb033b 100644
--- a/core/fpdfapi/font/cpdf_cmap.h
+++ b/core/fpdfapi/font/cpdf_cmap.h
@@ -12,7 +12,7 @@
 #include <vector>
 
 #include "core/fpdfapi/font/cpdf_cidfont.h"
-#include "core/fxcrt/fixed_zeroed_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/unowned_ptr.h"
 #include "third_party/base/containers/span.h"
@@ -96,7 +96,7 @@
   CIDCoding m_Coding = CIDCoding::kUNKNOWN;
   std::vector<bool> m_MixedTwoByteLeadingBytes;
   std::vector<CodeRange> m_MixedFourByteLeadingRanges;
-  FixedZeroedDataVector<uint16_t> m_DirectCharcodeToCIDTable;
+  FixedSizeDataVector<uint16_t> m_DirectCharcodeToCIDTable;
   std::vector<CIDRange> m_AdditionalCharcodeToCIDMappings;
   UnownedPtr<const fxcmap::CMap> m_pEmbedMap;
 };
diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp
index efd5e39..f1bb8a9 100644
--- a/core/fpdfapi/page/cpdf_contentparser.cpp
+++ b/core/fpdfapi/page/cpdf_contentparser.cpp
@@ -18,7 +18,7 @@
 #include "core/fpdfapi/parser/cpdf_dictionary.h"
 #include "core/fpdfapi/parser/cpdf_stream.h"
 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
-#include "core/fxcrt/fixed_try_alloc_zeroed_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/fx_safe_types.h"
 #include "core/fxcrt/pauseindicator_iface.h"
 #include "core/fxcrt/span_util.h"
@@ -179,7 +179,7 @@
   }
 
   const size_t buffer_size = safe_size.ValueOrDie();
-  FixedTryAllocZeroedDataVector<uint8_t> buffer(buffer_size);
+  auto buffer = FixedSizeDataVector<uint8_t>::TryZeroed(buffer_size);
   if (buffer.empty()) {
     m_Data.emplace<pdfium::span<const uint8_t>>();
     return Stage::kComplete;
@@ -273,7 +273,8 @@
 }
 
 pdfium::span<const uint8_t> CPDF_ContentParser::GetData() const {
-  if (is_owned())
-    return absl::get<FixedTryAllocZeroedDataVector<uint8_t>>(m_Data).span();
+  if (is_owned()) {
+    return absl::get<FixedSizeDataVector<uint8_t>>(m_Data).span();
+  }
   return absl::get<pdfium::span<const uint8_t>>(m_Data);
 }
diff --git a/core/fpdfapi/page/cpdf_contentparser.h b/core/fpdfapi/page/cpdf_contentparser.h
index e2660e2..059992c 100644
--- a/core/fpdfapi/page/cpdf_contentparser.h
+++ b/core/fpdfapi/page/cpdf_contentparser.h
@@ -14,7 +14,7 @@
 
 #include "core/fpdfapi/page/cpdf_form.h"
 #include "core/fpdfapi/page/cpdf_streamcontentparser.h"
-#include "core/fxcrt/fixed_try_alloc_zeroed_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/unowned_ptr.h"
 #include "third_party/abseil-cpp/absl/types/variant.h"
@@ -64,8 +64,7 @@
   void HandlePageContentFailure();
 
   bool is_owned() const {
-    return absl::holds_alternative<FixedTryAllocZeroedDataVector<uint8_t>>(
-        m_Data);
+    return absl::holds_alternative<FixedSizeDataVector<uint8_t>>(m_Data);
   }
   pdfium::span<const uint8_t> GetData() const;
 
@@ -75,8 +74,7 @@
   RetainPtr<CPDF_StreamAcc> m_pSingleStream;
   std::vector<RetainPtr<CPDF_StreamAcc>> m_StreamArray;
   std::vector<uint32_t> m_StreamSegmentOffsets;
-  absl::variant<pdfium::span<const uint8_t>,
-                FixedTryAllocZeroedDataVector<uint8_t>>
+  absl::variant<pdfium::span<const uint8_t>, FixedSizeDataVector<uint8_t>>
       m_Data;
   uint32_t m_nStreams = 0;
   uint32_t m_CurrentOffset = 0;
diff --git a/core/fpdfapi/page/cpdf_transferfunc.cpp b/core/fpdfapi/page/cpdf_transferfunc.cpp
index f7aa5e5..996af23 100644
--- a/core/fpdfapi/page/cpdf_transferfunc.cpp
+++ b/core/fpdfapi/page/cpdf_transferfunc.cpp
@@ -12,14 +12,14 @@
 
 #include "core/fpdfapi/page/cpdf_transferfuncdib.h"
 #include "core/fpdfapi/parser/cpdf_document.h"
-#include "core/fxcrt/fixed_uninit_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxge/dib/cfx_dibbase.h"
 #include "third_party/base/check_op.h"
 
 CPDF_TransferFunc::CPDF_TransferFunc(bool bIdentify,
-                                     FixedUninitDataVector<uint8_t> samples_r,
-                                     FixedUninitDataVector<uint8_t> samples_g,
-                                     FixedUninitDataVector<uint8_t> samples_b)
+                                     FixedSizeDataVector<uint8_t> samples_r,
+                                     FixedSizeDataVector<uint8_t> samples_g,
+                                     FixedSizeDataVector<uint8_t> samples_b)
     : m_bIdentity(bIdentify),
       m_SamplesR(std::move(samples_r)),
       m_SamplesG(std::move(samples_g)),
diff --git a/core/fpdfapi/page/cpdf_transferfunc.h b/core/fpdfapi/page/cpdf_transferfunc.h
index 11ea98d..9ac22f3 100644
--- a/core/fpdfapi/page/cpdf_transferfunc.h
+++ b/core/fpdfapi/page/cpdf_transferfunc.h
@@ -9,7 +9,7 @@
 
 #include <stdint.h>
 
-#include "core/fxcrt/fixed_uninit_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/observed_ptr.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/dib/fx_dib.h"
@@ -35,15 +35,15 @@
 
  private:
   CPDF_TransferFunc(bool bIdentify,
-                    FixedUninitDataVector<uint8_t> samples_r,
-                    FixedUninitDataVector<uint8_t> samples_g,
-                    FixedUninitDataVector<uint8_t> samples_b);
+                    FixedSizeDataVector<uint8_t> samples_r,
+                    FixedSizeDataVector<uint8_t> samples_g,
+                    FixedSizeDataVector<uint8_t> samples_b);
   ~CPDF_TransferFunc() override;
 
   const bool m_bIdentity;
-  const FixedUninitDataVector<uint8_t> m_SamplesR;
-  const FixedUninitDataVector<uint8_t> m_SamplesG;
-  const FixedUninitDataVector<uint8_t> m_SamplesB;
+  const FixedSizeDataVector<uint8_t> m_SamplesR;
+  const FixedSizeDataVector<uint8_t> m_SamplesG;
+  const FixedSizeDataVector<uint8_t> m_SamplesB;
 };
 
 #endif  // CORE_FPDFAPI_PAGE_CPDF_TRANSFERFUNC_H_
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index e4be290..3d0d357 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -25,7 +25,7 @@
 #include "core/fpdfapi/parser/fpdf_parser_utility.h"
 #include "core/fxcrt/autorestorer.h"
 #include "core/fxcrt/cfx_read_only_vector_stream.h"
-#include "core/fxcrt/fixed_uninit_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/fx_extension.h"
 #include "core/fxcrt/fx_safe_types.h"
 #include "third_party/base/check.h"
@@ -790,7 +790,7 @@
     // `substream` is ultimately holding references to. To avoid unexpectedly
     // changing object lifetimes by handing `substream` to `pStream`, make a
     // copy of the data here.
-    FixedUninitDataVector<uint8_t> data(substream->GetSize());
+    auto data = FixedSizeDataVector<uint8_t>::Uninit(substream->GetSize());
     bool did_read = substream->ReadBlockAtOffset(data.span(), 0);
     CHECK(did_read);
     auto data_as_stream =
diff --git a/core/fpdfapi/render/cpdf_docrenderdata.cpp b/core/fpdfapi/render/cpdf_docrenderdata.cpp
index aeea585..9f2591c 100644
--- a/core/fpdfapi/render/cpdf_docrenderdata.cpp
+++ b/core/fpdfapi/render/cpdf_docrenderdata.cpp
@@ -20,7 +20,7 @@
 #include "core/fpdfapi/parser/cpdf_array.h"
 #include "core/fpdfapi/parser/cpdf_document.h"
 #include "core/fpdfapi/render/cpdf_type3cache.h"
-#include "core/fxcrt/fixed_uninit_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 
 #if BUILDFLAG(IS_WIN)
 #include "core/fxge/win32/cfx_psfonttracker.h"
@@ -98,12 +98,13 @@
   std::fill(std::begin(output), std::end(output), 0.0f);
 
   bool bIdentity = true;
-  FixedUninitDataVector<uint8_t> samples_r(
+  auto samples_r = FixedSizeDataVector<uint8_t>::Uninit(
       CPDF_TransferFunc::kChannelSampleSize);
-  FixedUninitDataVector<uint8_t> samples_g(
+  auto samples_g = FixedSizeDataVector<uint8_t>::Uninit(
       CPDF_TransferFunc::kChannelSampleSize);
-  FixedUninitDataVector<uint8_t> samples_b(
+  auto samples_b = FixedSizeDataVector<uint8_t>::Uninit(
       CPDF_TransferFunc::kChannelSampleSize);
+
   std::array<pdfium::span<uint8_t>, 3> samples = {
       samples_r.span(), samples_g.span(), samples_b.span()};
   if (pArray) {
diff --git a/core/fxcodec/flate/flatemodule.cpp b/core/fxcodec/flate/flatemodule.cpp
index a37ca44..c973094 100644
--- a/core/fxcodec/flate/flatemodule.cpp
+++ b/core/fxcodec/flate/flatemodule.cpp
@@ -17,7 +17,7 @@
 
 #include "core/fxcodec/scanlinedecoder.h"
 #include "core/fxcrt/data_vector.h"
-#include "core/fxcrt/fixed_zeroed_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/fx_extension.h"
 #include "core/fxcrt/fx_memory_wrappers.h"
 #include "core/fxcrt/fx_safe_types.h"
@@ -137,19 +137,19 @@
   uint32_t dest_buf_size_ = 0;  // Actual allocated size.
   uint32_t dest_byte_pos_ = 0;  // Size used.
   uint32_t stack_len_ = 0;
-  FixedZeroedDataVector<uint8_t> decode_stack_;
+  FixedSizeDataVector<uint8_t> decode_stack_;
   const uint8_t early_change_;
   uint8_t code_len_ = 9;
   uint32_t current_code_ = 0;
-  FixedZeroedDataVector<uint32_t> codes_;
+  FixedSizeDataVector<uint32_t> codes_;
 };
 
 CLZWDecoder::CLZWDecoder(pdfium::span<const uint8_t> src_span,
                          bool early_change)
     : src_span_(src_span),
-      decode_stack_(4000),
+      decode_stack_(FixedSizeDataVector<uint8_t>::Zeroed(4000)),
       early_change_(early_change ? 1 : 0),
-      codes_(5021) {}
+      codes_(FixedSizeDataVector<uint32_t>::Zeroed(5021)) {}
 
 void CLZWDecoder::AddCode(uint32_t prefix_code, uint8_t append_char) {
   if (current_code_ + early_change_ == 4094)
diff --git a/core/fxcrt/BUILD.gn b/core/fxcrt/BUILD.gn
index 18a73b2..ddebda5 100644
--- a/core/fxcrt/BUILD.gn
+++ b/core/fxcrt/BUILD.gn
@@ -47,9 +47,6 @@
     "data_vector.h",
     "fileaccess_iface.h",
     "fixed_size_data_vector.h",
-    "fixed_try_alloc_zeroed_data_vector.h",
-    "fixed_uninit_data_vector.h",
-    "fixed_zeroed_data_vector.h",
     "fx_2d_size.h",
     "fx_bidi.cpp",
     "fx_bidi.h",
@@ -188,9 +185,7 @@
     "cfx_seekablestreamproxy_unittest.cpp",
     "cfx_timer_unittest.cpp",
     "code_point_view_unittest.cpp",
-    "fixed_try_alloc_zeroed_data_vector_unittest.cpp",
-    "fixed_uninit_data_vector_unittest.cpp",
-    "fixed_zeroed_data_vector_unittest.cpp",
+    "fixed_size_data_vector_unittest.cpp",
     "fx_bidi_unittest.cpp",
     "fx_coordinates_unittest.cpp",
     "fx_extension_unittest.cpp",
diff --git a/core/fxcrt/cfx_read_only_vector_stream.cpp b/core/fxcrt/cfx_read_only_vector_stream.cpp
index 97f0dcb..f1120bb 100644
--- a/core/fxcrt/cfx_read_only_vector_stream.cpp
+++ b/core/fxcrt/cfx_read_only_vector_stream.cpp
@@ -14,7 +14,7 @@
       stream_(pdfium::MakeRetain<CFX_ReadOnlySpanStream>(data_)) {}
 
 CFX_ReadOnlyVectorStream::CFX_ReadOnlyVectorStream(
-    FixedUninitDataVector<uint8_t> data)
+    FixedSizeDataVector<uint8_t> data)
     : fixed_data_(std::move(data)),
       stream_(pdfium::MakeRetain<CFX_ReadOnlySpanStream>(fixed_data_)) {}
 
diff --git a/core/fxcrt/cfx_read_only_vector_stream.h b/core/fxcrt/cfx_read_only_vector_stream.h
index 7e9e1e9..bf8d065 100644
--- a/core/fxcrt/cfx_read_only_vector_stream.h
+++ b/core/fxcrt/cfx_read_only_vector_stream.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 
 #include "core/fxcrt/data_vector.h"
-#include "core/fxcrt/fixed_uninit_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/fx_stream.h"
 #include "core/fxcrt/retain_ptr.h"
 
@@ -25,11 +25,11 @@
 
  private:
   explicit CFX_ReadOnlyVectorStream(DataVector<uint8_t> data);
-  explicit CFX_ReadOnlyVectorStream(FixedUninitDataVector<uint8_t> data);
+  explicit CFX_ReadOnlyVectorStream(FixedSizeDataVector<uint8_t> data);
   ~CFX_ReadOnlyVectorStream() override;
 
   const DataVector<uint8_t> data_;
-  const FixedUninitDataVector<uint8_t> fixed_data_;
+  const FixedSizeDataVector<uint8_t> fixed_data_;
   // Spans over either `data_` or `fixed_data_`.
   const RetainPtr<CFX_ReadOnlySpanStream> stream_;
 };
diff --git a/core/fxcrt/fixed_size_data_vector.h b/core/fxcrt/fixed_size_data_vector.h
index 0293e3a..769ac9c 100644
--- a/core/fxcrt/fixed_size_data_vector.h
+++ b/core/fxcrt/fixed_size_data_vector.h
@@ -15,33 +15,50 @@
 
 namespace fxcrt {
 
-enum class DataVectorAllocOption {
-  kInitialized,
-  kUninitialized,
-  kTryInitialized,
-};
-
 // A simple data container that has a fixed size.
 // Unlike std::vector, it cannot be implicitly copied and its data is only
 // accessible using spans.
 // It can either initialize its data with zeros, or leave its data
 // uninitialized.
-template <typename T, DataVectorAllocOption OPTION>
+template <typename T>
 class FixedSizeDataVector {
  public:
-  FixedSizeDataVector() : FixedSizeDataVector(0) {}
-  explicit FixedSizeDataVector(size_t size)
-      : data_(MaybeInit(size, OPTION)), size_(CalculateSize(size, OPTION)) {}
+  FixedSizeDataVector() = default;
+
+  // Allocates a vector of the given size with uninitialized memory.
+  // A CHECK() failure occurs when insufficient memory.
+  static FixedSizeDataVector Uninit(size_t size) {
+    if (size == 0) {
+      return FixedSizeDataVector();
+    }
+    return FixedSizeDataVector(FX_AllocUninit(T, size), size);
+  }
+
+  // Allocates a vector of the given size with zeroed memory.
+  // A CHECK() failure occurs when insufficient memory.
+  static FixedSizeDataVector Zeroed(size_t size) {
+    if (size == 0) {
+      return FixedSizeDataVector();
+    }
+    return FixedSizeDataVector(FX_Alloc(T, size), size);
+  }
+
+  // Same as above, but return an empty vector when insufficient memory.
+  static FixedSizeDataVector TryZeroed(size_t size) {
+    if (size == 0) {
+      return FixedSizeDataVector();
+    }
+    T* ptr = FX_TryAlloc(T, size);
+    return FixedSizeDataVector(ptr, ptr ? size : 0u);
+  }
+
   FixedSizeDataVector(const FixedSizeDataVector&) = delete;
   FixedSizeDataVector& operator=(const FixedSizeDataVector&) = delete;
 
-  template <DataVectorAllocOption OTHER_OPTION>
-  FixedSizeDataVector(FixedSizeDataVector<T, OTHER_OPTION>&& that) noexcept
+  FixedSizeDataVector(FixedSizeDataVector<T>&& that) noexcept
       : data_(std::move(that.data_)), size_(std::exchange(that.size_, 0)) {}
 
-  template <DataVectorAllocOption OTHER_OPTION>
-  FixedSizeDataVector& operator=(
-      FixedSizeDataVector<T, OTHER_OPTION>&& that) noexcept {
+  FixedSizeDataVector& operator=(FixedSizeDataVector<T>&& that) noexcept {
     data_ = std::move(that.data_);
     size_ = std::exchange(that.size_, 0);
     return *this;
@@ -81,37 +98,14 @@
   pdfium::span<const T> last(size_t count) const { return span().last(count); }
 
  private:
-  friend class FixedSizeDataVector<T, DataVectorAllocOption::kInitialized>;
-  friend class FixedSizeDataVector<T, DataVectorAllocOption::kUninitialized>;
-  friend class FixedSizeDataVector<T, DataVectorAllocOption::kTryInitialized>;
-
-  static T* MaybeInit(size_t size, DataVectorAllocOption alloc_option) {
-    if (size == 0)
-      return nullptr;
-    switch (alloc_option) {
-      case DataVectorAllocOption::kInitialized:
-        return FX_Alloc(T, size);
-      case DataVectorAllocOption::kUninitialized:
-        return FX_AllocUninit(T, size);
-      case DataVectorAllocOption::kTryInitialized:
-        return FX_TryAlloc(T, size);
-    }
-  }
-
-  size_t CalculateSize(size_t size, DataVectorAllocOption alloc_option) const {
-    switch (alloc_option) {
-      case DataVectorAllocOption::kInitialized:
-      case DataVectorAllocOption::kUninitialized:
-        return size;
-      case DataVectorAllocOption::kTryInitialized:
-        return data_ ? size : 0;
-    }
-  }
+  FixedSizeDataVector(T* ptr, size_t size) : data_(ptr), size_(size) {}
 
   std::unique_ptr<T, FxFreeDeleter> data_;
-  size_t size_;
+  size_t size_ = 0;
 };
 
 }  // namespace fxcrt
 
+using fxcrt::FixedSizeDataVector;
+
 #endif  // CORE_FXCRT_FIXED_SIZE_DATA_VECTOR_H_
diff --git a/core/fxcrt/fixed_size_data_vector_unittest.cpp b/core/fxcrt/fixed_size_data_vector_unittest.cpp
new file mode 100644
index 0000000..80e3bab
--- /dev/null
+++ b/core/fxcrt/fixed_size_data_vector_unittest.cpp
@@ -0,0 +1,155 @@
+// Copyright 2024 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/fxcrt/fixed_size_data_vector.h"
+
+#include <limits>
+#include <numeric>
+#include <utility>
+
+#include "core/fxcrt/span_util.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/containers/span.h"
+
+TEST(FixedSizedDataVector, NoData) {
+  FixedSizeDataVector<int> vec;
+  EXPECT_EQ(0u, vec.size());
+  EXPECT_TRUE(vec.empty());
+  EXPECT_TRUE(vec.span().empty());
+}
+
+TEST(FixedSizeDataVector, UninitData) {
+  auto vec = FixedSizeDataVector<int>::Uninit(4);
+  EXPECT_FALSE(vec.empty());
+  ASSERT_EQ(4u, vec.size());
+  ASSERT_EQ(4u, vec.span().size());
+
+  constexpr int kData[] = {1, 2, 3, 4};
+  fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
+  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
+}
+
+TEST(FixedSizeDataVector, ZeroedData) {
+  auto vec = FixedSizeDataVector<int>::Zeroed(4);
+  EXPECT_FALSE(vec.empty());
+  EXPECT_EQ(4u, vec.size());
+  EXPECT_EQ(4u, vec.span().size());
+  EXPECT_THAT(vec.span(), testing::ElementsAre(0, 0, 0, 0));
+
+  constexpr int kData[] = {1, 2, 3, 4};
+  fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
+  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
+}
+
+TEST(FixedSizeDataVector, TryZeroedData) {
+  auto vec = FixedSizeDataVector<int>::TryZeroed(4);
+  EXPECT_FALSE(vec.empty());
+  ASSERT_EQ(4u, vec.size());
+  ASSERT_EQ(4u, vec.span().size());
+  EXPECT_THAT(vec.span(), testing::ElementsAre(0, 0, 0, 0));
+
+  constexpr int kData[] = {1, 2, 3, 4};
+  fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
+  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
+}
+
+TEST(FixedSizeDataVector, TryAllocFailure) {
+  constexpr size_t kCloseToMaxByteAlloc =
+      std::numeric_limits<size_t>::max() - 100;
+  auto vec = FixedSizeDataVector<int>::TryZeroed(kCloseToMaxByteAlloc);
+  EXPECT_TRUE(vec.empty());
+  EXPECT_EQ(0u, vec.size());
+  EXPECT_EQ(0u, vec.span().size());
+}
+
+TEST(FixedSizeDataVector, MoveConstruct) {
+  constexpr int kData[] = {1, 2, 3, 4};
+  auto vec = FixedSizeDataVector<int>::Uninit(4);
+  ASSERT_EQ(4u, vec.span().size());
+  fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
+  const int* const original_data_ptr = vec.span().data();
+
+  FixedSizeDataVector<int> vec2(std::move(vec));
+  EXPECT_FALSE(vec2.empty());
+  EXPECT_EQ(4u, vec2.size());
+  EXPECT_EQ(4u, vec2.span().size());
+  EXPECT_THAT(vec2.span(), testing::ElementsAre(1, 2, 3, 4));
+  EXPECT_EQ(vec2.span().data(), original_data_ptr);
+
+  EXPECT_EQ(0u, vec.size());
+  EXPECT_TRUE(vec.empty());
+  EXPECT_TRUE(vec.span().empty());
+
+  vec = std::move(vec2);
+  EXPECT_FALSE(vec.empty());
+  EXPECT_EQ(4u, vec.size());
+  EXPECT_EQ(4u, vec.span().size());
+  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
+  EXPECT_EQ(vec.span().data(), original_data_ptr);
+
+  EXPECT_EQ(0u, vec2.size());
+  EXPECT_TRUE(vec2.empty());
+  EXPECT_TRUE(vec2.span().empty());
+}
+
+TEST(FixedSizeDataVector, MoveAssign) {
+  auto vec = FixedSizeDataVector<int>();
+  auto vec2 = FixedSizeDataVector<int>::Zeroed(4);
+  constexpr int kData[] = {1, 2, 3, 4};
+  ASSERT_EQ(4u, vec2.span().size());
+  fxcrt::spancpy(vec2.span(), pdfium::make_span(kData));
+
+  vec = std::move(vec2);
+  EXPECT_TRUE(vec2.empty());
+  EXPECT_EQ(4u, vec.span().size());
+  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
+}
+
+TEST(FixedSizeDataVector, Subspan) {
+  auto vec = FixedSizeDataVector<uint32_t>::Uninit(4);
+  std::iota(vec.span().begin(), vec.span().end(), 0u);
+
+  pdfium::span<uint32_t> empty = vec.subspan(2, 0);
+  EXPECT_TRUE(empty.empty());
+
+  pdfium::span<uint32_t> first = vec.subspan(0, 1);
+  ASSERT_EQ(first.size(), 1u);
+  EXPECT_EQ(first[0], 0u);
+
+  pdfium::span<uint32_t> mids = vec.subspan(1, 2);
+  ASSERT_EQ(mids.size(), 2u);
+  EXPECT_EQ(mids[0], 1u);
+  EXPECT_EQ(mids[1], 2u);
+
+  pdfium::span<uint32_t> rest = vec.subspan(3);
+  ASSERT_EQ(rest.size(), 1u);
+  EXPECT_EQ(rest[0], 3u);
+}
+
+TEST(FixedSizeDataVector, First) {
+  auto vec = FixedSizeDataVector<uint32_t>::Uninit(4);
+  std::iota(vec.span().begin(), vec.span().end(), 0u);
+
+  pdfium::span<uint32_t> empty = vec.first(0);
+  EXPECT_TRUE(empty.empty());
+
+  pdfium::span<uint32_t> some = vec.first(2);
+  ASSERT_EQ(some.size(), 2u);
+  EXPECT_EQ(some[0], 0u);
+  EXPECT_EQ(some[1], 1u);
+}
+
+TEST(FixedSizeDataVector, Last) {
+  auto vec = FixedSizeDataVector<uint32_t>::Uninit(4);
+  std::iota(vec.span().begin(), vec.span().end(), 0u);
+
+  pdfium::span<uint32_t> empty = vec.first(0);
+  EXPECT_TRUE(empty.empty());
+
+  pdfium::span<uint32_t> some = vec.first(2);
+  ASSERT_EQ(some.size(), 2u);
+  EXPECT_EQ(some[0], 0u);
+  EXPECT_EQ(some[1], 1u);
+}
diff --git a/core/fxcrt/fixed_try_alloc_zeroed_data_vector.h b/core/fxcrt/fixed_try_alloc_zeroed_data_vector.h
deleted file mode 100644
index e7f1bf8..0000000
--- a/core/fxcrt/fixed_try_alloc_zeroed_data_vector.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2022 The PDFium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CORE_FXCRT_FIXED_TRY_ALLOC_ZEROED_DATA_VECTOR_H_
-#define CORE_FXCRT_FIXED_TRY_ALLOC_ZEROED_DATA_VECTOR_H_
-
-#include "core/fxcrt/fixed_size_data_vector.h"
-
-// WARNING: Since FX_TryAlloc() can fail, one must always check if a
-// FixedTryAllocZeroedDataVector is empty after creating one.
-template <typename T>
-using FixedTryAllocZeroedDataVector =
-    fxcrt::FixedSizeDataVector<T,
-                               fxcrt::DataVectorAllocOption::kTryInitialized>;
-
-#endif  // CORE_FXCRT_FIXED_TRY_ALLOC_ZEROED_DATA_VECTOR_H_
diff --git a/core/fxcrt/fixed_try_alloc_zeroed_data_vector_unittest.cpp b/core/fxcrt/fixed_try_alloc_zeroed_data_vector_unittest.cpp
deleted file mode 100644
index 01e7b20..0000000
--- a/core/fxcrt/fixed_try_alloc_zeroed_data_vector_unittest.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2022 The PDFium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "core/fxcrt/fixed_try_alloc_zeroed_data_vector.h"
-
-#include <limits>
-#include <utility>
-
-#include "core/fxcrt/fixed_uninit_data_vector.h"
-#include "core/fxcrt/fixed_zeroed_data_vector.h"
-#include "core/fxcrt/span_util.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/containers/span.h"
-
-TEST(FixedTryAllocZeroedDataVector, NoData) {
-  FixedTryAllocZeroedDataVector<int> vec;
-  EXPECT_EQ(0u, vec.size());
-  EXPECT_TRUE(vec.empty());
-  EXPECT_TRUE(vec.span().empty());
-}
-
-TEST(FixedTryAllocZeroedDataVector, WithData) {
-  FixedTryAllocZeroedDataVector<int> vec(4);
-  EXPECT_FALSE(vec.empty());
-  EXPECT_EQ(4u, vec.size());
-  EXPECT_EQ(4u, vec.span().size());
-  EXPECT_THAT(vec.span(), testing::ElementsAre(0, 0, 0, 0));
-
-  constexpr int kData[] = {1, 2, 3, 4};
-  fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-}
-
-TEST(FixedTryAllocZeroedDataVector, AllocFailure) {
-  constexpr size_t kCloseToMaxByteAlloc =
-      std::numeric_limits<size_t>::max() - 100;
-  FixedTryAllocZeroedDataVector<int> vec(kCloseToMaxByteAlloc);
-  EXPECT_TRUE(vec.empty());
-  EXPECT_EQ(0u, vec.size());
-  EXPECT_EQ(0u, vec.span().size());
-}
-
-TEST(FixedTryAllocZeroedDataVector, Move) {
-  FixedTryAllocZeroedDataVector<int> vec(4);
-  constexpr int kData[] = {1, 2, 3, 4};
-  ASSERT_EQ(4u, vec.span().size());
-  fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
-  const int* const original_data_ptr = vec.span().data();
-
-  FixedTryAllocZeroedDataVector<int> vec2(std::move(vec));
-  EXPECT_FALSE(vec2.empty());
-  EXPECT_EQ(4u, vec2.size());
-  EXPECT_EQ(4u, vec2.span().size());
-  EXPECT_THAT(vec2.span(), testing::ElementsAre(1, 2, 3, 4));
-  EXPECT_EQ(vec2.span().data(), original_data_ptr);
-
-  EXPECT_EQ(0u, vec.size());
-  EXPECT_TRUE(vec.empty());
-  EXPECT_TRUE(vec.span().empty());
-
-  vec = std::move(vec2);
-  EXPECT_FALSE(vec.empty());
-  EXPECT_EQ(4u, vec.size());
-  EXPECT_EQ(4u, vec.span().size());
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-  EXPECT_EQ(vec.span().data(), original_data_ptr);
-
-  EXPECT_EQ(0u, vec2.size());
-  EXPECT_TRUE(vec2.empty());
-  EXPECT_TRUE(vec2.span().empty());
-}
-
-TEST(FixedTryAllocZeroedDataVector, AssignFromFixedZeroedDataVector) {
-  FixedTryAllocZeroedDataVector<int> vec;
-
-  FixedZeroedDataVector<int> vec2(4);
-  constexpr int kData[] = {1, 2, 3, 4};
-  ASSERT_EQ(4u, vec2.span().size());
-  fxcrt::spancpy(vec2.span(), pdfium::make_span(kData));
-
-  vec = std::move(vec2);
-  EXPECT_TRUE(vec2.empty());
-  EXPECT_EQ(4u, vec.span().size());
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-}
-
-TEST(FixedTryAllocZeroedDataVector, AssignFromFixedUninitDataVector) {
-  FixedTryAllocZeroedDataVector<int> vec;
-
-  FixedUninitDataVector<int> vec2(4);
-  constexpr int kData[] = {1, 2, 3, 4};
-  ASSERT_EQ(4u, vec2.span().size());
-  fxcrt::spancpy(vec2.span(), pdfium::make_span(kData));
-
-  vec = std::move(vec2);
-  EXPECT_TRUE(vec2.empty());
-  EXPECT_EQ(4u, vec.span().size());
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-}
diff --git a/core/fxcrt/fixed_uninit_data_vector.h b/core/fxcrt/fixed_uninit_data_vector.h
deleted file mode 100644
index a208f5e..0000000
--- a/core/fxcrt/fixed_uninit_data_vector.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2022 The PDFium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CORE_FXCRT_FIXED_UNINIT_DATA_VECTOR_H_
-#define CORE_FXCRT_FIXED_UNINIT_DATA_VECTOR_H_
-
-#include "core/fxcrt/fixed_size_data_vector.h"
-
-template <typename T>
-using FixedUninitDataVector =
-    fxcrt::FixedSizeDataVector<T, fxcrt::DataVectorAllocOption::kUninitialized>;
-
-#endif  // CORE_FXCRT_FIXED_UNINIT_DATA_VECTOR_H_
diff --git a/core/fxcrt/fixed_uninit_data_vector_unittest.cpp b/core/fxcrt/fixed_uninit_data_vector_unittest.cpp
deleted file mode 100644
index e1414aa..0000000
--- a/core/fxcrt/fixed_uninit_data_vector_unittest.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright 2022 The PDFium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "core/fxcrt/fixed_uninit_data_vector.h"
-
-#include <numeric>
-#include <utility>
-
-#include "core/fxcrt/fixed_try_alloc_zeroed_data_vector.h"
-#include "core/fxcrt/fixed_zeroed_data_vector.h"
-#include "core/fxcrt/span_util.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/containers/span.h"
-
-TEST(FixedUninitDataVector, NoData) {
-  FixedUninitDataVector<int> vec;
-  EXPECT_EQ(0u, vec.size());
-  EXPECT_TRUE(vec.empty());
-  EXPECT_TRUE(vec.span().empty());
-}
-
-TEST(FixedUninitDataVector, WithData) {
-  FixedUninitDataVector<int> vec(4);
-  EXPECT_FALSE(vec.empty());
-  ASSERT_EQ(4u, vec.size());
-  ASSERT_EQ(4u, vec.span().size());
-
-  constexpr int kData[] = {1, 2, 3, 4};
-  fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-}
-
-TEST(FixedUninitDataVector, Move) {
-  FixedUninitDataVector<int> vec(4);
-  constexpr int kData[] = {1, 2, 3, 4};
-  ASSERT_EQ(4u, vec.span().size());
-  fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
-  const int* const original_data_ptr = vec.span().data();
-
-  FixedUninitDataVector<int> vec2(std::move(vec));
-  EXPECT_FALSE(vec2.empty());
-  ASSERT_EQ(4u, vec2.size());
-  ASSERT_EQ(4u, vec2.span().size());
-  EXPECT_THAT(vec2.span(), testing::ElementsAre(1, 2, 3, 4));
-  EXPECT_EQ(vec2.span().data(), original_data_ptr);
-
-  EXPECT_EQ(0u, vec.size());
-  EXPECT_TRUE(vec.empty());
-  EXPECT_TRUE(vec.span().empty());
-
-  vec = std::move(vec2);
-  EXPECT_FALSE(vec.empty());
-  ASSERT_EQ(4u, vec.size());
-  ASSERT_EQ(4u, vec.span().size());
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-  EXPECT_EQ(vec.span().data(), original_data_ptr);
-
-  EXPECT_EQ(0u, vec2.size());
-  EXPECT_TRUE(vec2.empty());
-  EXPECT_TRUE(vec2.span().empty());
-}
-
-TEST(FixedUninitDataVector, AssignFromFixedZeroedDataVector) {
-  FixedUninitDataVector<int> vec;
-
-  FixedZeroedDataVector<int> vec2(4);
-  constexpr int kData[] = {1, 2, 3, 4};
-  ASSERT_EQ(4u, vec2.span().size());
-  fxcrt::spancpy(vec2.span(), pdfium::make_span(kData));
-
-  vec = std::move(vec2);
-  EXPECT_TRUE(vec2.empty());
-  ASSERT_EQ(4u, vec.span().size());
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-}
-
-TEST(FixedUninitDataVector, AssignFromFixedTryAllocZeroedDataVector) {
-  FixedUninitDataVector<int> vec;
-
-  FixedTryAllocZeroedDataVector<int> vec2(4);
-  constexpr int kData[] = {1, 2, 3, 4};
-  ASSERT_EQ(4u, vec2.span().size());
-  fxcrt::spancpy(vec2.span(), pdfium::make_span(kData));
-
-  vec = std::move(vec2);
-  EXPECT_TRUE(vec2.empty());
-  ASSERT_EQ(4u, vec.span().size());
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-}
-
-TEST(FixedUninitDataVector, Subspan) {
-  FixedUninitDataVector<uint32_t> vec(4);
-  std::iota(vec.span().begin(), vec.span().end(), 0u);
-
-  pdfium::span<uint32_t> empty = vec.subspan(2, 0);
-  EXPECT_TRUE(empty.empty());
-
-  pdfium::span<uint32_t> first = vec.subspan(0, 1);
-  ASSERT_EQ(first.size(), 1u);
-  EXPECT_EQ(first[0], 0u);
-
-  pdfium::span<uint32_t> mids = vec.subspan(1, 2);
-  ASSERT_EQ(mids.size(), 2u);
-  EXPECT_EQ(mids[0], 1u);
-  EXPECT_EQ(mids[1], 2u);
-
-  pdfium::span<uint32_t> rest = vec.subspan(3);
-  ASSERT_EQ(rest.size(), 1u);
-  EXPECT_EQ(rest[0], 3u);
-}
-
-TEST(FixedUninitDataVector, First) {
-  FixedUninitDataVector<uint32_t> vec(4);
-  std::iota(vec.span().begin(), vec.span().end(), 0u);
-
-  pdfium::span<uint32_t> empty = vec.first(0);
-  EXPECT_TRUE(empty.empty());
-
-  pdfium::span<uint32_t> some = vec.first(2);
-  ASSERT_EQ(some.size(), 2u);
-  EXPECT_EQ(some[0], 0u);
-  EXPECT_EQ(some[1], 1u);
-}
-
-TEST(FixedUninitDataVector, Last) {
-  FixedUninitDataVector<uint32_t> vec(4);
-  std::iota(vec.span().begin(), vec.span().end(), 0u);
-
-  pdfium::span<uint32_t> empty = vec.first(0);
-  EXPECT_TRUE(empty.empty());
-
-  pdfium::span<uint32_t> some = vec.first(2);
-  ASSERT_EQ(some.size(), 2u);
-  EXPECT_EQ(some[0], 0u);
-  EXPECT_EQ(some[1], 1u);
-}
diff --git a/core/fxcrt/fixed_zeroed_data_vector.h b/core/fxcrt/fixed_zeroed_data_vector.h
deleted file mode 100644
index c8b91a6..0000000
--- a/core/fxcrt/fixed_zeroed_data_vector.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2022 The PDFium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CORE_FXCRT_FIXED_ZEROED_DATA_VECTOR_H_
-#define CORE_FXCRT_FIXED_ZEROED_DATA_VECTOR_H_
-
-#include "core/fxcrt/fixed_size_data_vector.h"
-
-template <typename T>
-using FixedZeroedDataVector =
-    fxcrt::FixedSizeDataVector<T, fxcrt::DataVectorAllocOption::kInitialized>;
-
-#endif  // CORE_FXCRT_FIXED_ZEROED_DATA_VECTOR_H_
diff --git a/core/fxcrt/fixed_zeroed_data_vector_unittest.cpp b/core/fxcrt/fixed_zeroed_data_vector_unittest.cpp
deleted file mode 100644
index d251275..0000000
--- a/core/fxcrt/fixed_zeroed_data_vector_unittest.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2022 The PDFium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "core/fxcrt/fixed_zeroed_data_vector.h"
-
-#include <utility>
-
-#include "core/fxcrt/fixed_try_alloc_zeroed_data_vector.h"
-#include "core/fxcrt/fixed_uninit_data_vector.h"
-#include "core/fxcrt/span_util.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/containers/span.h"
-
-TEST(FixedZeroedDataVector, NoData) {
-  FixedZeroedDataVector<int> vec;
-  EXPECT_EQ(0u, vec.size());
-  EXPECT_TRUE(vec.empty());
-  EXPECT_TRUE(vec.span().empty());
-}
-
-TEST(FixedZeroedDataVector, WithData) {
-  FixedZeroedDataVector<int> vec(4);
-  EXPECT_FALSE(vec.empty());
-  ASSERT_EQ(4u, vec.size());
-  ASSERT_EQ(4u, vec.span().size());
-  EXPECT_THAT(vec.span(), testing::ElementsAre(0, 0, 0, 0));
-
-  constexpr int kData[] = {1, 2, 3, 4};
-  fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-}
-
-TEST(FixedZeroedDataVector, Move) {
-  FixedZeroedDataVector<int> vec(4);
-  constexpr int kData[] = {1, 2, 3, 4};
-  ASSERT_EQ(4u, vec.span().size());
-  fxcrt::spancpy(vec.span(), pdfium::make_span(kData));
-  const int* const original_data_ptr = vec.span().data();
-
-  FixedZeroedDataVector<int> vec2(std::move(vec));
-  EXPECT_FALSE(vec2.empty());
-  ASSERT_EQ(4u, vec2.size());
-  ASSERT_EQ(4u, vec2.span().size());
-  EXPECT_THAT(vec2.span(), testing::ElementsAre(1, 2, 3, 4));
-  EXPECT_EQ(vec2.span().data(), original_data_ptr);
-
-  EXPECT_EQ(0u, vec.size());
-  EXPECT_TRUE(vec.empty());
-  EXPECT_TRUE(vec.span().empty());
-
-  vec = std::move(vec2);
-  EXPECT_FALSE(vec.empty());
-  ASSERT_EQ(4u, vec.size());
-  ASSERT_EQ(4u, vec.span().size());
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-  EXPECT_EQ(vec.span().data(), original_data_ptr);
-
-  EXPECT_EQ(0u, vec2.size());
-  EXPECT_TRUE(vec2.empty());
-  EXPECT_TRUE(vec2.span().empty());
-}
-
-TEST(FixedZeroedDataVector, AssignFromFixedUninitDataVector) {
-  FixedZeroedDataVector<int> vec;
-
-  FixedUninitDataVector<int> vec2(4);
-  constexpr int kData[] = {1, 2, 3, 4};
-  ASSERT_EQ(4u, vec2.span().size());
-  fxcrt::spancpy(vec2.span(), pdfium::make_span(kData));
-
-  vec = std::move(vec2);
-  EXPECT_TRUE(vec2.empty());
-  ASSERT_EQ(4u, vec.span().size());
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-}
-
-TEST(FixedZeroedDataVector, AssignFromFixedTryAllocZeroedDataVector) {
-  FixedZeroedDataVector<int> vec;
-
-  FixedTryAllocZeroedDataVector<int> vec2(4);
-  constexpr int kData[] = {1, 2, 3, 4};
-  ASSERT_EQ(4u, vec2.span().size());
-  fxcrt::spancpy(vec2.span(), pdfium::make_span(kData));
-
-  vec = std::move(vec2);
-  EXPECT_TRUE(vec2.empty());
-  ASSERT_EQ(4u, vec.span().size());
-  EXPECT_THAT(vec.span(), testing::ElementsAre(1, 2, 3, 4));
-}
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 34b025f..6640360 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -793,24 +793,24 @@
 #endif  // BUILDFLAG(IS_WIN)
 
 #ifdef PDF_ENABLE_XFA
-FixedUninitDataVector<uint8_t> CFX_FontMapper::RawBytesForIndex(size_t index) {
+FixedSizeDataVector<uint8_t> CFX_FontMapper::RawBytesForIndex(size_t index) {
   CHECK_LT(index, m_FaceArray.size());
 
   void* font_handle = m_pFontInfo->MapFont(0, false, FX_Charset::kDefault, 0,
                                            GetFaceName(index));
-  if (!font_handle)
-    return FixedUninitDataVector<uint8_t>();
-
+  if (!font_handle) {
+    return FixedSizeDataVector<uint8_t>();
+  }
   ScopedFontDeleter scoped_font(m_pFontInfo.get(), font_handle);
   size_t required_size = m_pFontInfo->GetFontData(font_handle, 0, {});
-  if (required_size == 0)
-    return FixedUninitDataVector<uint8_t>();
-
-  FixedUninitDataVector<uint8_t> result(required_size);
+  if (required_size == 0) {
+    return FixedSizeDataVector<uint8_t>();
+  }
+  auto result = FixedSizeDataVector<uint8_t>::Uninit(required_size);
   size_t actual_size = m_pFontInfo->GetFontData(font_handle, 0, result.span());
-  if (actual_size != required_size)
-    return FixedUninitDataVector<uint8_t>();
-
+  if (actual_size != required_size) {
+    return FixedSizeDataVector<uint8_t>();
+  }
   return result;
 }
 #endif  // PDF_ENABLE_XFA
@@ -823,7 +823,7 @@
   RetainPtr<CFX_FontMgr::FontDesc> pFontDesc =
       m_pFontMgr->GetCachedTTCFontDesc(ttc_size, checksum);
   if (!pFontDesc) {
-    FixedUninitDataVector<uint8_t> font_data(ttc_size);
+    auto font_data = FixedSizeDataVector<uint8_t>::Uninit(ttc_size);
     size_t size =
         m_pFontInfo->GetFontData(font_handle, kTableTTCF, font_data.span());
     if (size != ttc_size)
@@ -856,7 +856,7 @@
   RetainPtr<CFX_FontMgr::FontDesc> pFontDesc =
       m_pFontMgr->GetCachedFontDesc(subst_name, weight, is_italic);
   if (!pFontDesc) {
-    FixedUninitDataVector<uint8_t> font_data(data_size);
+    auto font_data = FixedSizeDataVector<uint8_t>::Uninit(data_size);
     size_t size = m_pFontInfo->GetFontData(font_handle, 0, font_data.span());
     if (size != data_size)
       return nullptr;
diff --git a/core/fxge/cfx_fontmapper.h b/core/fxge/cfx_fontmapper.h
index aa8f671..ecbec60 100644
--- a/core/fxge/cfx_fontmapper.h
+++ b/core/fxge/cfx_fontmapper.h
@@ -20,7 +20,7 @@
 #include "third_party/abseil-cpp/absl/types/optional.h"
 
 #ifdef PDF_ENABLE_XFA
-#include "core/fxcrt/fixed_uninit_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #endif
 
 class CFX_FontMgr;
@@ -88,7 +88,7 @@
 
 #ifdef PDF_ENABLE_XFA
   // `index` must be less than GetFaceSize().
-  FixedUninitDataVector<uint8_t> RawBytesForIndex(size_t index);
+  FixedSizeDataVector<uint8_t> RawBytesForIndex(size_t index);
 #endif  // PDF_ENABLE_XFA
 
  private:
diff --git a/core/fxge/cfx_fontmapper_unittest.cpp b/core/fxge/cfx_fontmapper_unittest.cpp
index ab0c858..43712b3 100644
--- a/core/fxge/cfx_fontmapper_unittest.cpp
+++ b/core/fxge/cfx_fontmapper_unittest.cpp
@@ -153,14 +153,14 @@
     EXPECT_CALL(system_font_info(), DeleteFont(kFontHandle));
   }
 
-  FixedUninitDataVector<uint8_t> data = font_mapper().RawBytesForIndex(0);
+  FixedSizeDataVector<uint8_t> data = font_mapper().RawBytesForIndex(0);
   EXPECT_THAT(data.span(), ElementsAre('0', '1'));
 }
 
 TEST_F(CFXFontMapperSystemFontInfoTest, RawBytesForIndexFailToMap) {
   EXPECT_CALL(system_font_info(), MapFont).WillOnce(Return(nullptr));
 
-  FixedUninitDataVector<uint8_t> data = font_mapper().RawBytesForIndex(0);
+  FixedSizeDataVector<uint8_t> data = font_mapper().RawBytesForIndex(0);
   EXPECT_TRUE(data.empty());
 }
 
@@ -175,7 +175,7 @@
     EXPECT_CALL(system_font_info(), DeleteFont(kFontHandle));
   }
 
-  FixedUninitDataVector<uint8_t> data = font_mapper().RawBytesForIndex(0);
+  FixedSizeDataVector<uint8_t> data = font_mapper().RawBytesForIndex(0);
   EXPECT_TRUE(data.empty());
 }
 
@@ -192,7 +192,7 @@
     EXPECT_CALL(system_font_info(), DeleteFont(kFontHandle));
   }
 
-  FixedUninitDataVector<uint8_t> data = font_mapper().RawBytesForIndex(0);
+  FixedSizeDataVector<uint8_t> data = font_mapper().RawBytesForIndex(0);
   EXPECT_TRUE(data.empty());
 }
 #endif  // PDF_ENABLE_XFA
diff --git a/core/fxge/cfx_fontmgr.cpp b/core/fxge/cfx_fontmgr.cpp
index e52979e..a7070e1 100644
--- a/core/fxge/cfx_fontmgr.cpp
+++ b/core/fxge/cfx_fontmgr.cpp
@@ -10,7 +10,7 @@
 #include <memory>
 #include <utility>
 
-#include "core/fxcrt/fixed_uninit_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxge/cfx_fontmapper.h"
 #include "core/fxge/cfx_substfont.h"
 #include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
@@ -55,7 +55,7 @@
 
 }  // namespace
 
-CFX_FontMgr::FontDesc::FontDesc(FixedUninitDataVector<uint8_t> data)
+CFX_FontMgr::FontDesc::FontDesc(FixedSizeDataVector<uint8_t> data)
     : m_pFontData(std::move(data)) {}
 
 CFX_FontMgr::FontDesc::~FontDesc() = default;
@@ -90,7 +90,7 @@
     const ByteString& face_name,
     int weight,
     bool bItalic,
-    FixedUninitDataVector<uint8_t> data) {
+    FixedSizeDataVector<uint8_t> data) {
   auto pFontDesc = pdfium::MakeRetain<FontDesc>(std::move(data));
   m_FaceMap[{face_name, weight, bItalic}].Reset(pFontDesc.Get());
   return pFontDesc;
@@ -107,7 +107,7 @@
 RetainPtr<CFX_FontMgr::FontDesc> CFX_FontMgr::AddCachedTTCFontDesc(
     size_t ttc_size,
     uint32_t checksum,
-    FixedUninitDataVector<uint8_t> data) {
+    FixedSizeDataVector<uint8_t> data) {
   auto pNewDesc = pdfium::MakeRetain<FontDesc>(std::move(data));
   m_TTCFaceMap[{ttc_size, checksum}].Reset(pNewDesc.Get());
   return pNewDesc;
diff --git a/core/fxge/cfx_fontmgr.h b/core/fxge/cfx_fontmgr.h
index 2936e26..c90b7c0 100644
--- a/core/fxge/cfx_fontmgr.h
+++ b/core/fxge/cfx_fontmgr.h
@@ -15,7 +15,7 @@
 #include <tuple>
 
 #include "core/fxcrt/bytestring.h"
-#include "core/fxcrt/fixed_uninit_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/observed_ptr.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/cfx_face.h"
@@ -35,10 +35,10 @@
     CFX_Face* GetFace(size_t index) const;
 
    private:
-    explicit FontDesc(FixedUninitDataVector<uint8_t> data);
+    explicit FontDesc(FixedSizeDataVector<uint8_t> data);
     ~FontDesc() override;
 
-    const FixedUninitDataVector<uint8_t> m_pFontData;
+    const FixedSizeDataVector<uint8_t> m_pFontData;
     ObservedPtr<CFX_Face> m_TTCFaces[16];
   };
 
@@ -56,12 +56,12 @@
   RetainPtr<FontDesc> AddCachedFontDesc(const ByteString& face_name,
                                         int weight,
                                         bool bItalic,
-                                        FixedUninitDataVector<uint8_t> data);
+                                        FixedSizeDataVector<uint8_t> data);
 
   RetainPtr<FontDesc> GetCachedTTCFontDesc(size_t ttc_size, uint32_t checksum);
   RetainPtr<FontDesc> AddCachedTTCFontDesc(size_t ttc_size,
                                            uint32_t checksum,
-                                           FixedUninitDataVector<uint8_t> data);
+                                           FixedSizeDataVector<uint8_t> data);
 
   RetainPtr<CFX_Face> NewFixedFace(RetainPtr<FontDesc> pDesc,
                                    pdfium::span<const uint8_t> span,
diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp
index ae986c6..5590612 100644
--- a/core/fxge/dib/cstretchengine.cpp
+++ b/core/fxge/dib/cstretchengine.cpp
@@ -278,13 +278,13 @@
   FX_SAFE_SIZE_T safe_size = m_SrcClip.Height();
   safe_size *= m_InterPitch;
   const size_t size = safe_size.ValueOrDefault(0);
-  if (size == 0)
+  if (size == 0) {
     return false;
-
-  m_InterBuf = FixedTryAllocZeroedDataVector<uint8_t>(size);
-  if (m_InterBuf.empty())
+  }
+  m_InterBuf = FixedSizeDataVector<uint8_t>::TryZeroed(size);
+  if (m_InterBuf.empty()) {
     return false;
-
+  }
   if (!m_WeightTable.CalculateWeights(
           m_DestWidth, m_DestClip.left, m_DestClip.right, m_SrcWidth,
           m_SrcClip.left, m_SrcClip.right, m_ResampleOptions)) {
diff --git a/core/fxge/dib/cstretchengine.h b/core/fxge/dib/cstretchengine.h
index 4f0d71f..e443e62 100644
--- a/core/fxge/dib/cstretchengine.h
+++ b/core/fxge/dib/cstretchengine.h
@@ -10,7 +10,7 @@
 #include <stdint.h>
 
 #include "core/fxcrt/data_vector.h"
-#include "core/fxcrt/fixed_try_alloc_zeroed_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/fx_system.h"
 #include "core/fxcrt/retain_ptr.h"
@@ -150,7 +150,7 @@
   const int m_DestHeight;
   const FX_RECT m_DestClip;
   DataVector<uint8_t> m_DestScanline;
-  FixedTryAllocZeroedDataVector<uint8_t> m_InterBuf;
+  FixedSizeDataVector<uint8_t> m_InterBuf;
   FX_RECT m_SrcClip;
   int m_InterPitch;
   int m_ExtraMaskPitch;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index a339885..6b747e6 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -17,7 +17,7 @@
 #include "core/fpdfapi/parser/cpdf_seekablemultistream.h"
 #include "core/fxcodec/jpeg/jpeg_progressive_decoder.h"
 #include "core/fxcrt/autonuller.h"
-#include "core/fxcrt/fixed_zeroed_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/stl_util.h"
 #include "core/fxcrt/xml/cfx_xmldocument.h"
 #include "core/fxcrt/xml/cfx_xmlparser.h"
@@ -365,7 +365,7 @@
 
   constexpr int kMaxWideChars = 1024;
   constexpr int kMaxBytes = kMaxWideChars * sizeof(uint16_t);
-  FixedZeroedDataVector<uint8_t> buffer(kMaxBytes);
+  auto buffer = FixedSizeDataVector<uint8_t>::Zeroed(kMaxBytes);
   pdfium::span<uint8_t> buffer_span = buffer.span();
   int byte_length = m_pFormFillEnv->JS_appResponse(
       wsQuestion, wsTitle, wsDefaultAnswer, WideString(), bMark, buffer_span);
diff --git a/fxbarcode/common/BC_CommonBitMatrix.cpp b/fxbarcode/common/BC_CommonBitMatrix.cpp
index 2248640..c13eb40 100644
--- a/fxbarcode/common/BC_CommonBitMatrix.cpp
+++ b/fxbarcode/common/BC_CommonBitMatrix.cpp
@@ -22,14 +22,14 @@
 
 #include "fxbarcode/common/BC_CommonBitMatrix.h"
 
-#include "core/fxcrt/fixed_zeroed_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "third_party/base/check_op.h"
 
 CBC_CommonBitMatrix::CBC_CommonBitMatrix(size_t width, size_t height)
     : m_height(height), m_rowSize((width + 31) >> 5) {
   static constexpr int32_t kMaxBits = 1024 * 1024 * 1024;  // 1 Gb.
   CHECK_LT(m_rowSize, kMaxBits / m_height);
-  m_bits = FixedZeroedDataVector<uint32_t>(m_rowSize * m_height);
+  m_bits = FixedSizeDataVector<uint32_t>::Zeroed(m_rowSize * m_height);
 }
 
 CBC_CommonBitMatrix::~CBC_CommonBitMatrix() = default;
diff --git a/fxbarcode/common/BC_CommonBitMatrix.h b/fxbarcode/common/BC_CommonBitMatrix.h
index 3dabe8a..8ce7380 100644
--- a/fxbarcode/common/BC_CommonBitMatrix.h
+++ b/fxbarcode/common/BC_CommonBitMatrix.h
@@ -10,7 +10,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#include "core/fxcrt/fixed_zeroed_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 
 class CBC_CommonBitMatrix {
  public:
@@ -23,7 +23,7 @@
  private:
   const size_t m_height;
   const size_t m_rowSize;
-  FixedZeroedDataVector<uint32_t> m_bits;
+  FixedSizeDataVector<uint32_t> m_bits;
 };
 
 #endif  // FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_
diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
index 6433e8d..060dca2 100644
--- a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
+++ b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
@@ -27,7 +27,7 @@
 #include <algorithm>
 #include <vector>
 
-#include "core/fxcrt/fixed_zeroed_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "fxbarcode/datamatrix/BC_Encoder.h"
 #include "fxbarcode/datamatrix/BC_SymbolInfo.h"
 #include "third_party/base/check.h"
@@ -156,7 +156,7 @@
   if (table >= kFactorTableNum)
     return WideString();
 
-  FixedZeroedDataVector<uint16_t> ecc(numECWords);
+  auto ecc = FixedSizeDataVector<uint16_t>::Zeroed(numECWords);
   pdfium::span<uint16_t> ecc_span = ecc.span();
   for (size_t i = 0; i < len; ++i) {
     uint16_t m = ecc_span[numECWords - 1] ^ codewords[i];
diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp b/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
index 996fccc..7beb404 100644
--- a/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
+++ b/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
@@ -25,7 +25,8 @@
 #include "core/fxcrt/span_util.h"
 #include "third_party/base/check_op.h"
 
-CBC_BarcodeRow::CBC_BarcodeRow(size_t width) : row_(width) {}
+CBC_BarcodeRow::CBC_BarcodeRow(size_t width)
+    : row_(FixedSizeDataVector<uint8_t>::Zeroed(width)) {}
 
 CBC_BarcodeRow::~CBC_BarcodeRow() = default;
 
diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeRow.h b/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
index fc40701..e67cc43 100644
--- a/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
+++ b/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
@@ -9,7 +9,7 @@
 
 #include <stdint.h>
 
-#include "core/fxcrt/fixed_zeroed_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "third_party/base/containers/span.h"
 
 class CBC_BarcodeRow final {
@@ -21,7 +21,7 @@
   pdfium::span<const uint8_t> GetRow() const { return row_; }
 
  private:
-  FixedZeroedDataVector<uint8_t> row_;
+  FixedSizeDataVector<uint8_t> row_;
   size_t offset_ = 0;
 };
 
diff --git a/fxjs/cjs_app.cpp b/fxjs/cjs_app.cpp
index edfce5c..1af0041 100644
--- a/fxjs/cjs_app.cpp
+++ b/fxjs/cjs_app.cpp
@@ -11,7 +11,7 @@
 #include <algorithm>
 #include <utility>
 
-#include "core/fxcrt/fixed_zeroed_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/stl_util.h"
 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
 #include "fpdfsdk/cpdfsdk_interactiveform.h"
@@ -545,7 +545,7 @@
 
   constexpr int kMaxWideChars = 1024;
   constexpr int kMaxBytes = kMaxWideChars * sizeof(uint16_t);
-  FixedZeroedDataVector<uint8_t> buffer(kMaxBytes);
+  auto buffer = FixedSizeDataVector<uint8_t>::Zeroed(kMaxBytes);
   int byte_length = pRuntime->GetFormFillEnv()->JS_appResponse(
       swQuestion, swTitle, swDefault, swLabel, bPassword, buffer.span());
 
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index bef5532..eef78ea 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -16,7 +16,7 @@
 #include "build/build_config.h"
 #include "core/fxcrt/cfx_read_only_vector_stream.h"
 #include "core/fxcrt/data_vector.h"
-#include "core/fxcrt/fixed_uninit_data_vector.h"
+#include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxcrt/fx_extension.h"
 #include "core/fxcrt/fx_memory_wrappers.h"
@@ -462,10 +462,10 @@
 
 RetainPtr<IFX_SeekableReadStream> CreateFontStream(CFX_FontMapper* pFontMapper,
                                                    size_t index) {
-  FixedUninitDataVector<uint8_t> buffer = pFontMapper->RawBytesForIndex(index);
-  if (buffer.empty())
+  FixedSizeDataVector<uint8_t> buffer = pFontMapper->RawBytesForIndex(index);
+  if (buffer.empty()) {
     return nullptr;
-
+  }
   return pdfium::MakeRetain<CFX_ReadOnlyVectorStream>(std::move(buffer));
 }