Update CPDF_IndirectObjectHolder APIs for unique objects.

Doing so highlights a few places where ownership is dubious.
Add convenience functions to return an unowned reference to
a newly-created indirect object.

Review-Url: https://codereview.chromium.org/2419173002
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp
index 72468e1..e704822 100644
--- a/fpdfsdk/cpdfsdk_baannot.cpp
+++ b/fpdfsdk/cpdfsdk_baannot.cpp
@@ -316,10 +316,9 @@
   }
 
   if (!pStream) {
-    pStream = new CPDF_Stream;
     CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
-    pParentDict->SetReferenceFor(sAPType, pDoc,
-                                 pDoc->AddIndirectObject(pStream));
+    pStream = pDoc->AddIndirectStream();
+    pParentDict->SetReferenceFor(sAPType, pDoc, pStream);
   }
 
   CPDF_Dictionary* pStreamDict = pStream->GetDict();
@@ -354,8 +353,10 @@
   CPDF_Dictionary* pDict = action.GetDict();
   if (pDict != m_pAnnot->GetAnnotDict()->GetDictFor("A")) {
     CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
-    m_pAnnot->GetAnnotDict()->SetReferenceFor("A", pDoc,
-                                              pDoc->AddIndirectObject(pDict));
+
+    // TODO(tsepez): check |pDict| ownership.
+    m_pAnnot->GetAnnotDict()->SetReferenceFor(
+        "A", pDoc, pDoc->AddIndirectObject(UniqueDictionary(pDict)));
   }
 }