Convert more raw ptrs to UnownedPtr<>

There are still more of these lurking, it would seem.

-- Comment some remaining raw ptrs.
-- Move bool to be near its friends for consistency.

Change-Id: Ifb6c94e0dfa17009aef8bb6df217bfac0f2c1914
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/78830
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h
index 5a4af4e..c299272 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.h
+++ b/core/fpdfapi/render/cpdf_renderstatus.h
@@ -189,8 +189,7 @@
   RetainPtr<CPDF_Dictionary> m_pPageResource;
   std::vector<CPDF_Type3Font*> m_Type3FontCache;
   UnownedPtr<CPDF_RenderContext> const m_pContext;
-  bool m_bStopped = false;
-  CFX_RenderDevice* const m_pDevice;
+  UnownedPtr<CFX_RenderDevice> const m_pDevice;
   CFX_Matrix m_DeviceMatrix;
   CPDF_ClipPath m_LastClipPath;
   UnownedPtr<const CPDF_PageObject> m_pCurObj;
@@ -198,6 +197,7 @@
   CPDF_GraphicStates m_InitialStates;
   std::unique_ptr<CPDF_ImageRenderer> m_pImageRenderer;
   CPDF_Transparency m_Transparency;
+  bool m_bStopped = false;
   bool m_bPrint = false;
   bool m_bDropObjects = false;
   bool m_bStdCS = false;
diff --git a/fxjs/cfxjs_engine.h b/fxjs/cfxjs_engine.h
index 712de73..70ce20e 100644
--- a/fxjs/cfxjs_engine.h
+++ b/fxjs/cfxjs_engine.h
@@ -51,7 +51,7 @@
   CFXJS_ObjDefinition* ObjDefinitionForID(uint32_t id) const;
   uint32_t AssignIDForObjDefinition(std::unique_ptr<CFXJS_ObjDefinition> pDefn);
 
-  const char* const m_Tag;
+  const char* const m_Tag;  // Raw, always a literal.
   std::vector<std::unique_ptr<CFXJS_ObjDefinition>> m_ObjectDefnArray;
   std::unique_ptr<V8TemplateMap> m_pDynamicObjsMap;
   std::unique_ptr<ExtensionIface> m_pFXJSERuntimeData;
diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp
index 86762e3..19dcd20 100644
--- a/fxjs/cjs_global.cpp
+++ b/fxjs/cjs_global.cpp
@@ -183,7 +183,7 @@
 
 CJS_Global::~CJS_Global() {
   DestroyGlobalPersisitentVariables();
-  m_pGlobalData->Release();
+  m_pGlobalData.Release()->Release();
 }
 
 CJS_Result CJS_Global::QueryProperty(const wchar_t* propname) {
diff --git a/fxjs/cjs_global.h b/fxjs/cjs_global.h
index e251a2e..a679229 100644
--- a/fxjs/cjs_global.h
+++ b/fxjs/cjs_global.h
@@ -11,6 +11,7 @@
 #include <memory>
 #include <vector>
 
+#include "core/fxcrt/unowned_ptr.h"
 #include "fxjs/cfx_keyvalue.h"
 #include "fxjs/cjs_object.h"
 #include "fxjs/cjs_result.h"
@@ -90,7 +91,7 @@
   void PutObjectProperty(v8::Local<v8::Object> obj, CFX_KeyValue* pData);
 
   std::map<ByteString, std::unique_ptr<JSGlobalData>> m_MapGlobal;
-  CFX_GlobalData* m_pGlobalData;
+  UnownedPtr<CFX_GlobalData> m_pGlobalData;
   ObservedPtr<CPDFSDK_FormFillEnvironment> m_pFormFillEnv;
 };
 
diff --git a/fxjs/global_timer.h b/fxjs/global_timer.h
index ef6bbb6..61b4089 100644
--- a/fxjs/global_timer.h
+++ b/fxjs/global_timer.h
@@ -7,6 +7,7 @@
 #ifndef FXJS_GLOBAL_TIMER_H_
 #define FXJS_GLOBAL_TIMER_H_
 
+#include "core/fxcrt/unowned_ptr.h"
 #include "fxjs/cjs_runtime.h"
 
 class CJS_App;
@@ -44,7 +45,7 @@
   const uint32_t m_dwTimeOut;
   const WideString m_swJScript;
   ObservedPtr<CJS_Runtime> m_pRuntime;
-  CJS_App* const m_pEmbedApp;
+  UnownedPtr<CJS_App> const m_pEmbedApp;
 };
 
 #endif  // FXJS_GLOBAL_TIMER_H_