Fold CPDF_Document::LoadDocInternal() into caller.

It is only called in one place. It also has a superfluous test and
return as it is currently written introduced in
    https://pdfium-review.googlesource.com/c/pdfium/+/35490

Change-Id: Iba1aaac6e93c261f71729f39e51741f19c5dbb57
Reviewed-on: https://pdfium-review.googlesource.com/41071
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 1dd801d..63556de 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -196,22 +196,15 @@
   return m_pParser ? m_pParser->ParseIndirectObject(objnum) : nullptr;
 }
 
-void CPDF_Document::LoadDocInternal() {
+bool CPDF_Document::TryInit() {
   SetLastObjNum(m_pParser->GetLastObjNum());
 
   CPDF_Object* pRootObj = GetOrParseIndirectObject(m_pParser->GetRootObjNum());
-  if (!pRootObj)
-    return;
+  if (pRootObj)
+    m_pRootDict = pRootObj->GetDict();
 
-  m_pRootDict = pRootObj->GetDict();
-  if (!m_pRootDict)
-    return;
-}
-
-bool CPDF_Document::TryInit() {
-  LoadDocInternal();
   LoadPages();
-  return GetRoot() && (GetPageCount() > 0);
+  return GetRoot() && GetPageCount() > 0;
 }
 
 CPDF_Parser::Error CPDF_Document::LoadDoc(
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index 1cbc5fc..09bfb21 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -135,7 +135,6 @@
                     int* index,
                     int level) const;
   std::unique_ptr<CPDF_Object> ParseIndirectObject(uint32_t objnum) override;
-  void LoadDocInternal();
   size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict);
   const CPDF_Dictionary* GetPagesDict() const;
   CPDF_Dictionary* GetPagesDict();