Revert of Make Document::m_IconList a vector of IconElements. (patchset #2 id:20001 of https://codereview.chromium.org/2428743004/ )

Reason for revert:
Appears to be blocking the roll due to compile failure https://codereview.chromium.org/2429053002

Attempting to revert to see if the roll will pass.

Original issue's description:
> Make Document::m_IconList a vector of IconElements.
>
> There's no need for std::list<std::unique_ptr<IconElement>>.
>
> Committed: https://pdfium.googlesource.com/pdfium/+/f328d0d378b8df8a3416988d96c34f1d3f9d26d1

TBR=npm@chromium.org,thestig@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://chromiumcodereview.appspot.com/2431913003
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 4b597ae..0b08f66 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -1256,7 +1256,8 @@
     return FALSE;
   }
 
-  m_Icons.push_back(IconElement(swIconName, static_cast<Icon*>(pEmbedObj)));
+  m_IconList.push_back(std::unique_ptr<IconElement>(
+      new IconElement(swIconName, (Icon*)pEmbedObj)));
   return TRUE;
 }
 
@@ -1269,7 +1270,7 @@
   }
 
   CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
-  if (m_Icons.empty()) {
+  if (m_IconList.empty()) {
     vp.GetJSValue()->SetNull(pRuntime);
     return TRUE;
   }
@@ -1277,7 +1278,7 @@
   CJS_Array Icons;
 
   int i = 0;
-  for (const auto& element : m_Icons) {
+  for (const auto& pIconElement : m_IconList) {
     v8::Local<v8::Object> pObj =
         pRuntime->NewFxDynamicObj(CJS_Icon::g_nObjDefnID);
     if (pObj.IsEmpty())
@@ -1288,12 +1289,12 @@
     if (!pJS_Icon)
       return FALSE;
 
-    Icon* pIcon = static_cast<Icon*>(pJS_Icon->GetEmbedObject());
+    Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
     if (!pIcon)
       return FALSE;
 
-    pIcon->SetStream(element.IconStream->GetStream());
-    pIcon->SetIconName(element.IconName);
+    pIcon->SetStream(pIconElement->IconStream->GetStream());
+    pIcon->SetIconName(pIconElement->IconName);
     Icons.SetElement(pRuntime, i++, CJS_Value(pRuntime, pJS_Icon));
   }
 
@@ -1310,34 +1311,35 @@
     return FALSE;
   }
 
-  if (m_Icons.empty())
+  if (m_IconList.empty())
     return FALSE;
 
   CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
   CFX_WideString swIconName = params[0].ToCFXWideString(pRuntime);
 
-  for (const auto& element : m_Icons) {
-    if (element.IconName != swIconName)
-      continue;
+  for (const auto& pIconElement : m_IconList) {
+    if (pIconElement->IconName == swIconName) {
+      Icon* pRetIcon = pIconElement->IconStream;
 
-    v8::Local<v8::Object> pObj =
-        pRuntime->NewFxDynamicObj(CJS_Icon::g_nObjDefnID);
-    if (pObj.IsEmpty())
-      return FALSE;
+      v8::Local<v8::Object> pObj =
+          pRuntime->NewFxDynamicObj(CJS_Icon::g_nObjDefnID);
+      if (pObj.IsEmpty())
+        return FALSE;
 
-    CJS_Icon* pJS_Icon =
-        static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj));
-    if (!pJS_Icon)
-      return FALSE;
+      CJS_Icon* pJS_Icon =
+          static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj));
+      if (!pJS_Icon)
+        return FALSE;
 
-    Icon* pIcon = static_cast<Icon*>(pJS_Icon->GetEmbedObject());
-    if (!pIcon)
-      return FALSE;
+      Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
+      if (!pIcon)
+        return FALSE;
 
-    pIcon->SetIconName(swIconName);
-    pIcon->SetStream(element.IconStream->GetStream());
-    vRet = CJS_Value(pRuntime, pJS_Icon);
-    return TRUE;
+      pIcon->SetIconName(swIconName);
+      pIcon->SetStream(pRetIcon->GetStream());
+      vRet = CJS_Value(pRuntime, pJS_Icon);
+      return TRUE;
+    }
   }
 
   return FALSE;
diff --git a/fpdfsdk/javascript/Document.h b/fpdfsdk/javascript/Document.h
index d7bf230..a72316c 100644
--- a/fpdfsdk/javascript/Document.h
+++ b/fpdfsdk/javascript/Document.h
@@ -18,7 +18,7 @@
 
 class PrintParamsObj : public CJS_EmbedObj {
  public:
-  explicit PrintParamsObj(CJS_Object* pJSObject);
+  PrintParamsObj(CJS_Object* pJSObject);
   ~PrintParamsObj() override {}
 
  public:
@@ -34,8 +34,7 @@
 
 class CJS_PrintParamsObj : public CJS_Object {
  public:
-  explicit CJS_PrintParamsObj(v8::Local<v8::Object> pObject)
-      : CJS_Object(pObject) {}
+  CJS_PrintParamsObj(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
   ~CJS_PrintParamsObj() override {}
 
   DECLARE_JS_CLASS();
@@ -48,8 +47,8 @@
   IconElement(const CFX_WideString& name, Icon* stream)
       : IconName(name), IconStream(stream) {}
 
-  const CFX_WideString IconName;
-  Icon* const IconStream;
+  CFX_WideString IconName;
+  Icon* IconStream;
 };
 
 struct CJS_DelayData;
@@ -58,7 +57,7 @@
 
 class Document : public CJS_EmbedObj {
  public:
-  explicit Document(CJS_Object* pJSObject);
+  Document(CJS_Object* pJSObject);
   ~Document() override;
 
   FX_BOOL ADBE(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
@@ -292,7 +291,7 @@
   CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
   CFX_WideString m_cwBaseURL;
   std::list<std::unique_ptr<CJS_DelayData>> m_DelayData;
-  std::vector<IconElement> m_Icons;
+  std::list<std::unique_ptr<IconElement>> m_IconList;
   bool m_bDelay;
 };