Use DataVector in CPDF_FlateEncoder.

Switch CPDF_FlateEncoder to use DataVector instead of std::unique_ptr.
Then the OwnedData struct which holds the std::unique_ptr and associated
size_t can go away. To avoid having to copy data between the 2 types of
data containers:

1) Switch FlateEncode() and FlateModule::Encode() to return DataVector.
2) Switch another use case to just use the data in the CPDF_StreamAcc
   that CPDF_FlateEncoder owns, instead of taking the data. This may
   save another data copy, as CPDF_StreamAcc sometimes has to make a
   copy when giving up its data.

To update the other use of FlateModule in Windows-only code in a sane
way, change BasicModule::RunLengthEncode() to also return a DataVector.
Then overhaul CFX_PSRenderer::PSCompressData() to make memory ownership
clearer.

Bug: pdfium:1872
Change-Id: I2d1752dbc6725a45726cf8c88cd14a7fdc1da38b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/97490
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcodec/basic/basicmodule.h b/core/fxcodec/basic/basicmodule.h
index 30e4f10..a44621f 100644
--- a/core/fxcodec/basic/basicmodule.h
+++ b/core/fxcodec/basic/basicmodule.h
@@ -11,6 +11,7 @@
 
 #include <memory>
 
+#include "core/fxcrt/data_vector.h"
 #include "core/fxcrt/fx_memory_wrappers.h"
 #include "third_party/base/span.h"
 
@@ -27,9 +28,8 @@
       int nComps,
       int bpc);
 
-  static bool RunLengthEncode(pdfium::span<const uint8_t> src_span,
-                              std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf,
-                              uint32_t* dest_size);
+  static DataVector<uint8_t> RunLengthEncode(
+      pdfium::span<const uint8_t> src_span);
 
   static bool A85Encode(pdfium::span<const uint8_t> src_span,
                         std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf,