Rename CFX_RetainPtr to RetainPtr

This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt
namespace.

Bug: pdfium:898
Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e
Reviewed-on: https://pdfium-review.googlesource.com/14616
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index c3143b5..7c56777 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -27,7 +27,7 @@
 
 class CFX_FileBufferArchive : public IFX_ArchiveStream {
  public:
-  explicit CFX_FileBufferArchive(const CFX_RetainPtr<IFX_WriteStream>& archive);
+  explicit CFX_FileBufferArchive(const RetainPtr<IFX_WriteStream>& archive);
   ~CFX_FileBufferArchive() override;
 
   bool WriteBlock(const void* pBuf, size_t size) override;
@@ -43,11 +43,11 @@
   FX_FILESIZE offset_;
   size_t current_length_;
   std::vector<uint8_t> buffer_;
-  CFX_RetainPtr<IFX_WriteStream> backing_file_;
+  RetainPtr<IFX_WriteStream> backing_file_;
 };
 
 CFX_FileBufferArchive::CFX_FileBufferArchive(
-    const CFX_RetainPtr<IFX_WriteStream>& file)
+    const RetainPtr<IFX_WriteStream>& file)
     : offset_(0),
       current_length_(0),
       buffer_(kArchiveBufferSize),
@@ -139,7 +139,7 @@
 }  // namespace
 
 CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc,
-                           const CFX_RetainPtr<IFX_WriteStream>& archive)
+                           const RetainPtr<IFX_WriteStream>& archive)
     : m_pDocument(pDoc),
       m_pParser(pDoc->GetParser()),
       m_bSecurityChanged(false),
