Use spans and UnownedPtrs in cjpx_decoder.h

Change-Id: I1c9f8221ce7a0e42407e93deec481be2e941cfde
Reviewed-on: https://pdfium-review.googlesource.com/36210
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/core/fxcodec/codec/cjpx_decoder.h b/core/fxcodec/codec/cjpx_decoder.h
index 9de9d6c..5be4b87 100644
--- a/core/fxcodec/codec/cjpx_decoder.h
+++ b/core/fxcodec/codec/cjpx_decoder.h
@@ -12,6 +12,7 @@
 
 #include "core/fxcodec/codec/codec_int.h"
 #include "core/fxcrt/unowned_ptr.h"
+#include "third_party/base/span.h"
 #include "third_party/libopenjpeg20/openjpeg.h"
 
 class CPDF_ColorSpace;
@@ -21,20 +22,18 @@
   explicit CJPX_Decoder(CPDF_ColorSpace* cs);
   ~CJPX_Decoder();
 
-  bool Init(const unsigned char* src_data, uint32_t src_size);
+  bool Init(pdfium::span<const uint8_t> src_data);
   void GetInfo(uint32_t* width, uint32_t* height, uint32_t* components);
   bool Decode(uint8_t* dest_buf,
               uint32_t pitch,
               const std::vector<uint8_t>& offsets);
 
  private:
-  const uint8_t* m_SrcData;
-  uint32_t m_SrcSize;
-  // TODO(rharrison): Convert these to unowned ptrs, if possible.
-  opj_image_t* m_Image;
-  opj_codec_t* m_Codec;
+  pdfium::span<const uint8_t> m_SrcData;
+  UnownedPtr<opj_image_t> m_Image;
+  UnownedPtr<opj_codec_t> m_Codec;
   std::unique_ptr<DecodeData> m_DecodeData;
-  opj_stream_t* m_Stream;
+  UnownedPtr<opj_stream_t> m_Stream;
   opj_dparameters_t m_Parameters;
   UnownedPtr<const CPDF_ColorSpace> const m_ColorSpace;
 };