Retain retainable HintsScope argument.

Avoids a (probably spurious) clang-tidy warning. But the argument
is always retainable, so there isn't much reason to narrow it to an
ordinary pointer and count on the environment to keep the object
alive.

Change-Id: Ibb5cff571e2a1078f98e0549f9830720a5b9046a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52490
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index 8a3e1b8..d276fc1 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -57,9 +57,9 @@
 
 class HintsScope {
  public:
-  HintsScope(CPDF_ReadValidator* validator,
+  HintsScope(RetainPtr<CPDF_ReadValidator> validator,
              CPDF_DataAvail::DownloadHints* hints)
-      : validator_(validator) {
+      : validator_(std::move(validator)) {
     ASSERT(validator_);
     validator_->SetDownloadHints(hints);
   }
@@ -67,7 +67,7 @@
   ~HintsScope() { validator_->SetDownloadHints(nullptr); }
 
  private:
-  UnownedPtr<CPDF_ReadValidator> validator_;
+  RetainPtr<CPDF_ReadValidator> validator_;
 };
 
 }  // namespace
@@ -104,8 +104,7 @@
   if (!m_dwFileLen)
     return DataError;
 
-  const HintsScope hints_scope(m_pFileRead.Get(), pHints);
-
+  const HintsScope hints_scope(GetValidator(), pHints);
   while (!m_bDocAvail) {
     if (!CheckDocStatus())
       return DataNotAvailable;
@@ -805,8 +804,7 @@
   if (pdfium::ContainsKey(m_pagesLoadState, dwPage))
     return DataAvailable;
 
-  const HintsScope hints_scope(GetValidator().Get(), pHints);
-
+  const HintsScope hints_scope(GetValidator(), pHints);
   if (m_pLinearized) {
     if (dwPage == m_pLinearized->GetFirstPageNo()) {
       auto* pPageDict = m_pDocument->GetPageDictionary(safePage.ValueOrDie());
@@ -954,7 +952,7 @@
 
 CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail(
     DownloadHints* pHints) {
-  const HintsScope hints_scope(GetValidator().Get(), pHints);
+  const HintsScope hints_scope(GetValidator(), pHints);
   return CheckAcroForm();
 }