@@ -437,8 +437,7 @@
   }
   if (m_iStage == 15) {
     if (IsOriginal() && m_SavedOffset > 0) {
-      CFX_RetainPtr<IFX_SeekableReadStream> pSrcFile =
-          m_pParser->GetFileAccess();
+      RetainPtr<IFX_SeekableReadStream> pSrcFile = m_pParser->GetFileAccess();
       std::vector<uint8_t> buffer(4096);
       FX_FILESIZE src_size = m_SavedOffset;
       while (src_size) {
diff --git a/core/fpdfapi/edit/cpdf_creator.h b/core/fpdfapi/edit/cpdf_creator.h
index d97ee01..3ea5da8 100644
--- a/core/fpdfapi/edit/cpdf_creator.h
+++ b/core/fpdfapi/edit/cpdf_creator.h
@@ -11,9 +11,9 @@
 #include <memory>
 #include <vector>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
 #include "core/fxcrt/fx_stream.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_Array;
 class CPDF_CryptoHandler;
@@ -28,7 +28,7 @@
 class CPDF_Creator {
  public:
   explicit CPDF_Creator(CPDF_Document* pDoc,
-                        const CFX_RetainPtr<IFX_WriteStream>& archive);
+                        const RetainPtr<IFX_WriteStream>& archive);
   ~CPDF_Creator();
 
   void RemoveSecurity();
@@ -85,7 +85,7 @@
   bool m_bSecurityChanged;
   CFX_UnownedPtr<CPDF_Dictionary> m_pEncryptDict;
   uint32_t m_dwEncryptObjNum;
-  CFX_RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler;
+  RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler;
   CFX_UnownedPtr<CPDF_Object> m_pMetadata;
   uint32_t m_dwLastObjNum;
   std::unique_ptr<IFX_ArchiveStream> m_Archive;
diff --git a/core/fpdfapi/edit/cpdf_flateencoder.h b/core/fpdfapi/edit/cpdf_flateencoder.h
index 3698414..887816c 100644
--- a/core/fpdfapi/edit/cpdf_flateencoder.h
+++ b/core/fpdfapi/edit/cpdf_flateencoder.h
@@ -9,9 +9,9 @@
 
 #include "core/fpdfapi/parser/cpdf_dictionary.h"
 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/maybe_owned.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_Stream;
 
@@ -31,7 +31,7 @@
   uint32_t m_dwSize;
   MaybeOwned<uint8_t, FxFreeDeleter> m_pData;
   MaybeOwned<CPDF_Dictionary> m_pDict;
-  CFX_RetainPtr<CPDF_StreamAcc> m_pAcc;
+  RetainPtr<CPDF_StreamAcc> m_pAcc;
 };
 
 #endif  // CORE_FPDFAPI_EDIT_CPDF_FLATEENCODER_H_
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index c0c6604..fc7e97f 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -175,7 +175,7 @@
   }
   *buf << "q " << pImageObj->matrix() << " cm ";
 
-  CFX_RetainPtr<CPDF_Image> pImage = pImageObj->GetImage();
+  RetainPtr<CPDF_Image> pImage = pImageObj->GetImage();
   if (pImage->IsInline())
     return;
 
diff --git a/core/fpdfapi/font/cpdf_cidfont.h b/core/fpdfapi/font/cpdf_cidfont.h
index f4ddcfd..653cc5f 100644
--- a/core/fpdfapi/font/cpdf_cidfont.h
+++ b/core/fpdfapi/font/cpdf_cidfont.h
@@ -11,10 +11,10 @@
 #include <vector>
 
 #include "core/fpdfapi/font/cpdf_font.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
 enum CIDSet : uint8_t {
   CIDSET_UNKNOWN,
@@ -73,13 +73,13 @@
   void LoadSubstFont();
   wchar_t GetUnicodeFromCharCode(uint32_t charcode) const;
 
-  CFX_RetainPtr<CPDF_CMap> m_pCMap;
+  RetainPtr<CPDF_CMap> m_pCMap;
   CFX_UnownedPtr<CPDF_CID2UnicodeMap> m_pCID2UnicodeMap;
   CIDSet m_Charset;
   bool m_bType1;
   bool m_bCIDIsGID;
   uint16_t m_DefaultWidth;
-  CFX_RetainPtr<CPDF_StreamAcc> m_pStreamAcc;
+  RetainPtr<CPDF_StreamAcc> m_pStreamAcc;
   bool m_bAnsiWidthsFixed;
   FX_RECT m_CharBBox[256];
   std::vector<uint32_t> m_WidthList;
diff --git a/core/fpdfapi/font/cpdf_cmap.h b/core/fpdfapi/font/cpdf_cmap.h
index 3e23d03..6e90c39 100644
--- a/core/fpdfapi/font/cpdf_cmap.h
+++ b/core/fpdfapi/font/cpdf_cmap.h
@@ -10,7 +10,7 @@
 #include <vector>
 
 #include "core/fpdfapi/font/cpdf_cidfont.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_CMapManager;
 struct FXCMAP_CMap;
@@ -26,7 +26,7 @@
   CIDCODING_UTF16,
 };
 
-class CPDF_CMap : public CFX_Retainable {
+class CPDF_CMap : public Retainable {
  public:
   enum CodingScheme : uint8_t {
     OneByte,
@@ -48,7 +48,7 @@
   };
 
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   void LoadPredefined(CPDF_CMapManager* pMgr,
                       const ByteString& name,
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.cpp b/core/fpdfapi/font/cpdf_cmapmanager.cpp
index a449db6..53183af 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.cpp
+++ b/core/fpdfapi/font/cpdf_cmapmanager.cpp
@@ -16,21 +16,20 @@
 
 CPDF_CMapManager::~CPDF_CMapManager() {}
 
-CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(
-    const ByteString& name,
-    bool bPromptCJK) {
+RetainPtr<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(const ByteString& name,
+                                                         bool bPromptCJK) {
   auto it = m_CMaps.find(name);
   if (it != m_CMaps.end())
     return it->second;
 
-  CFX_RetainPtr<CPDF_CMap> pCMap = LoadPredefinedCMap(name, bPromptCJK);
+  RetainPtr<CPDF_CMap> pCMap = LoadPredefinedCMap(name, bPromptCJK);
   if (!name.IsEmpty())
     m_CMaps[name] = pCMap;
 
   return pCMap;
 }
 
-CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(
+RetainPtr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(
     const ByteString& name,
     bool bPromptCJK) {
   const char* pname = name.c_str();
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.h b/core/fpdfapi/font/cpdf_cmapmanager.h
index 6a860e6..089eb3d 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.h
+++ b/core/fpdfapi/font/cpdf_cmapmanager.h
@@ -12,24 +12,24 @@
 
 #include "core/fpdfapi/font/cpdf_cidfont.h"
 #include "core/fxcrt/bytestring.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_CMapManager {
  public:
   CPDF_CMapManager();
   ~CPDF_CMapManager();
 
-  CFX_RetainPtr<CPDF_CMap> GetPredefinedCMap(const ByteString& name,
-                                             bool bPromptCJK);
+  RetainPtr<CPDF_CMap> GetPredefinedCMap(const ByteString& name,
+                                         bool bPromptCJK);
   CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK);
 
  private:
-  CFX_RetainPtr<CPDF_CMap> LoadPredefinedCMap(const ByteString& name,
-                                              bool bPromptCJK);
+  RetainPtr<CPDF_CMap> LoadPredefinedCMap(const ByteString& name,
+                                          bool bPromptCJK);
   std::unique_ptr<CPDF_CID2UnicodeMap> LoadCID2UnicodeMap(CIDSet charset,
                                                           bool bPromptCJK);
 
-  std::map<ByteString, CFX_RetainPtr<CPDF_CMap>> m_CMaps;
+  std::map<ByteString, RetainPtr<CPDF_CMap>> m_CMaps;
   std::unique_ptr<CPDF_CID2UnicodeMap> m_CID2UnicodeMaps[6];
 };
 
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index e92e2f2..570d5d5 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -111,7 +111,7 @@
   CFX_Font m_Font;
   std::vector<std::unique_ptr<CFX_Font>> m_FontFallbacks;
   ByteString m_BaseFont;
-  CFX_RetainPtr<CPDF_StreamAcc> m_pFontFile;
+  RetainPtr<CPDF_StreamAcc> m_pFontFile;
   CPDF_Dictionary* m_pFontDict;
   mutable std::unique_ptr<CPDF_ToUnicodeMap> m_pToUnicodeMap;
   mutable bool m_bToUnicodeLoaded;
diff --git a/core/fpdfapi/font/cpdf_type3char.cpp b/core/fpdfapi/font/cpdf_type3char.cpp
index e11193f..c0ed88d 100644
--- a/core/fpdfapi/font/cpdf_type3char.cpp
+++ b/core/fpdfapi/font/cpdf_type3char.cpp
@@ -35,7 +35,7 @@
     // |pSource| actually gets assigned a CPDF_DIBSource, which has pointers
     // into objects owned by |m_pForm|. Make sure it is out of scope before
     // clearing the form.
-    CFX_RetainPtr<CFX_DIBSource> pSource =
+    RetainPtr<CFX_DIBSource> pSource =
         pPageObj->AsImage()->GetImage()->LoadDIBSource();
 
     // Clone() is non-virtual, and can't be overloaded by CPDF_DIBSource to
diff --git a/core/fpdfapi/font/cpdf_type3char.h b/core/fpdfapi/font/cpdf_type3char.h
index 9f2f94f..444c993 100644
--- a/core/fpdfapi/font/cpdf_type3char.h
+++ b/core/fpdfapi/font/cpdf_type3char.h
@@ -9,9 +9,9 @@
 
 #include <memory>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CFX_DIBitmap;
 class CPDF_Form;
@@ -25,7 +25,7 @@
   bool LoadBitmap(CPDF_RenderContext* pContext);
 
   std::unique_ptr<CPDF_Form> m_pForm;
-  CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+  RetainPtr<CFX_DIBitmap> m_pBitmap;
   bool m_bColored;
   int m_Width;
   CFX_Matrix m_ImageMatrix;
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index 5455d4d..f4980fb 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -177,7 +177,7 @@
   void PopulateRanges(CPDF_Dictionary* pDict);
 
   MaybeOwned<CPDF_ColorSpace> m_pAlterCS;
-  CFX_RetainPtr<CPDF_IccProfile> m_pProfile;
+  RetainPtr<CPDF_IccProfile> m_pProfile;
   uint8_t* m_pCache;
   float* m_pRanges;
 };
diff --git a/core/fpdfapi/page/cpdf_contentparser.h b/core/fpdfapi/page/cpdf_contentparser.h
index b201f95..c14f451 100644
--- a/core/fpdfapi/page/cpdf_contentparser.h
+++ b/core/fpdfapi/page/cpdf_contentparser.h
@@ -54,8 +54,8 @@
   bool m_bForm;
   CFX_UnownedPtr<CPDF_Type3Char> m_pType3Char;
   uint32_t m_nStreams;
-  CFX_RetainPtr<CPDF_StreamAcc> m_pSingleStream;
-  std::vector<CFX_RetainPtr<CPDF_StreamAcc>> m_StreamArray;
+  RetainPtr<CPDF_StreamAcc> m_pSingleStream;
+  std::vector<RetainPtr<CPDF_StreamAcc>> m_StreamArray;
   uint8_t* m_pData;
   uint32_t m_Size;
   uint32_t m_CurrentOffset;
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index 08345da..31d6bae 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -389,7 +389,7 @@
   pPattern->clear();
 }
 
-CFX_RetainPtr<CPDF_Image> CPDF_DocPageData::GetImage(uint32_t dwStreamObjNum) {
+RetainPtr<CPDF_Image> CPDF_DocPageData::GetImage(uint32_t dwStreamObjNum) {
   ASSERT(dwStreamObjNum);
   auto it = m_ImageMap.find(dwStreamObjNum);
   if (it != m_ImageMap.end())
@@ -407,7 +407,7 @@
     m_ImageMap.erase(it);
 }
 
-CFX_RetainPtr<CPDF_IccProfile> CPDF_DocPageData::GetIccProfile(
+RetainPtr<CPDF_IccProfile> CPDF_DocPageData::GetIccProfile(
     CPDF_Stream* pProfileStream) {
   if (!pProfileStream)
     return nullptr;
@@ -443,7 +443,7 @@
     m_IccProfileMap.erase(it);
 }
 
-CFX_RetainPtr<CPDF_StreamAcc> CPDF_DocPageData::GetFontFileStreamAcc(
+RetainPtr<CPDF_StreamAcc> CPDF_DocPageData::GetFontFileStreamAcc(
     CPDF_Stream* pFontStream) {
   ASSERT(pFontStream);
   auto it = m_FontFileMap.find(pFontStream);
diff --git a/core/fpdfapi/page/cpdf_docpagedata.h b/core/fpdfapi/page/cpdf_docpagedata.h
index 3f1d392..175bee2 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.h
+++ b/core/fpdfapi/page/cpdf_docpagedata.h
@@ -53,13 +53,13 @@
                            const CFX_Matrix& matrix);
   void ReleasePattern(const CPDF_Object* pPatternObj);
 
-  CFX_RetainPtr<CPDF_Image> GetImage(uint32_t dwStreamObjNum);
+  RetainPtr<CPDF_Image> GetImage(uint32_t dwStreamObjNum);
   void MaybePurgeImage(uint32_t dwStreamObjNum);
 
-  CFX_RetainPtr<CPDF_IccProfile> GetIccProfile(CPDF_Stream* pProfileStream);
+  RetainPtr<CPDF_IccProfile> GetIccProfile(CPDF_Stream* pProfileStream);
   void MaybePurgeIccProfile(CPDF_Stream* pProfileStream);
 
-  CFX_RetainPtr<CPDF_StreamAcc> GetFontFileStreamAcc(CPDF_Stream* pFontStream);
+  RetainPtr<CPDF_StreamAcc> GetFontFileStreamAcc(CPDF_Stream* pFontStream);
   void MaybePurgeFontFileStreamAcc(const CPDF_Stream* pFontStream);
 
   CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const;
@@ -72,10 +72,10 @@
   CFX_UnownedPtr<CPDF_Document> const m_pPDFDoc;
   std::map<ByteString, CPDF_Stream*> m_HashProfileMap;
   std::map<const CPDF_Object*, CPDF_CountedColorSpace*> m_ColorSpaceMap;
-  std::map<const CPDF_Stream*, CFX_RetainPtr<CPDF_StreamAcc>> m_FontFileMap;
+  std::map<const CPDF_Stream*, RetainPtr<CPDF_StreamAcc>> m_FontFileMap;
   std::map<const CPDF_Dictionary*, CPDF_CountedFont*> m_FontMap;
-  std::map<const CPDF_Stream*, CFX_RetainPtr<CPDF_IccProfile>> m_IccProfileMap;
-  std::map<uint32_t, CFX_RetainPtr<CPDF_Image>> m_ImageMap;
+  std::map<const CPDF_Stream*, RetainPtr<CPDF_IccProfile>> m_IccProfileMap;
+  std::map<uint32_t, RetainPtr<CPDF_Image>> m_ImageMap;
   std::map<const CPDF_Object*, CPDF_CountedPattern*> m_PatternMap;
 };
 
diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp
index c5c259f..6f4062f 100644
--- a/core/fpdfapi/page/cpdf_generalstate.cpp
+++ b/core/fpdfapi/page/cpdf_generalstate.cpp
@@ -161,13 +161,13 @@
   m_Ref.GetPrivateCopy()->m_pTR = pObject;
 }
 
-CFX_RetainPtr<CPDF_TransferFunc> CPDF_GeneralState::GetTransferFunc() const {
+RetainPtr<CPDF_TransferFunc> CPDF_GeneralState::GetTransferFunc() const {
   const StateData* pData = m_Ref.GetObject();
   return pData ? pData->m_pTransferFunc : nullptr;
 }
 
 void CPDF_GeneralState::SetTransferFunc(
-    const CFX_RetainPtr<CPDF_TransferFunc>& pFunc) {
+    const RetainPtr<CPDF_TransferFunc>& pFunc) {
   m_Ref.GetPrivateCopy()->m_pTransferFunc = pFunc;
 }
 
diff --git a/core/fpdfapi/page/cpdf_generalstate.h b/core/fpdfapi/page/cpdf_generalstate.h
index 95f5978..a55f1a7 100644
--- a/core/fpdfapi/page/cpdf_generalstate.h
+++ b/core/fpdfapi/page/cpdf_generalstate.h
@@ -43,8 +43,8 @@
   CPDF_Object* GetTR() const;
   void SetTR(CPDF_Object* pObject);
 
-  CFX_RetainPtr<CPDF_TransferFunc> GetTransferFunc() const;
-  void SetTransferFunc(const CFX_RetainPtr<CPDF_TransferFunc>& pFunc);
+  RetainPtr<CPDF_TransferFunc> GetTransferFunc() const;
+  void SetTransferFunc(const RetainPtr<CPDF_TransferFunc>& pFunc);
 
   void SetBlendMode(const ByteString& mode);
 
@@ -90,7 +90,7 @@
     float m_StrokeAlpha;
     float m_FillAlpha;
     CFX_UnownedPtr<CPDF_Object> m_pTR;
-    CFX_RetainPtr<CPDF_TransferFunc> m_pTransferFunc;
+    RetainPtr<CPDF_TransferFunc> m_pTransferFunc;
     CFX_Matrix m_Matrix;
     int m_RenderIntent;
     bool m_StrokeAdjust;
diff --git a/core/fpdfapi/page/cpdf_iccprofile.h b/core/fpdfapi/page/cpdf_iccprofile.h
index 0226a56..57d7c3e 100644
--- a/core/fpdfapi/page/cpdf_iccprofile.h
+++ b/core/fpdfapi/page/cpdf_iccprofile.h
@@ -9,16 +9,16 @@
 
 #include <memory>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CLcmsCmm;
 class CPDF_Stream;
 
-class CPDF_IccProfile : public CFX_Retainable {
+class CPDF_IccProfile : public Retainable {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   CPDF_Stream* GetStream() const { return m_pStream.Get(); }
   bool IsValid() const { return IsSRGB() || IsSupported(); }
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index f748b69..4c08336 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -117,8 +117,7 @@
   return pDict;
 }
 
-void CPDF_Image::SetJpegImage(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) {
+void CPDF_Image::SetJpegImage(const RetainPtr<IFX_SeekableReadStream>& pFile) {
   uint32_t size = pdfium::base::checked_cast<uint32_t>(pFile->GetSize());
   if (!size)
     return;
@@ -142,7 +141,7 @@
 }
 
 void CPDF_Image::SetJpegImageInline(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) {
+    const RetainPtr<IFX_SeekableReadStream>& pFile) {
   uint32_t size = pdfium::base::checked_cast<uint32_t>(pFile->GetSize());
   if (!size)
     return;
@@ -158,7 +157,7 @@
   m_pStream->InitStream(&(data[0]), size, std::move(pDict));
 }
 
-void CPDF_Image::SetImage(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
+void CPDF_Image::SetImage(const RetainPtr<CFX_DIBitmap>& pBitmap) {
   int32_t BitmapWidth = pBitmap->GetWidth();
   int32_t BitmapHeight = pBitmap->GetHeight();
   if (BitmapWidth < 1 || BitmapHeight < 1)
@@ -250,7 +249,7 @@
     bCopyWithoutAlpha = false;
   }
 
-  CFX_RetainPtr<CFX_DIBitmap> pMaskBitmap;
+  RetainPtr<CFX_DIBitmap> pMaskBitmap;
   if (pBitmap->HasAlpha())
     pMaskBitmap = pBitmap->CloneAlphaMask();
 
@@ -323,12 +322,12 @@
 }
 
 void CPDF_Image::ResetCache(CPDF_Page* pPage,
-                            const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
-  CFX_RetainPtr<CPDF_Image> pHolder(this);
+                            const RetainPtr<CFX_DIBitmap>& pBitmap) {
+  RetainPtr<CPDF_Image> pHolder(this);
   pPage->GetRenderCache()->ResetBitmap(pHolder, pBitmap);
 }
 
-CFX_RetainPtr<CFX_DIBSource> CPDF_Image::LoadDIBSource() const {
+RetainPtr<CFX_DIBSource> CPDF_Image::LoadDIBSource() const {
   auto source = pdfium::MakeRetain<CPDF_DIBSource>();
   if (!source->Load(m_pDocument.Get(), m_pStream.Get()))
     return nullptr;
@@ -336,11 +335,11 @@
   return source;
 }
 
-CFX_RetainPtr<CFX_DIBSource> CPDF_Image::DetachBitmap() {
+RetainPtr<CFX_DIBSource> CPDF_Image::DetachBitmap() {
   return std::move(m_pDIBSource);
 }
 
-CFX_RetainPtr<CFX_DIBSource> CPDF_Image::DetachMask() {
+RetainPtr<CFX_DIBSource> CPDF_Image::DetachMask() {
   return std::move(m_pMask);
 }
 
@@ -367,7 +366,7 @@
 }
 
 bool CPDF_Image::Continue(IFX_PauseIndicator* pPause) {
-  CFX_RetainPtr<CPDF_DIBSource> pSource = m_pDIBSource.As<CPDF_DIBSource>();
+  RetainPtr<CPDF_DIBSource> pSource = m_pDIBSource.As<CPDF_DIBSource>();
   int ret = pSource->ContinueLoadDIBSource(pPause);
   if (!ret) {
     m_pDIBSource.Reset();
diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h
index ddfd95c..51f342f 100644
--- a/core/fpdfapi/page/cpdf_image.h
+++ b/core/fpdfapi/page/cpdf_image.h
@@ -10,10 +10,10 @@
 #include <memory>
 
 #include "core/fpdfapi/parser/cpdf_stream.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
 #include "core/fxcrt/fx_system.h"
 #include "core/fxcrt/maybe_owned.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CFX_DIBSource;
 class CFX_DIBitmap;
@@ -22,10 +22,10 @@
 class IFX_PauseIndicator;
 class IFX_SeekableReadStream;
 
-class CPDF_Image : public CFX_Retainable {
+class CPDF_Image : public Retainable {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   void ConvertStreamToIndirectObject();
 
@@ -44,25 +44,24 @@
   bool IsMask() const { return m_bIsMask; }
   bool IsInterpol() const { return m_bInterpolate; }
 
-  CFX_RetainPtr<CFX_DIBSource> LoadDIBSource() const;
+  RetainPtr<CFX_DIBSource> LoadDIBSource() const;
 
-  void SetImage(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap);
-  void SetJpegImage(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile);
-  void SetJpegImageInline(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile);
+  void SetImage(const RetainPtr<CFX_DIBitmap>& pDIBitmap);
+  void SetJpegImage(const RetainPtr<IFX_SeekableReadStream>& pFile);
+  void SetJpegImageInline(const RetainPtr<IFX_SeekableReadStream>& pFile);
 
-  void ResetCache(CPDF_Page* pPage,
-                  const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap);
+  void ResetCache(CPDF_Page* pPage, const RetainPtr<CFX_DIBitmap>& pDIBitmap);
   bool StartLoadDIBSource(CPDF_Dictionary* pFormResource,
                           CPDF_Dictionary* pPageResource,
                           bool bStdCS = false,
                           uint32_t GroupFamily = 0,
                           bool bLoadMask = false);
   bool Continue(IFX_PauseIndicator* pPause);
-  CFX_RetainPtr<CFX_DIBSource> DetachBitmap();
-  CFX_RetainPtr<CFX_DIBSource> DetachMask();
+  RetainPtr<CFX_DIBSource> DetachBitmap();
+  RetainPtr<CFX_DIBSource> DetachMask();
 
-  CFX_RetainPtr<CFX_DIBSource> m_pDIBSource;
-  CFX_RetainPtr<CFX_DIBSource> m_pMask;
+  RetainPtr<CFX_DIBSource> m_pDIBSource;
+  RetainPtr<CFX_DIBSource> m_pMask;
   uint32_t m_MatteColor = 0;
 
  private:
diff --git a/core/fpdfapi/page/cpdf_imageobject.cpp b/core/fpdfapi/page/cpdf_imageobject.cpp
index dd07385..3b5a740 100644
--- a/core/fpdfapi/page/cpdf_imageobject.cpp
+++ b/core/fpdfapi/page/cpdf_imageobject.cpp
@@ -45,7 +45,7 @@
       m_Matrix.TransformRect(0.f, 1.f, 1.f, 0.f);
 }
 
-void CPDF_ImageObject::SetImage(const CFX_RetainPtr<CPDF_Image>& pImage) {
+void CPDF_ImageObject::SetImage(const RetainPtr<CPDF_Image>& pImage) {
   MaybePurgeCache();
   m_pImage = pImage;
 }
diff --git a/core/fpdfapi/page/cpdf_imageobject.h b/core/fpdfapi/page/cpdf_imageobject.h
index 484fb7b..16a506e 100644
--- a/core/fpdfapi/page/cpdf_imageobject.h
+++ b/core/fpdfapi/page/cpdf_imageobject.h
@@ -27,8 +27,8 @@
   const CPDF_ImageObject* AsImage() const override;
 
   void CalcBoundingBox();
-  CFX_RetainPtr<CPDF_Image> GetImage() const { return m_pImage; }
-  void SetImage(const CFX_RetainPtr<CPDF_Image>& pImage);
+  RetainPtr<CPDF_Image> GetImage() const { return m_pImage; }
+  void SetImage(const RetainPtr<CPDF_Image>& pImage);
   void set_matrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
   const CFX_Matrix& matrix() const { return m_Matrix; }
 
@@ -36,7 +36,7 @@
   void MaybePurgeCache();
 
   CFX_Matrix m_Matrix;
-  CFX_RetainPtr<CPDF_Image> m_pImage;
+  RetainPtr<CPDF_Image> m_pImage;
 };
 
 #endif  // CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_
diff --git a/core/fpdfapi/page/cpdf_meshstream.h b/core/fpdfapi/page/cpdf_meshstream.h
index 0a06381..ddbe31f 100644
--- a/core/fpdfapi/page/cpdf_meshstream.h
+++ b/core/fpdfapi/page/cpdf_meshstream.h
@@ -80,7 +80,7 @@
   float m_ymax;
   float m_ColorMin[kMaxComponents];
   float m_ColorMax[kMaxComponents];
-  CFX_RetainPtr<CPDF_StreamAcc> m_pStream;
+  RetainPtr<CPDF_StreamAcc> m_pStream;
   std::unique_ptr<CFX_BitStream> m_BitStream;
 };
 
diff --git a/core/fpdfapi/page/cpdf_sampledfunc.h b/core/fpdfapi/page/cpdf_sampledfunc.h
index 59fe1ef..d6dfed5 100644
--- a/core/fpdfapi/page/cpdf_sampledfunc.h
+++ b/core/fpdfapi/page/cpdf_sampledfunc.h
@@ -11,7 +11,7 @@
 
 #include "core/fpdfapi/page/cpdf_function.h"
 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_SampledFunc : public CPDF_Function {
  public:
@@ -37,16 +37,14 @@
     return m_EncodeInfo;
   }
   uint32_t GetBitsPerSample() const { return m_nBitsPerSample; }
-  CFX_RetainPtr<CPDF_StreamAcc> GetSampleStream() const {
-    return m_pSampleStream;
-  }
+  RetainPtr<CPDF_StreamAcc> GetSampleStream() const { return m_pSampleStream; }
 
  private:
   std::vector<SampleEncodeInfo> m_EncodeInfo;
   std::vector<SampleDecodeInfo> m_DecodeInfo;
   uint32_t m_nBitsPerSample;
   uint32_t m_SampleMax;
-  CFX_RetainPtr<CPDF_StreamAcc> m_pSampleStream;
+  RetainPtr<CPDF_StreamAcc> m_pSampleStream;
 };
 
 #endif  // CORE_FPDFAPI_PAGE_CPDF_SAMPLEDFUNC_H_
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index c58e456..47aa209 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -806,7 +806,7 @@
 }
 
 CPDF_ImageObject* CPDF_StreamContentParser::AddImage(
-    const CFX_RetainPtr<CPDF_Image>& pImage) {
+    const RetainPtr<CPDF_Image>& pImage) {
   if (!pImage)
     return nullptr;
 
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h
index c30c6b7..59bd7bd 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.h
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.h
@@ -106,7 +106,7 @@
   void AddPathObject(int FillType, bool bStroke);
   CPDF_ImageObject* AddImage(std::unique_ptr<CPDF_Stream> pStream);
   CPDF_ImageObject* AddImage(uint32_t streamObjNum);
-  CPDF_ImageObject* AddImage(const CFX_RetainPtr<CPDF_Image>& pImage);
+  CPDF_ImageObject* AddImage(const RetainPtr<CPDF_Image>& pImage);
 
   void AddForm(CPDF_Stream* pStream);
   void SetGraphicStates(CPDF_PageObject* pObj,
@@ -217,7 +217,7 @@
   float m_PathCurrentY;
   uint8_t m_PathClipType;
   ByteString m_LastImageName;
-  CFX_RetainPtr<CPDF_Image> m_pLastImage;
+  RetainPtr<CPDF_Image> m_pLastImage;
   bool m_bColored;
   float m_Type3Data[6];
   bool m_bResourceMissing;
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index 1f84f56..1d5cf8a 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -30,7 +30,7 @@
 }
 
 std::unique_ptr<CFDF_Document> CFDF_Document::ParseFile(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) {
+    const RetainPtr<IFX_SeekableReadStream>& pFile) {
   if (!pFile)
     return nullptr;
 
@@ -46,7 +46,7 @@
 }
 
 void CFDF_Document::ParseStream(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) {
+    const RetainPtr<IFX_SeekableReadStream>& pFile) {
   m_pFile = pFile;
   CPDF_SyntaxParser parser;
   parser.InitParser(m_pFile, 0);
diff --git a/core/fpdfapi/parser/cfdf_document.h b/core/fpdfapi/parser/cfdf_document.h
index a24415b..9065621 100644
--- a/core/fpdfapi/parser/cfdf_document.h
+++ b/core/fpdfapi/parser/cfdf_document.h
@@ -20,7 +20,7 @@
  public:
   static std::unique_ptr<CFDF_Document> CreateNewDoc();
   static std::unique_ptr<CFDF_Document> ParseFile(
-      const CFX_RetainPtr<IFX_SeekableReadStream>& pFile);
+      const RetainPtr<IFX_SeekableReadStream>& pFile);
   static std::unique_ptr<CFDF_Document> ParseMemory(uint8_t* pData,
                                                     uint32_t size);
 
@@ -31,10 +31,10 @@
   CPDF_Dictionary* GetRoot() const { return m_pRootDict.Get(); }
 
  protected:
-  void ParseStream(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile);
+  void ParseStream(const RetainPtr<IFX_SeekableReadStream>& pFile);
 
   CFX_UnownedPtr<CPDF_Dictionary> m_pRootDict;
-  CFX_RetainPtr<IFX_SeekableReadStream> m_pFile;
+  RetainPtr<IFX_SeekableReadStream> m_pFile;
 };
 
 #endif  // CORE_FPDFAPI_PARSER_CFDF_DOCUMENT_H_
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.h b/core/fpdfapi/parser/cpdf_crypto_handler.h
index 252f41c..d815e78 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.h
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.h
@@ -11,18 +11,18 @@
 
 #include "core/fdrm/crypto/fx_crypt.h"
 #include "core/fxcrt/cfx_binarybuf.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_Dictionary;
 class CPDF_SecurityHandler;
 
-class CPDF_CryptoHandler : public CFX_Retainable {
+class CPDF_CryptoHandler : public Retainable {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   bool Init(CPDF_Dictionary* pEncryptDict,
             CPDF_SecurityHandler* pSecurityHandler);
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index bbd61dd..5dd6285 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -76,7 +76,7 @@
 
 CPDF_DataAvail::CPDF_DataAvail(
     FileAvail* pFileAvail,
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
+    const RetainPtr<IFX_SeekableReadStream>& pFileRead,
     bool bSupportHintTable)
     : m_pFileAvail(pFileAvail) {
   ASSERT(pFileRead);
@@ -1422,11 +1422,11 @@
   return true;
 }
 
-CFX_RetainPtr<IFX_SeekableReadStream> CPDF_DataAvail::GetFileRead() const {
+RetainPtr<IFX_SeekableReadStream> CPDF_DataAvail::GetFileRead() const {
   return m_pFileRead;
 }
 
-CFX_RetainPtr<CPDF_ReadValidator> CPDF_DataAvail::GetValidator() const {
+RetainPtr<CPDF_ReadValidator> CPDF_DataAvail::GetValidator() const {
   return m_pFileRead;
 }
 
diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h
index befb84f..f48abb5 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.h
+++ b/core/fpdfapi/parser/cpdf_data_avail.h
@@ -94,7 +94,7 @@
   };
 
   CPDF_DataAvail(FileAvail* pFileAvail,
-                 const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
+                 const RetainPtr<IFX_SeekableReadStream>& pFileRead,
                  bool bSupportHintTable);
   ~CPDF_DataAvail();
 
@@ -105,10 +105,10 @@
   DocFormStatus IsFormAvail(DownloadHints* pHints);
   DocLinearizationStatus IsLinearizedPDF();
   bool IsLinearized();
-  CFX_RetainPtr<IFX_SeekableReadStream> GetFileRead() const;
+  RetainPtr<IFX_SeekableReadStream> GetFileRead() const;
   int GetPageCount() const;
   CPDF_Dictionary* GetPage(int index);
-  CFX_RetainPtr<CPDF_ReadValidator> GetValidator() const;
+  RetainPtr<CPDF_ReadValidator> GetValidator() const;
 
  protected:
   class PageNode {
@@ -178,7 +178,7 @@
   bool ValidateForm();
 
   FileAvail* const m_pFileAvail;
-  CFX_RetainPtr<CPDF_ReadValidator> m_pFileRead;
+  RetainPtr<CPDF_ReadValidator> m_pFileRead;
   CPDF_Parser m_parser;
   CPDF_SyntaxParser m_syntaxParser;
   std::unique_ptr<CPDF_Object> m_pRoot;
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index f47551f..fef0311 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -625,8 +625,7 @@
   return m_pDocPage->GetFont(pFontDict);
 }
 
-CFX_RetainPtr<CPDF_StreamAcc> CPDF_Document::LoadFontFile(
-    CPDF_Stream* pStream) {
+RetainPtr<CPDF_StreamAcc> CPDF_Document::LoadFontFile(CPDF_Stream* pStream) {
   return m_pDocPage->GetFontFileStreamAcc(pStream);
 }
 
@@ -641,12 +640,11 @@
   return m_pDocPage->GetPattern(pPatternObj, bShading, matrix);
 }
 
-CFX_RetainPtr<CPDF_IccProfile> CPDF_Document::LoadIccProfile(
-    CPDF_Stream* pStream) {
+RetainPtr<CPDF_IccProfile> CPDF_Document::LoadIccProfile(CPDF_Stream* pStream) {
   return m_pDocPage->GetIccProfile(pStream);
 }
 
-CFX_RetainPtr<CPDF_Image> CPDF_Document::LoadImageFromPageData(
+RetainPtr<CPDF_Image> CPDF_Document::LoadImageFromPageData(
     uint32_t dwStreamObjNum) {
   ASSERT(dwStreamObjNum);
   return m_pDocPage->GetImage(dwStreamObjNum);
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index ff80fa8..1b985dd 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -81,9 +81,9 @@
                             bool bShading,
                             const CFX_Matrix& matrix);
 
-  CFX_RetainPtr<CPDF_Image> LoadImageFromPageData(uint32_t dwStreamObjNum);
-  CFX_RetainPtr<CPDF_StreamAcc> LoadFontFile(CPDF_Stream* pStream);
-  CFX_RetainPtr<CPDF_IccProfile> LoadIccProfile(CPDF_Stream* pStream);
+  RetainPtr<CPDF_Image> LoadImageFromPageData(uint32_t dwStreamObjNum);
+  RetainPtr<CPDF_StreamAcc> LoadFontFile(CPDF_Stream* pStream);
+  RetainPtr<CPDF_IccProfile> LoadIccProfile(CPDF_Stream* pStream);
 
   void LoadDoc();
   void LoadLinearizedDoc(const CPDF_LinearizedHeader* pLinearizationParams);
diff --git a/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp b/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp
index cb9ceac..1a8c6d5 100644
--- a/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp
@@ -22,7 +22,7 @@
 class InvalidReader : public IFX_SeekableReadStream {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   // IFX_SeekableReadStream overrides:
   bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override {
@@ -38,7 +38,7 @@
 class TestReadValidator : public CPDF_ReadValidator {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   void SimulateReadError() { ReadBlock(nullptr, 0, 1); }
 
@@ -71,7 +71,7 @@
     return obj_data.object.get();
   }
 
-  CFX_RetainPtr<CPDF_ReadValidator> GetValidator() { return validator_; }
+  RetainPtr<CPDF_ReadValidator> GetValidator() { return validator_; }
 
   void AddObject(uint32_t objnum,
                  std::unique_ptr<CPDF_Object> object,
@@ -103,7 +103,7 @@
     ObjectState state = ObjectState::Unavailable;
   };
   std::map<uint32_t, ObjectData> objects_data_;
-  CFX_RetainPtr<TestReadValidator> validator_;
+  RetainPtr<TestReadValidator> validator_;
 };
 
 class CPDF_ObjectAvailFailOnExclude : public CPDF_ObjectAvail {
diff --git a/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp b/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp
index a6454cd..1e83e80 100644
--- a/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp
@@ -23,7 +23,7 @@
 class InvalidReader : public IFX_SeekableReadStream {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   // IFX_SeekableReadStream overrides:
   bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override {
@@ -39,7 +39,7 @@
 class TestReadValidator : public CPDF_ReadValidator {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   void SimulateReadError() { ReadBlock(nullptr, 0, 1); }
 
@@ -72,7 +72,7 @@
     return obj_data.object.get();
   }
 
-  CFX_RetainPtr<CPDF_ReadValidator> GetValidator() { return validator_; }
+  RetainPtr<CPDF_ReadValidator> GetValidator() { return validator_; }
 
   void AddObject(uint32_t objnum,
                  std::unique_ptr<CPDF_Object> object,
@@ -104,7 +104,7 @@
     ObjectState state = ObjectState::Unavailable;
   };
   std::map<uint32_t, ObjectData> objects_data_;
-  CFX_RetainPtr<TestReadValidator> validator_;
+  RetainPtr<TestReadValidator> validator_;
 };
 
 }  // namespace
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index 9239c5f..a45ac13 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -43,11 +43,11 @@
   return result;
 }
 
-int32_t GetStreamNCount(const CFX_RetainPtr<CPDF_StreamAcc>& pObjStream) {
+int32_t GetStreamNCount(const RetainPtr<CPDF_StreamAcc>& pObjStream) {
   return pObjStream->GetDict()->GetIntegerFor("N");
 }
 
-int32_t GetStreamFirst(const CFX_RetainPtr<CPDF_StreamAcc>& pObjStream) {
+int32_t GetStreamFirst(const RetainPtr<CPDF_StreamAcc>& pObjStream) {
   return pObjStream->GetDict()->GetIntegerFor("First");
 }
 
@@ -164,11 +164,11 @@
   m_pEncryptDict = pDict;
 }
 
-CFX_RetainPtr<CPDF_CryptoHandler> CPDF_Parser::GetCryptoHandler() const {
+RetainPtr<CPDF_CryptoHandler> CPDF_Parser::GetCryptoHandler() const {
   return m_pSyntax->m_pCryptoHandler;
 }
 
-CFX_RetainPtr<IFX_SeekableReadStream> CPDF_Parser::GetFileAccess() const {
+RetainPtr<IFX_SeekableReadStream> CPDF_Parser::GetFileAccess() const {
   return m_pSyntax->GetFileAccess();
 }
 
@@ -189,7 +189,7 @@
 }
 
 bool CPDF_Parser::InitSyntaxParser(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& file_access) {
+    const RetainPtr<IFX_SeekableReadStream>& file_access) {
   const int32_t header_offset = GetHeaderOffset(file_access);
   if (header_offset == kInvalidHeaderOffset)
     return false;
@@ -218,7 +218,7 @@
 }
 
 CPDF_Parser::Error CPDF_Parser::StartParse(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess,
+    const RetainPtr<IFX_SeekableReadStream>& pFileAccess,
     CPDF_Document* pDocument) {
   if (!InitSyntaxParser(pFileAccess))
     return FORMAT_ERROR;
@@ -1211,7 +1211,7 @@
   if (GetObjectType(objnum) != ObjectType::kCompressed)
     return nullptr;
 
-  CFX_RetainPtr<CPDF_StreamAcc> pObjStream =
+  RetainPtr<CPDF_StreamAcc> pObjStream =
       GetObjectStream(m_ObjectInfo[objnum].pos);
   if (!pObjStream)
     return nullptr;
@@ -1240,7 +1240,7 @@
   return syntax.GetObject(pObjList, 0, 0, false);
 }
 
-CFX_RetainPtr<CPDF_StreamAcc> CPDF_Parser::GetObjectStream(uint32_t objnum) {
+RetainPtr<CPDF_StreamAcc> CPDF_Parser::GetObjectStream(uint32_t objnum) {
   auto it = m_ObjectStreamMap.find(objnum);
   if (it != m_ObjectStreamMap.end())
     return it->second;
@@ -1348,7 +1348,7 @@
 }
 
 CPDF_Parser::Error CPDF_Parser::StartLinearizedParse(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess,
+    const RetainPtr<IFX_SeekableReadStream>& pFileAccess,
     CPDF_Document* pDocument) {
   ASSERT(!m_bHasParsed);
   m_bXRefStream = false;
diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h
index 5cd1301..f59691f 100644
--- a/core/fpdfapi/parser/cpdf_parser.h
+++ b/core/fpdfapi/parser/cpdf_parser.h
@@ -14,10 +14,10 @@
 #include <vector>
 
 #include "core/fpdfapi/parser/cpdf_syntax_parser.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_Array;
 class CPDF_CryptoHandler;
@@ -57,9 +57,9 @@
   CPDF_Parser();
   ~CPDF_Parser();
 
-  Error StartParse(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+  Error StartParse(const RetainPtr<IFX_SeekableReadStream>& pFile,
                    CPDF_Document* pDocument);
-  Error StartLinearizedParse(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+  Error StartLinearizedParse(const RetainPtr<IFX_SeekableReadStream>& pFile,
                              CPDF_Document* pDocument);
 
   void SetPassword(const char* password) { m_Password = password; }
@@ -84,8 +84,8 @@
   ObjectType GetObjectType(uint32_t objnum) const;
   uint16_t GetObjectGenNum(uint32_t objnum) const;
   bool IsObjectFreeOrNull(uint32_t objnum) const;
-  CFX_RetainPtr<CPDF_CryptoHandler> GetCryptoHandler() const;
-  CFX_RetainPtr<IFX_SeekableReadStream> GetFileAccess() const;
+  RetainPtr<CPDF_CryptoHandler> GetCryptoHandler() const;
+  RetainPtr<IFX_SeekableReadStream> GetFileAccess() const;
 
   FX_FILESIZE GetObjectOffset(uint32_t objnum) const;
 
@@ -164,7 +164,7 @@
   bool LoadLinearizedCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount);
   bool LoadLinearizedAllCrossRefV5(FX_FILESIZE pos);
   Error LoadLinearizedMainXRefTable();
-  CFX_RetainPtr<CPDF_StreamAcc> GetObjectStream(uint32_t number);
+  RetainPtr<CPDF_StreamAcc> GetObjectStream(uint32_t number);
   bool ParseLinearizedHeader();
   void SetEncryptDictionary(CPDF_Dictionary* pDict);
   void ShrinkObjectMap(uint32_t size);
@@ -188,8 +188,7 @@
       CPDF_SyntaxParser::ParseType parse_type,
       FX_FILESIZE* pResultPos);
 
-  bool InitSyntaxParser(
-      const CFX_RetainPtr<IFX_SeekableReadStream>& file_access);
+  bool InitSyntaxParser(const RetainPtr<IFX_SeekableReadStream>& file_access);
   bool ParseFileVersion();
 
   CFX_UnownedPtr<CPDF_Document> m_pDocument;
@@ -205,7 +204,7 @@
   uint32_t m_dwLinearizedFirstPageXRefStartObjNum;
 
   // A map of object numbers to indirect streams.
-  std::map<uint32_t, CFX_RetainPtr<CPDF_StreamAcc>> m_ObjectStreamMap;
+  std::map<uint32_t, RetainPtr<CPDF_StreamAcc>> m_ObjectStreamMap;
 
   // Mapping of object numbers to offsets. The offsets are relative to the first
   // object in the stream.
@@ -213,7 +212,7 @@
 
   // Mapping of streams to their object caches. This is valid as long as the
   // streams in |m_ObjectStreamMap| are valid.
-  std::map<CFX_RetainPtr<CPDF_StreamAcc>, StreamObjectCache> m_ObjCache;
+  std::map<RetainPtr<CPDF_StreamAcc>, StreamObjectCache> m_ObjCache;
 
   // All indirect object numbers that are being parsed.
   std::set<uint32_t> m_ParsingObjNums;
diff --git a/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
index d441b12..b335297 100644
--- a/core/fpdfapi/parser/cpdf_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
@@ -7,9 +7,9 @@
 
 #include "core/fpdfapi/parser/cpdf_parser.h"
 #include "core/fpdfapi/parser/cpdf_syntax_parser.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_extension.h"
 #include "core/fxcrt/fx_stream.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/utils/path_service.h"
 
@@ -17,7 +17,7 @@
 class CFX_TestBufferRead : public IFX_SeekableReadStream {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   // IFX_SeekableReadStream:
   bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override {
@@ -46,7 +46,7 @@
 
   // Setup reading from a file and initial states.
   bool InitTestFromFile(const char* path) {
-    CFX_RetainPtr<IFX_SeekableReadStream> pFileAccess =
+    RetainPtr<IFX_SeekableReadStream> pFileAccess =
         IFX_SeekableReadStream::CreateFromFilename(path);
     if (!pFileAccess)
       return false;
diff --git a/core/fpdfapi/parser/cpdf_read_validator.cpp b/core/fpdfapi/parser/cpdf_read_validator.cpp
index d01b3c6..bf08600 100644
--- a/core/fpdfapi/parser/cpdf_read_validator.cpp
+++ b/core/fpdfapi/parser/cpdf_read_validator.cpp
@@ -40,7 +40,7 @@
 }
 
 CPDF_ReadValidator::CPDF_ReadValidator(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& file_read,
+    const RetainPtr<IFX_SeekableReadStream>& file_read,
     CPDF_DataAvail::FileAvail* file_avail)
     : file_read_(file_read),
       file_avail_(file_avail),
diff --git a/core/fpdfapi/parser/cpdf_read_validator.h b/core/fpdfapi/parser/cpdf_read_validator.h
index cc04a1f..812a5cc 100644
--- a/core/fpdfapi/parser/cpdf_read_validator.h
+++ b/core/fpdfapi/parser/cpdf_read_validator.h
@@ -11,7 +11,7 @@
 class CPDF_ReadValidator : public IFX_SeekableReadStream {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   class Session {
    public:
@@ -48,14 +48,14 @@
   FX_FILESIZE GetSize() override;
 
  protected:
-  CPDF_ReadValidator(const CFX_RetainPtr<IFX_SeekableReadStream>& file_read,
+  CPDF_ReadValidator(const RetainPtr<IFX_SeekableReadStream>& file_read,
                      CPDF_DataAvail::FileAvail* file_avail);
   ~CPDF_ReadValidator() override;
 
  private:
   void ScheduleDownload(FX_FILESIZE offset, size_t size);
 
-  CFX_RetainPtr<IFX_SeekableReadStream> file_read_;
+  RetainPtr<IFX_SeekableReadStream> file_read_;
   CFX_UnownedPtr<CPDF_DataAvail::FileAvail> file_avail_;
 
   CFX_UnownedPtr<CPDF_DataAvail::DownloadHints> hints_;
diff --git a/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp b/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp
index cb6c07e..c6007a6 100644
--- a/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp
@@ -65,7 +65,7 @@
 class InvalidReader : public IFX_SeekableReadStream {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   // IFX_SeekableReadStream overrides:
   bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override {
diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp
index c00096d..bf2feae 100644
--- a/core/fpdfapi/parser/cpdf_stream.cpp
+++ b/core/fpdfapi/parser/cpdf_stream.cpp
@@ -60,7 +60,7 @@
 }
 
 void CPDF_Stream::InitStreamFromFile(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+    const RetainPtr<IFX_SeekableReadStream>& pFile,
     std::unique_ptr<CPDF_Dictionary> pDict) {
   m_pDict = std::move(pDict);
   m_bMemoryBased = false;
diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h
index be70e05..f8b09af 100644
--- a/core/fpdfapi/parser/cpdf_stream.h
+++ b/core/fpdfapi/parser/cpdf_stream.h
@@ -51,7 +51,7 @@
   void InitStream(const uint8_t* pData,
                   uint32_t size,
                   std::unique_ptr<CPDF_Dictionary> pDict);
-  void InitStreamFromFile(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+  void InitStreamFromFile(const RetainPtr<IFX_SeekableReadStream>& pFile,
                           std::unique_ptr<CPDF_Dictionary> pDict);
 
   bool ReadRawData(FX_FILESIZE start_pos,
@@ -70,7 +70,7 @@
   uint32_t m_dwSize = 0;
   std::unique_ptr<CPDF_Dictionary> m_pDict;
   std::unique_ptr<uint8_t, FxFreeDeleter> m_pDataBuf;
-  CFX_RetainPtr<IFX_SeekableReadStream> m_pFile;
+  RetainPtr<IFX_SeekableReadStream> m_pFile;
 };
 
 inline CPDF_Stream* ToStream(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index 2161dd1..a6cca09 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -11,14 +11,14 @@
 
 #include "core/fpdfapi/parser/cpdf_dictionary.h"
 #include "core/fpdfapi/parser/cpdf_stream.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
-class CPDF_StreamAcc : public CFX_Retainable {
+class CPDF_StreamAcc : public Retainable {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   CPDF_StreamAcc(const CPDF_StreamAcc&) = delete;
   CPDF_StreamAcc& operator=(const CPDF_StreamAcc&) = delete;
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 4556dc9..7bea4c4 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -721,7 +721,7 @@
 }
 
 void CPDF_SyntaxParser::InitParser(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess,
+    const RetainPtr<IFX_SeekableReadStream>& pFileAccess,
     uint32_t HeaderOffset) {
   ASSERT(pFileAccess);
   return InitParserWithValidator(
@@ -730,7 +730,7 @@
 }
 
 void CPDF_SyntaxParser::InitParserWithValidator(
-    const CFX_RetainPtr<CPDF_ReadValidator>& validator,
+    const RetainPtr<CPDF_ReadValidator>& validator,
     uint32_t HeaderOffset) {
   ASSERT(validator);
   FX_Free(m_pFileBuf);
@@ -843,10 +843,10 @@
 }
 
 void CPDF_SyntaxParser::SetEncrypt(
-    const CFX_RetainPtr<CPDF_CryptoHandler>& pCryptoHandler) {
+    const RetainPtr<CPDF_CryptoHandler>& pCryptoHandler) {
   m_pCryptoHandler = pCryptoHandler;
 }
 
-CFX_RetainPtr<IFX_SeekableReadStream> CPDF_SyntaxParser::GetFileAccess() const {
+RetainPtr<IFX_SeekableReadStream> CPDF_SyntaxParser::GetFileAccess() const {
   return m_pFileAccess;
 }
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.h b/core/fpdfapi/parser/cpdf_syntax_parser.h
index 4e28c2f..78d5345 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.h
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.h
@@ -29,12 +29,11 @@
   explicit CPDF_SyntaxParser(const CFX_WeakPtr<ByteStringPool>& pPool);
   ~CPDF_SyntaxParser();
 
-  void InitParser(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess,
+  void InitParser(const RetainPtr<IFX_SeekableReadStream>& pFileAccess,
                   uint32_t HeaderOffset);
 
-  void InitParserWithValidator(
-      const CFX_RetainPtr<CPDF_ReadValidator>& pValidator,
-      uint32_t HeaderOffset);
+  void InitParserWithValidator(const RetainPtr<CPDF_ReadValidator>& pValidator,
+                               uint32_t HeaderOffset);
 
   FX_FILESIZE GetPos() const { return m_Pos; }
   void SetPos(FX_FILESIZE pos) { m_Pos = std::min(pos, m_FileLen); }
@@ -61,15 +60,15 @@
   void ToNextWord();
   bool BackwardsSearchToWord(const ByteStringView& word, FX_FILESIZE limit);
   FX_FILESIZE FindTag(const ByteStringView& tag, FX_FILESIZE limit);
-  void SetEncrypt(const CFX_RetainPtr<CPDF_CryptoHandler>& pCryptoHandler);
+  void SetEncrypt(const RetainPtr<CPDF_CryptoHandler>& pCryptoHandler);
   bool ReadBlock(uint8_t* pBuf, uint32_t size);
   bool GetCharAt(FX_FILESIZE pos, uint8_t& ch);
   ByteString GetNextWord(bool* bIsNumber);
   ByteString PeekNextWord(bool* bIsNumber);
 
-  CFX_RetainPtr<IFX_SeekableReadStream> GetFileAccess() const;
+  RetainPtr<IFX_SeekableReadStream> GetFileAccess() const;
 
-  const CFX_RetainPtr<CPDF_ReadValidator>& GetValidator() const {
+  const RetainPtr<CPDF_ReadValidator>& GetValidator() const {
     return m_pFileAccess;
   }
 
@@ -113,13 +112,13 @@
 
   FX_FILESIZE m_Pos;
   uint32_t m_MetadataObjnum;
-  CFX_RetainPtr<CPDF_ReadValidator> m_pFileAccess;
+  RetainPtr<CPDF_ReadValidator> m_pFileAccess;
   FX_FILESIZE m_HeaderOffset;
   FX_FILESIZE m_FileLen;
   uint8_t* m_pFileBuf;
   uint32_t m_BufSize;
   FX_FILESIZE m_BufOffset;
-  CFX_RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler;
+  RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler;
   uint8_t m_WordBuffer[257];
   uint32_t m_WordSize;
   CFX_WeakPtr<ByteStringPool> m_pPool;
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index 8280452..e57f834 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -71,7 +71,7 @@
     'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
     'R', 'R', 'R', 'R', 'R', 'R', 'R', 'W'};
 
-int32_t GetHeaderOffset(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) {
+int32_t GetHeaderOffset(const RetainPtr<IFX_SeekableReadStream>& pFile) {
   const size_t kBufSize = 4;
   uint8_t buf[kBufSize];
   for (int32_t offset = 0; offset <= 1024; ++offset) {
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.h b/core/fpdfapi/parser/fpdf_parser_utility.h
index 5f85551..e4b922c 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.h
+++ b/core/fpdfapi/parser/fpdf_parser_utility.h
@@ -7,8 +7,8 @@
 #ifndef CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_
 #define CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class IFX_SeekableReadStream;
 class CPDF_Dictionary;
@@ -39,7 +39,7 @@
 // On success, return a positive offset value to the PDF header.. If the header
 // cannot be found, or if there is an error reading from |pFile|, then return
 // |kInvalidHeaderOffset|.
-int32_t GetHeaderOffset(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile);
+int32_t GetHeaderOffset(const RetainPtr<IFX_SeekableReadStream>& pFile);
 
 int32_t GetDirectInteger(CPDF_Dictionary* pDict, const ByteString& key);
 
diff --git a/core/fpdfapi/render/cpdf_devicebuffer.h b/core/fpdfapi/render/cpdf_devicebuffer.h
index bfab275..2146c97 100644
--- a/core/fpdfapi/render/cpdf_devicebuffer.h
+++ b/core/fpdfapi/render/cpdf_devicebuffer.h
@@ -9,9 +9,9 @@
 
 #include <memory>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
 #include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CFX_DIBitmap;
 class CFX_RenderDevice;
@@ -29,14 +29,14 @@
                   const CPDF_PageObject* pObj,
                   int max_dpi);
   void OutputToDevice();
-  CFX_RetainPtr<CFX_DIBitmap> GetBitmap() const { return m_pBitmap; }
+  RetainPtr<CFX_DIBitmap> GetBitmap() const { return m_pBitmap; }
   const CFX_Matrix* GetMatrix() const { return &m_Matrix; }
 
  private:
   CFX_UnownedPtr<CFX_RenderDevice> m_pDevice;
   CFX_UnownedPtr<CPDF_RenderContext> m_pContext;
   CFX_UnownedPtr<const CPDF_PageObject> m_pObject;
-  CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+  RetainPtr<CFX_DIBitmap> m_pBitmap;
   FX_RECT m_Rect;
   CFX_Matrix m_Matrix;
 };
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp
index c6a5632..5104f7b 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -752,7 +752,7 @@
   return 1;
 }
 
-CFX_RetainPtr<CPDF_DIBSource> CPDF_DIBSource::DetachMask() {
+RetainPtr<CPDF_DIBSource> CPDF_DIBSource::DetachMask() {
   return std::move(m_pMask);
 }
 
diff --git a/core/fpdfapi/render/cpdf_dibsource.h b/core/fpdfapi/render/cpdf_dibsource.h
index f6883ed..08c4afe 100644
--- a/core/fpdfapi/render/cpdf_dibsource.h
+++ b/core/fpdfapi/render/cpdf_dibsource.h
@@ -18,8 +18,8 @@
 #include "core/fpdfapi/render/cpdf_imageloader.h"
 #include "core/fpdfapi/render/cpdf_rendercontext.h"
 #include "core/fpdfapi/render/cpdf_renderoptions.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/cfx_defaultrenderdevice.h"
 #include "core/fxge/cfx_renderdevice.h"
 
@@ -42,7 +42,7 @@
 class CPDF_DIBSource : public CFX_DIBSource {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   ~CPDF_DIBSource() override;
 
@@ -76,7 +76,7 @@
   int StartLoadMaskDIB();
   int ContinueLoadMaskDIB(IFX_PauseIndicator* pPause);
   int ContinueToLoadMask();
-  CFX_RetainPtr<CPDF_DIBSource> DetachMask();
+  RetainPtr<CPDF_DIBSource> DetachMask();
 
  private:
   CPDF_DIBSource();
@@ -125,7 +125,7 @@
   CFX_UnownedPtr<CPDF_Document> m_pDocument;
   CFX_UnownedPtr<const CPDF_Stream> m_pStream;
   CFX_UnownedPtr<const CPDF_Dictionary> m_pDict;
-  CFX_RetainPtr<CPDF_StreamAcc> m_pStreamAcc;
+  RetainPtr<CPDF_StreamAcc> m_pStreamAcc;
   CPDF_ColorSpace* m_pColorSpace;
   uint32_t m_Family;
   uint32_t m_bpc;
@@ -143,9 +143,9 @@
   DIB_COMP_DATA* m_pCompData;
   uint8_t* m_pLineBuf;
   uint8_t* m_pMaskedLine;
-  CFX_RetainPtr<CFX_DIBitmap> m_pCachedBitmap;
-  CFX_RetainPtr<CPDF_DIBSource> m_pMask;
-  CFX_RetainPtr<CPDF_StreamAcc> m_pGlobalStream;
+  RetainPtr<CFX_DIBitmap> m_pCachedBitmap;
+  RetainPtr<CPDF_DIBSource> m_pMask;
+  RetainPtr<CPDF_StreamAcc> m_pGlobalStream;
   std::unique_ptr<CCodec_ScanlineDecoder> m_pDecoder;
   std::unique_ptr<CCodec_Jbig2Context> m_pJbig2Context;
   CFX_UnownedPtr<CPDF_Stream> m_pMaskStream;
diff --git a/core/fpdfapi/render/cpdf_dibtransferfunc.cpp b/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
index 6ba148e..be2c9f3 100644
--- a/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
+++ b/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
@@ -12,7 +12,7 @@
 #include "core/fpdfapi/render/cpdf_transferfunc.h"
 
 CPDF_DIBTransferFunc::CPDF_DIBTransferFunc(
-    const CFX_RetainPtr<CPDF_TransferFunc>& pTransferFunc)
+    const RetainPtr<CPDF_TransferFunc>& pTransferFunc)
     : m_pTransferFunc(pTransferFunc) {
   m_RampR = pTransferFunc->m_Samples;
   m_RampG = &pTransferFunc->m_Samples[256];
diff --git a/core/fpdfapi/render/cpdf_dibtransferfunc.h b/core/fpdfapi/render/cpdf_dibtransferfunc.h
index b22ae9c..442811b 100644
--- a/core/fpdfapi/render/cpdf_dibtransferfunc.h
+++ b/core/fpdfapi/render/cpdf_dibtransferfunc.h
@@ -17,7 +17,7 @@
 class CPDF_DIBTransferFunc : public CFX_FilteredDIB {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   ~CPDF_DIBTransferFunc() override;
 
@@ -33,12 +33,12 @@
 
  private:
   explicit CPDF_DIBTransferFunc(
-      const CFX_RetainPtr<CPDF_TransferFunc>& pTransferFunc);
+      const RetainPtr<CPDF_TransferFunc>& pTransferFunc);
 
   const uint8_t* m_RampR;
   const uint8_t* m_RampG;
   const uint8_t* m_RampB;
-  CFX_RetainPtr<CPDF_TransferFunc> m_pTransferFunc;
+  RetainPtr<CPDF_TransferFunc> m_pTransferFunc;
 };
 
 #endif  // CORE_FPDFAPI_RENDER_CPDF_DIBTRANSFERFUNC_H_
diff --git a/core/fpdfapi/render/cpdf_docrenderdata.cpp b/core/fpdfapi/render/cpdf_docrenderdata.cpp
index bf277f0..3b16013 100644
--- a/core/fpdfapi/render/cpdf_docrenderdata.cpp
+++ b/core/fpdfapi/render/cpdf_docrenderdata.cpp
@@ -44,7 +44,7 @@
   }
 }
 
-CFX_RetainPtr<CPDF_Type3Cache> CPDF_DocRenderData::GetCachedType3(
+RetainPtr<CPDF_Type3Cache> CPDF_DocRenderData::GetCachedType3(
     CPDF_Type3Font* pFont) {
   auto it = m_Type3FaceMap.find(pFont);
   if (it != m_Type3FaceMap.end())
@@ -61,7 +61,7 @@
     m_Type3FaceMap.erase(it);
 }
 
-CFX_RetainPtr<CPDF_TransferFunc> CPDF_DocRenderData::GetTransferFunc(
+RetainPtr<CPDF_TransferFunc> CPDF_DocRenderData::GetTransferFunc(
     CPDF_Object* pObj) {
   if (!pObj)
     return nullptr;
diff --git a/core/fpdfapi/render/cpdf_docrenderdata.h b/core/fpdfapi/render/cpdf_docrenderdata.h
index 949a079..efc4741 100644
--- a/core/fpdfapi/render/cpdf_docrenderdata.h
+++ b/core/fpdfapi/render/cpdf_docrenderdata.h
@@ -25,18 +25,18 @@
   explicit CPDF_DocRenderData(CPDF_Document* pPDFDoc);
   ~CPDF_DocRenderData();
 
-  CFX_RetainPtr<CPDF_Type3Cache> GetCachedType3(CPDF_Type3Font* pFont);
+  RetainPtr<CPDF_Type3Cache> GetCachedType3(CPDF_Type3Font* pFont);
   void MaybePurgeCachedType3(CPDF_Type3Font* pFont);
 
-  CFX_RetainPtr<CPDF_TransferFunc> GetTransferFunc(CPDF_Object* pObj);
+  RetainPtr<CPDF_TransferFunc> GetTransferFunc(CPDF_Object* pObj);
   void MaybePurgeTransferFunc(CPDF_Object* pOb);
 
   void Clear(bool bRelease);
 
  private:
   CFX_UnownedPtr<CPDF_Document> m_pPDFDoc;
-  std::map<CPDF_Font*, CFX_RetainPtr<CPDF_Type3Cache>> m_Type3FaceMap;
-  std::map<CPDF_Object*, CFX_RetainPtr<CPDF_TransferFunc>> m_TransferFuncMap;
+  std::map<CPDF_Font*, RetainPtr<CPDF_Type3Cache>> m_Type3FaceMap;
+  std::map<CPDF_Object*, RetainPtr<CPDF_TransferFunc>> m_TransferFuncMap;
 };
 
 #endif  // CORE_FPDFAPI_RENDER_CPDF_DOCRENDERDATA_H_
diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.cpp b/core/fpdfapi/render/cpdf_imagecacheentry.cpp
index 4f98b96..666839b 100644
--- a/core/fpdfapi/render/cpdf_imagecacheentry.cpp
+++ b/core/fpdfapi/render/cpdf_imagecacheentry.cpp
@@ -18,9 +18,8 @@
 #include "core/fpdfapi/render/cpdf_rendercontext.h"
 #include "core/fpdfapi/render/cpdf_renderstatus.h"
 
-CPDF_ImageCacheEntry::CPDF_ImageCacheEntry(
-    CPDF_Document* pDoc,
-    const CFX_RetainPtr<CPDF_Image>& pImage)
+CPDF_ImageCacheEntry::CPDF_ImageCacheEntry(CPDF_Document* pDoc,
+                                           const RetainPtr<CPDF_Image>& pImage)
     : m_dwTimeCount(0),
       m_MatteColor(0),
       m_pDocument(pDoc),
@@ -29,7 +28,7 @@
 
 CPDF_ImageCacheEntry::~CPDF_ImageCacheEntry() {}
 
-void CPDF_ImageCacheEntry::Reset(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
+void CPDF_ImageCacheEntry::Reset(const RetainPtr<CFX_DIBitmap>& pBitmap) {
   m_pCachedBitmap.Reset();
   if (pBitmap)
     m_pCachedBitmap = pBitmap->Clone(nullptr);
@@ -37,18 +36,18 @@
 }
 
 static uint32_t FPDF_ImageCache_EstimateImageSize(
-    const CFX_RetainPtr<CFX_DIBSource>& pDIB) {
+    const RetainPtr<CFX_DIBSource>& pDIB) {
   return pDIB && pDIB->GetBuffer()
              ? (uint32_t)pDIB->GetHeight() * pDIB->GetPitch() +
                    (uint32_t)pDIB->GetPaletteSize() * 4
              : 0;
 }
 
-CFX_RetainPtr<CFX_DIBSource> CPDF_ImageCacheEntry::DetachBitmap() {
+RetainPtr<CFX_DIBSource> CPDF_ImageCacheEntry::DetachBitmap() {
   return std::move(m_pCurBitmap);
 }
 
-CFX_RetainPtr<CFX_DIBSource> CPDF_ImageCacheEntry::DetachMask() {
+RetainPtr<CFX_DIBSource> CPDF_ImageCacheEntry::DetachMask() {
   return std::move(m_pCurMask);
 }
 
diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.h b/core/fpdfapi/render/cpdf_imagecacheentry.h
index 176b281..111050f 100644
--- a/core/fpdfapi/render/cpdf_imagecacheentry.h
+++ b/core/fpdfapi/render/cpdf_imagecacheentry.h
@@ -9,9 +9,9 @@
 
 #include <memory>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CFX_DIBSource;
 class CFX_DIBitmap;
@@ -24,10 +24,10 @@
 class CPDF_ImageCacheEntry {
  public:
   CPDF_ImageCacheEntry(CPDF_Document* pDoc,
-                       const CFX_RetainPtr<CPDF_Image>& pImage);
+                       const RetainPtr<CPDF_Image>& pImage);
   ~CPDF_ImageCacheEntry();
 
-  void Reset(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap);
+  void Reset(const RetainPtr<CFX_DIBitmap>& pBitmap);
   uint32_t EstimateSize() const { return m_dwCacheSize; }
   uint32_t GetTimeCount() const { return m_dwTimeCount; }
   CPDF_Image* GetImage() const { return m_pImage.Get(); }
@@ -38,8 +38,8 @@
                            bool bLoadMask,
                            CPDF_RenderStatus* pRenderStatus);
   int Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus);
-  CFX_RetainPtr<CFX_DIBSource> DetachBitmap();
-  CFX_RetainPtr<CFX_DIBSource> DetachMask();
+  RetainPtr<CFX_DIBSource> DetachBitmap();
+  RetainPtr<CFX_DIBSource> DetachMask();
 
   int m_dwTimeCount;
   uint32_t m_MatteColor;
@@ -49,11 +49,11 @@
   void CalcSize();
 
   CFX_UnownedPtr<CPDF_Document> const m_pDocument;
-  CFX_RetainPtr<CPDF_Image> const m_pImage;
-  CFX_RetainPtr<CFX_DIBSource> m_pCurBitmap;
-  CFX_RetainPtr<CFX_DIBSource> m_pCurMask;
-  CFX_RetainPtr<CFX_DIBSource> m_pCachedBitmap;
-  CFX_RetainPtr<CFX_DIBSource> m_pCachedMask;
+  RetainPtr<CPDF_Image> const m_pImage;
+  RetainPtr<CFX_DIBSource> m_pCurBitmap;
+  RetainPtr<CFX_DIBSource> m_pCurMask;
+  RetainPtr<CFX_DIBSource> m_pCachedBitmap;
+  RetainPtr<CFX_DIBSource> m_pCachedMask;
   uint32_t m_dwCacheSize;
 };
 
diff --git a/core/fpdfapi/render/cpdf_imageloader.cpp b/core/fpdfapi/render/cpdf_imageloader.cpp
index f195b89..19eb875 100644
--- a/core/fpdfapi/render/cpdf_imageloader.cpp
+++ b/core/fpdfapi/render/cpdf_imageloader.cpp
@@ -61,7 +61,7 @@
     m_MatteColor = entry->m_MatteColor;
     return;
   }
-  CFX_RetainPtr<CPDF_Image> pImage = m_pImageObject->GetImage();
+  RetainPtr<CPDF_Image> pImage = m_pImageObject->GetImage();
   m_bCached = false;
   m_pBitmap = pImage->DetachBitmap();
   m_pMask = pImage->DetachMask();
diff --git a/core/fpdfapi/render/cpdf_imageloader.h b/core/fpdfapi/render/cpdf_imageloader.h
index 69577c3..2fc0670 100644
--- a/core/fpdfapi/render/cpdf_imageloader.h
+++ b/core/fpdfapi/render/cpdf_imageloader.h
@@ -9,8 +9,8 @@
 
 #include <memory>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/fx_dib.h"
 
 class CPDF_ImageObject;
@@ -31,8 +31,8 @@
              CPDF_RenderStatus* pRenderStatus);
   bool Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus);
 
-  CFX_RetainPtr<CFX_DIBSource> m_pBitmap;
-  CFX_RetainPtr<CFX_DIBSource> m_pMask;
+  RetainPtr<CFX_DIBSource> m_pBitmap;
+  RetainPtr<CFX_DIBSource> m_pMask;
   uint32_t m_MatteColor;
   bool m_bCached;
 
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index e9f1752..2fa0beb 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -184,7 +184,7 @@
 }
 
 bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
-                               const CFX_RetainPtr<CFX_DIBSource>& pDIBSource,
+                               const RetainPtr<CFX_DIBSource>& pDIBSource,
                                FX_ARGB bitmap_argb,
                                int bitmap_alpha,
                                const CFX_Matrix* pImage2Device,
@@ -222,7 +222,7 @@
 void CPDF_ImageRenderer::CalculateDrawImage(
     CFX_DefaultRenderDevice* pBitmapDevice1,
     CFX_DefaultRenderDevice* pBitmapDevice2,
-    const CFX_RetainPtr<CFX_DIBSource>& pDIBSource,
+    const RetainPtr<CFX_DIBSource>& pDIBSource,
     CFX_Matrix* pNewMatrix,
     const FX_RECT& rect) const {
   CPDF_RenderStatus bitmap_render;
@@ -380,7 +380,7 @@
     }
   }
 #ifdef _SKIA_SUPPORT_
-  CFX_RetainPtr<CFX_DIBitmap> premultiplied = m_pDIBSource->Clone(nullptr);
+  RetainPtr<CFX_DIBitmap> premultiplied = m_pDIBSource->Clone(nullptr);
   if (m_pDIBSource->HasAlpha())
     CFX_SkiaDeviceDriver::PreMultiply(premultiplied);
   if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend(
@@ -456,7 +456,7 @@
   FX_RECT dest_clip(
       dest_rect.left - image_rect.left, dest_rect.top - image_rect.top,
       dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top);
-  CFX_RetainPtr<CFX_DIBitmap> pStretched =
+  RetainPtr<CFX_DIBitmap> pStretched =
       m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip);
   if (pStretched) {
     m_pRenderStatus->CompositeDIBitmap(pStretched, dest_rect.left,
@@ -477,7 +477,7 @@
                                          FXFILL_WINDING);
     return false;
   }
-  CFX_RetainPtr<CFX_DIBSource> pAlphaMask;
+  RetainPtr<CFX_DIBSource> pAlphaMask;
   if (m_pDIBSource->IsAlphaMask())
     pAlphaMask = m_pDIBSource;
   else
@@ -486,7 +486,7 @@
   if (fabs(m_ImageMatrix.b) >= 0.5f || fabs(m_ImageMatrix.c) >= 0.5f) {
     int left;
     int top;
-    CFX_RetainPtr<CFX_DIBitmap> pTransformed =
+    RetainPtr<CFX_DIBitmap> pTransformed =
         pAlphaMask->TransformTo(&m_ImageMatrix, &left, &top);
     if (!pTransformed)
       return true;
@@ -515,7 +515,7 @@
     if (m_pTransformer->Continue(pPause))
       return true;
 
-    CFX_RetainPtr<CFX_DIBitmap> pBitmap = m_pTransformer->DetachBitmap();
+    RetainPtr<CFX_DIBitmap> pBitmap = m_pTransformer->DetachBitmap();
     if (!pBitmap)
       return false;
 
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.h b/core/fpdfapi/render/cpdf_imagerenderer.h
index 332cbf5..0d59a4e 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.h
+++ b/core/fpdfapi/render/cpdf_imagerenderer.h
@@ -35,7 +35,7 @@
              int blendType);
 
   bool Start(CPDF_RenderStatus* pStatus,
-             const CFX_RetainPtr<CFX_DIBSource>& pDIBSource,
+             const RetainPtr<CFX_DIBSource>& pDIBSource,
              FX_ARGB bitmap_argb,
              int bitmap_alpha,
              const CFX_Matrix* pImage2Device,
@@ -58,7 +58,7 @@
   CFX_Matrix GetDrawMatrix(const FX_RECT& rect) const;
   void CalculateDrawImage(CFX_DefaultRenderDevice* bitmap_device1,
                           CFX_DefaultRenderDevice* bitmap_device2,
-                          const CFX_RetainPtr<CFX_DIBSource>& pDIBSource,
+                          const RetainPtr<CFX_DIBSource>& pDIBSource,
                           CFX_Matrix* pNewMatrix,
                           const FX_RECT& rect) const;
   void HandleFilters();
@@ -69,8 +69,8 @@
   CFX_UnownedPtr<const CFX_Matrix> m_pObj2Device;
   CFX_Matrix m_ImageMatrix;
   CPDF_ImageLoader m_Loader;
-  CFX_RetainPtr<CFX_DIBSource> m_pDIBSource;
-  CFX_RetainPtr<CFX_DIBitmap> m_pClone;
+  RetainPtr<CFX_DIBSource> m_pDIBSource;
+  RetainPtr<CFX_DIBitmap> m_pClone;
   int m_BitmapAlpha;
   bool m_bPatternColor;
   CFX_UnownedPtr<CPDF_Pattern> m_pPattern;
diff --git a/core/fpdfapi/render/cpdf_pagerendercache.cpp b/core/fpdfapi/render/cpdf_pagerendercache.cpp
index ca5b620..42205eb 100644
--- a/core/fpdfapi/render/cpdf_pagerendercache.cpp
+++ b/core/fpdfapi/render/cpdf_pagerendercache.cpp
@@ -80,7 +80,7 @@
 }
 
 bool CPDF_PageRenderCache::StartGetCachedBitmap(
-    const CFX_RetainPtr<CPDF_Image>& pImage,
+    const RetainPtr<CPDF_Image>& pImage,
     bool bStdCS,
     uint32_t GroupFamily,
     bool bLoadMask,
@@ -126,9 +126,8 @@
   return false;
 }
 
-void CPDF_PageRenderCache::ResetBitmap(
-    const CFX_RetainPtr<CPDF_Image>& pImage,
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
+void CPDF_PageRenderCache::ResetBitmap(const RetainPtr<CPDF_Image>& pImage,
+                                       const RetainPtr<CFX_DIBitmap>& pBitmap) {
   CPDF_ImageCacheEntry* pEntry;
   CPDF_Stream* pStream = pImage->GetStream();
   const auto it = m_ImageCache.find(pStream);
diff --git a/core/fpdfapi/render/cpdf_pagerendercache.h b/core/fpdfapi/render/cpdf_pagerendercache.h
index 0a315b7..76898ab 100644
--- a/core/fpdfapi/render/cpdf_pagerendercache.h
+++ b/core/fpdfapi/render/cpdf_pagerendercache.h
@@ -9,9 +9,9 @@
 
 #include <map>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CFX_DIBitmap;
 class CPDF_Image;
@@ -28,14 +28,14 @@
 
   void CacheOptimization(int32_t dwLimitCacheSize);
   uint32_t GetTimeCount() const { return m_nTimeCount; }
-  void ResetBitmap(const CFX_RetainPtr<CPDF_Image>& pImage,
-                   const CFX_RetainPtr<CFX_DIBitmap>& pBitmap);
+  void ResetBitmap(const RetainPtr<CPDF_Image>& pImage,
+                   const RetainPtr<CFX_DIBitmap>& pBitmap);
   CPDF_Page* GetPage() const { return m_pPage.Get(); }
   CPDF_ImageCacheEntry* GetCurImageCacheEntry() const {
     return m_pCurImageCacheEntry;
   }
 
-  bool StartGetCachedBitmap(const CFX_RetainPtr<CPDF_Image>& pImage,
+  bool StartGetCachedBitmap(const RetainPtr<CPDF_Image>& pImage,
                             bool bStdCS,
                             uint32_t GroupFamily,
                             bool bLoadMask,
diff --git a/core/fpdfapi/render/cpdf_rendercontext.cpp b/core/fpdfapi/render/cpdf_rendercontext.cpp
index dec5132..3c08295 100644
--- a/core/fpdfapi/render/cpdf_rendercontext.cpp
+++ b/core/fpdfapi/render/cpdf_rendercontext.cpp
@@ -30,11 +30,10 @@
 
 CPDF_RenderContext::~CPDF_RenderContext() {}
 
-void CPDF_RenderContext::GetBackground(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBuffer,
-    const CPDF_PageObject* pObj,
-    const CPDF_RenderOptions* pOptions,
-    CFX_Matrix* pFinalMatrix) {
+void CPDF_RenderContext::GetBackground(const RetainPtr<CFX_DIBitmap>& pBuffer,
+                                       const CPDF_PageObject* pObj,
+                                       const CPDF_RenderOptions* pOptions,
+                                       CFX_Matrix* pFinalMatrix) {
   CFX_DefaultRenderDevice device;
   device.Attach(pBuffer, false, nullptr, false);
 
diff --git a/core/fpdfapi/render/cpdf_rendercontext.h b/core/fpdfapi/render/cpdf_rendercontext.h
index feb7187..8806a78 100644
--- a/core/fpdfapi/render/cpdf_rendercontext.h
+++ b/core/fpdfapi/render/cpdf_rendercontext.h
@@ -9,9 +9,9 @@
 
 #include <vector>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
 #include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_Dictionary;
 class CPDF_Document;
@@ -52,7 +52,7 @@
               const CPDF_RenderOptions* pOptions,
               const CFX_Matrix* pFinalMatrix);
 
-  void GetBackground(const CFX_RetainPtr<CFX_DIBitmap>& pBuffer,
+  void GetBackground(const RetainPtr<CFX_DIBitmap>& pBuffer,
                      const CPDF_PageObject* pObj,
                      const CPDF_RenderOptions* pOptions,
                      CFX_Matrix* pFinalMatrix);
diff --git a/core/fpdfapi/render/cpdf_renderoptions.h b/core/fpdfapi/render/cpdf_renderoptions.h
index aa48b4e..1f6afc3 100644
--- a/core/fpdfapi/render/cpdf_renderoptions.h
+++ b/core/fpdfapi/render/cpdf_renderoptions.h
@@ -8,8 +8,8 @@
 #define CORE_FPDFAPI_RENDER_CPDF_RENDEROPTIONS_H_
 
 #include "core/fpdfdoc/cpdf_occontext.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/fx_dib.h"
 
 #define RENDER_CLEARTYPE 0x00000001
@@ -44,7 +44,7 @@
   uint32_t m_Flags;
   uint32_t m_dwLimitCacheSize;
   bool m_bDrawAnnots;
-  CFX_RetainPtr<CPDF_OCContext> m_pOCContext;
+  RetainPtr<CPDF_OCContext> m_pOCContext;
 };
 
 #endif  // CORE_FPDFAPI_RENDER_CPDF_RENDEROPTIONS_H_
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index ef07852..e94913d 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -100,7 +100,7 @@
   return total;
 }
 
-void DrawAxialShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+void DrawAxialShading(const RetainPtr<CFX_DIBitmap>& pBitmap,
                       CFX_Matrix* pObject2Bitmap,
                       CPDF_Dictionary* pDict,
                       const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -185,7 +185,7 @@
   }
 }
 
-void DrawRadialShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+void DrawRadialShading(const RetainPtr<CFX_DIBitmap>& pBitmap,
                        CFX_Matrix* pObject2Bitmap,
                        CPDF_Dictionary* pDict,
                        const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -317,7 +317,7 @@
   }
 }
 
-void DrawFuncShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+void DrawFuncShading(const RetainPtr<CFX_DIBitmap>& pBitmap,
                      CFX_Matrix* pObject2Bitmap,
                      CPDF_Dictionary* pDict,
                      const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -388,7 +388,7 @@
   return true;
 }
 
-void DrawGouraud(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+void DrawGouraud(const RetainPtr<CFX_DIBitmap>& pBitmap,
                  int alpha,
                  CPDF_MeshVertex triangle[3]) {
   float min_y = triangle[0].position.y;
@@ -470,7 +470,7 @@
 }
 
 void DrawFreeGouraudShading(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+    const RetainPtr<CFX_DIBitmap>& pBitmap,
     CFX_Matrix* pObject2Bitmap,
     CPDF_Stream* pShadingStream,
     const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -511,7 +511,7 @@
 }
 
 void DrawLatticeGouraudShading(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+    const RetainPtr<CFX_DIBitmap>& pBitmap,
     CFX_Matrix* pObject2Bitmap,
     CPDF_Stream* pShadingStream,
     const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -827,7 +827,7 @@
 
 void DrawCoonPatchMeshes(
     ShadingType type,
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+    const RetainPtr<CFX_DIBitmap>& pBitmap,
     CFX_Matrix* pObject2Bitmap,
     CPDF_Stream* pShadingStream,
     const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -911,13 +911,13 @@
   }
 }
 
-CFX_RetainPtr<CFX_DIBitmap> DrawPatternBitmap(CPDF_Document* pDoc,
-                                              CPDF_PageRenderCache* pCache,
-                                              CPDF_TilingPattern* pPattern,
-                                              const CFX_Matrix* pObject2Device,
-                                              int width,
-                                              int height,
-                                              int flags) {
+RetainPtr<CFX_DIBitmap> DrawPatternBitmap(CPDF_Document* pDoc,
+                                          CPDF_PageRenderCache* pCache,
+                                          CPDF_TilingPattern* pPattern,
+                                          const CFX_Matrix* pObject2Device,
+                                          int width,
+                                          int height,
+                                          int flags) {
   auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
   if (!pBitmap->Create(width, height,
                        pPattern->colored() ? FXDIB_Argb : FXDIB_8bppMask)) {
@@ -1319,7 +1319,7 @@
       fill_argb, stroke_argb, FillType, m_curBlend);
 }
 
-CFX_RetainPtr<CPDF_TransferFunc> CPDF_RenderStatus::GetTransferFunc(
+RetainPtr<CPDF_TransferFunc> CPDF_RenderStatus::GetTransferFunc(
     CPDF_Object* pObj) const {
   ASSERT(pObj);
   CPDF_DocRenderData* pDocCache = m_pContext->GetDocument()->GetRenderData();
@@ -1557,7 +1557,7 @@
   int width = FXSYS_round((float)rect.Width() * scaleX);
   int height = FXSYS_round((float)rect.Height() * scaleY);
   CFX_DefaultRenderDevice bitmap_device;
-  CFX_RetainPtr<CFX_DIBitmap> oriDevice;
+  RetainPtr<CFX_DIBitmap> oriDevice;
   if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) {
     oriDevice = pdfium::MakeRetain<CFX_DIBitmap>();
     if (!m_pDevice->CreateCompatibleBitmap(oriDevice, width, height))
@@ -1567,14 +1567,14 @@
   if (!bitmap_device.Create(width, height, FXDIB_Argb, oriDevice))
     return true;
 
-  CFX_RetainPtr<CFX_DIBitmap> bitmap = bitmap_device.GetBitmap();
+  RetainPtr<CFX_DIBitmap> bitmap = bitmap_device.GetBitmap();
   bitmap->Clear(0);
 
   CFX_Matrix new_matrix = *pObj2Device;
   new_matrix.Translate(-rect.left, -rect.top);
   new_matrix.Scale(scaleX, scaleY);
 
-  CFX_RetainPtr<CFX_DIBitmap> pTextMask;
+  RetainPtr<CFX_DIBitmap> pTextMask;
   if (bTextClip) {
     pTextMask = pdfium::MakeRetain<CFX_DIBitmap>();
     if (!pTextMask->Create(width, height, FXDIB_8bppMask))
@@ -1609,7 +1609,7 @@
   if (pSMaskDict) {
     CFX_Matrix smask_matrix = *pPageObj->m_GeneralState.GetSMaskMatrix();
     smask_matrix.Concat(*pObj2Device);
-    CFX_RetainPtr<CFX_DIBSource> pSMaskSource =
+    RetainPtr<CFX_DIBSource> pSMaskSource =
         LoadSMask(pSMaskDict, &rect, &smask_matrix);
     if (pSMaskSource)
       bitmap->MultiplyAlpha(pSMaskSource);
@@ -1638,7 +1638,7 @@
   return true;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::GetBackdrop(
+RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::GetBackdrop(
     const CPDF_PageObject* pObj,
     const FX_RECT& rect,
     int& left,
@@ -1815,7 +1815,7 @@
                                            &text_matrix, fill_argb, &m_Options);
 }
 
-CFX_RetainPtr<CPDF_Type3Cache> CPDF_RenderStatus::GetCachedType3(
+RetainPtr<CPDF_Type3Cache> CPDF_RenderStatus::GetCachedType3(
     CPDF_Type3Font* pFont) {
   CPDF_Document* pDoc = pFont->GetDocument();
   if (!pDoc)
@@ -1923,7 +1923,7 @@
       }
     } else if (pType3Char->m_pBitmap) {
       if (device_class == FXDC_DISPLAY) {
-        CFX_RetainPtr<CPDF_Type3Cache> pCache = GetCachedType3(pType3Font);
+        RetainPtr<CPDF_Type3Cache> pCache = GetCachedType3(pType3Font);
         refTypeCache.m_dwCount++;
         CFX_GlyphBitmap* pBitmap = pCache->LoadGlyph(charcode, &matrix, sa, sd);
         if (!pBitmap)
@@ -2086,7 +2086,7 @@
   buffer.Initialize(m_pContext.Get(), m_pDevice, &clip_rect, m_pCurObj, 150);
   CFX_Matrix FinalMatrix = *pMatrix;
   FinalMatrix.Concat(*buffer.GetMatrix());
-  CFX_RetainPtr<CFX_DIBitmap> pBitmap = buffer.GetBitmap();
+  RetainPtr<CFX_DIBitmap> pBitmap = buffer.GetBitmap();
   if (!pBitmap->GetBuffer())
     return;
 
@@ -2290,9 +2290,9 @@
   }
   float left_offset = cell_bbox.left - mtPattern2Device.e;
   float top_offset = cell_bbox.bottom - mtPattern2Device.f;
-  CFX_RetainPtr<CFX_DIBitmap> pPatternBitmap;
+  RetainPtr<CFX_DIBitmap> pPatternBitmap;
   if (width * height < 16) {
-    CFX_RetainPtr<CFX_DIBitmap> pEnlargedBitmap =
+    RetainPtr<CFX_DIBitmap> pEnlargedBitmap =
         DrawPatternBitmap(m_pContext->GetDocument(), m_pContext->GetPageCache(),
                           pPattern, pObj2Device, 8, 8, m_Options.m_Flags);
     pPatternBitmap = pEnlargedBitmap->StretchTo(width, height, 0, nullptr);
@@ -2409,7 +2409,7 @@
 }
 
 void CPDF_RenderStatus::CompositeDIBitmap(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+    const RetainPtr<CFX_DIBitmap>& pDIBitmap,
     int left,
     int top,
     FX_ARGB mask_argb,
@@ -2466,10 +2466,10 @@
       FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
                    top + pDIBitmap->GetHeight());
       rect.Intersect(m_pDevice->GetClipBox());
-      CFX_RetainPtr<CFX_DIBitmap> pClone;
+      RetainPtr<CFX_DIBitmap> pClone;
       if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
         pClone = m_pDevice->GetBackDrop()->Clone(&rect);
-        CFX_RetainPtr<CFX_DIBitmap> pForeBitmap = m_pDevice->GetBitmap();
+        RetainPtr<CFX_DIBitmap> pForeBitmap = m_pDevice->GetBitmap();
         pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
                                 pForeBitmap, rect.left, rect.top);
         left = left >= 0 ? 0 : left;
@@ -2497,7 +2497,7 @@
   int back_left, back_top;
   FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
                top + pDIBitmap->GetHeight());
-  CFX_RetainPtr<CFX_DIBitmap> pBackdrop =
+  RetainPtr<CFX_DIBitmap> pBackdrop =
       GetBackdrop(m_pCurObj, rect, back_left, back_top,
                   blend_mode > FXDIB_BLEND_NORMAL && bIsolated);
   if (!pBackdrop)
@@ -2523,7 +2523,7 @@
   m_pDevice->SetDIBits(pBackdrop, back_left, back_top);
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
+RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
     CPDF_Dictionary* pSMaskDict,
     FX_RECT* pClipRect,
     const CFX_Matrix* pMatrix) {
diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h
index b4872f1..b823834 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.h
+++ b/core/fpdfapi/render/cpdf_renderstatus.h
@@ -107,7 +107,7 @@
                       const CFX_Matrix* pObj2Device,
                       bool bStroke);
   bool ProcessImage(CPDF_ImageObject* pImageObj, const CFX_Matrix* pObj2Device);
-  void CompositeDIBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+  void CompositeDIBitmap(const RetainPtr<CFX_DIBitmap>& pDIBitmap,
                          int left,
                          int top,
                          FX_ARGB mask_argb,
@@ -135,19 +135,19 @@
                                bool bStroke);
   bool ProcessForm(const CPDF_FormObject* pFormObj,
                    const CFX_Matrix* pObj2Device);
-  CFX_RetainPtr<CFX_DIBitmap> GetBackdrop(const CPDF_PageObject* pObj,
-                                          const FX_RECT& rect,
-                                          int& left,
-                                          int& top,
-                                          bool bBackAlphaRequired);
-  CFX_RetainPtr<CFX_DIBitmap> LoadSMask(CPDF_Dictionary* pSMaskDict,
-                                        FX_RECT* pClipRect,
-                                        const CFX_Matrix* pMatrix);
-  static CFX_RetainPtr<CPDF_Type3Cache> GetCachedType3(CPDF_Type3Font* pFont);
+  RetainPtr<CFX_DIBitmap> GetBackdrop(const CPDF_PageObject* pObj,
+                                      const FX_RECT& rect,
+                                      int& left,
+                                      int& top,
+                                      bool bBackAlphaRequired);
+  RetainPtr<CFX_DIBitmap> LoadSMask(CPDF_Dictionary* pSMaskDict,
+                                    FX_RECT* pClipRect,
+                                    const CFX_Matrix* pMatrix);
+  static RetainPtr<CPDF_Type3Cache> GetCachedType3(CPDF_Type3Font* pFont);
   static std::unique_ptr<CPDF_GraphicStates> CloneObjStates(
       const CPDF_GraphicStates* pPathObj,
       bool bStroke);
-  CFX_RetainPtr<CPDF_TransferFunc> GetTransferFunc(CPDF_Object* pObject) const;
+  RetainPtr<CPDF_TransferFunc> GetTransferFunc(CPDF_Object* pObject) const;
   FX_ARGB GetFillArgb(CPDF_PageObject* pObj, bool bType3 = false) const;
   FX_ARGB GetStrokeArgb(CPDF_PageObject* pObj) const;
   bool GetObjectClippedRect(const CPDF_PageObject* pObj,
diff --git a/core/fpdfapi/render/cpdf_transferfunc.cpp b/core/fpdfapi/render/cpdf_transferfunc.cpp
index e9ea057..98528c3 100644
--- a/core/fpdfapi/render/cpdf_transferfunc.cpp
+++ b/core/fpdfapi/render/cpdf_transferfunc.cpp
@@ -20,9 +20,9 @@
                    m_Samples[512 + FXSYS_GetBValue(rgb)]);
 }
 
-CFX_RetainPtr<CFX_DIBSource> CPDF_TransferFunc::TranslateImage(
-    const CFX_RetainPtr<CFX_DIBSource>& pSrc) {
-  CFX_RetainPtr<CPDF_TransferFunc> pHolder(this);
+RetainPtr<CFX_DIBSource> CPDF_TransferFunc::TranslateImage(
+    const RetainPtr<CFX_DIBSource>& pSrc) {
+  RetainPtr<CPDF_TransferFunc> pHolder(this);
   auto pDest = pdfium::MakeRetain<CPDF_DIBTransferFunc>(pHolder);
   pDest->LoadSrc(pSrc);
   return pDest;
diff --git a/core/fpdfapi/render/cpdf_transferfunc.h b/core/fpdfapi/render/cpdf_transferfunc.h
index ad7bf28..3281189 100644
--- a/core/fpdfapi/render/cpdf_transferfunc.h
+++ b/core/fpdfapi/render/cpdf_transferfunc.h
@@ -7,21 +7,20 @@
 #ifndef CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_
 #define CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/fx_dib.h"
 
 class CPDF_Document;
 class CFX_DIBSource;
 
-class CPDF_TransferFunc : public CFX_Retainable {
+class CPDF_TransferFunc : public Retainable {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   FX_COLORREF TranslateColor(FX_COLORREF src) const;
-  CFX_RetainPtr<CFX_DIBSource> TranslateImage(
-      const CFX_RetainPtr<CFX_DIBSource>& pSrc);
+  RetainPtr<CFX_DIBSource> TranslateImage(const RetainPtr<CFX_DIBSource>& pSrc);
 
   CFX_UnownedPtr<CPDF_Document> const m_pPDFDoc;
   bool m_bIdentity;
diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp
index b87b5ef..42b1160 100644
--- a/core/fpdfapi/render/cpdf_type3cache.cpp
+++ b/core/fpdfapi/render/cpdf_type3cache.cpp
@@ -53,8 +53,7 @@
   return false;
 }
 
-int DetectFirstLastScan(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
-                        bool bFirst) {
+int DetectFirstLastScan(const RetainPtr<CFX_DIBitmap>& pBitmap, bool bFirst) {
   int height = pBitmap->GetHeight();
   int pitch = pBitmap->GetPitch();
   int width = pBitmap->GetWidth();
@@ -123,12 +122,12 @@
   if (!pChar || !pChar->m_pBitmap)
     return nullptr;
 
-  CFX_RetainPtr<CFX_DIBitmap> pBitmap = pChar->m_pBitmap;
+  RetainPtr<CFX_DIBitmap> pBitmap = pChar->m_pBitmap;
   CFX_Matrix image_matrix = pChar->m_ImageMatrix;
   CFX_Matrix text_matrix(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0);
   image_matrix.Concat(text_matrix);
 
-  CFX_RetainPtr<CFX_DIBitmap> pResBitmap;
+  RetainPtr<CFX_DIBitmap> pResBitmap;
   int left = 0;
   int top = 0;
   if (fabs(image_matrix.b) < fabs(image_matrix.a) / 100 &&
diff --git a/core/fpdfapi/render/cpdf_type3cache.h b/core/fpdfapi/render/cpdf_type3cache.h
index ab748ba..fe681bb 100644
--- a/core/fpdfapi/render/cpdf_type3cache.h
+++ b/core/fpdfapi/render/cpdf_type3cache.h
@@ -11,17 +11,17 @@
 #include <memory>
 
 #include "core/fpdfapi/font/cpdf_type3font.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_Type3Glyphs;
 
-class CPDF_Type3Cache : public CFX_Retainable {
+class CPDF_Type3Cache : public Retainable {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   CFX_GlyphBitmap* LoadGlyph(uint32_t charcode,
                              const CFX_Matrix* pMatrix,