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,
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 87e5ba7..503c533 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -141,7 +141,7 @@
       continue;
 
     if (pOptions) {
-      CFX_RetainPtr<CPDF_OCContext> pOCContext = pOptions->m_pOCContext;
+      RetainPtr<CPDF_OCContext> pOCContext = pOptions->m_pOCContext;
       CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict();
       if (pOCContext && pAnnotDict &&
           !pOCContext->CheckOCGVisible(pAnnotDict->GetDictFor("OC"))) {
diff --git a/core/fpdfdoc/cpdf_occontext.h b/core/fpdfdoc/cpdf_occontext.h
index 3c93ef1..c4fbb25 100644
--- a/core/fpdfdoc/cpdf_occontext.h
+++ b/core/fpdfdoc/cpdf_occontext.h
@@ -9,18 +9,18 @@
 
 #include <map>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_Array;
 class CPDF_Dictionary;
 class CPDF_Document;
 class CPDF_PageObject;
 
-class CPDF_OCContext : public CFX_Retainable {
+class CPDF_OCContext : public Retainable {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   enum UsageType { View = 0, Design, Print, Export };
 
diff --git a/core/fpdfdoc/cpdf_structelement.h b/core/fpdfdoc/cpdf_structelement.h
index b54487e..c1e5f50 100644
--- a/core/fpdfdoc/cpdf_structelement.h
+++ b/core/fpdfdoc/cpdf_structelement.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_string.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/fx_dib.h"
 
 class CPDF_Dictionary;
@@ -27,17 +27,17 @@
 
   enum { Invalid, Element, PageContent, StreamContent, Object } m_Type;
 
-  CFX_RetainPtr<CPDF_StructElement> m_pElement;  // For Element.
+  RetainPtr<CPDF_StructElement> m_pElement;      // For Element.
   CFX_UnownedPtr<CPDF_Dictionary> m_pDict;       // For Element.
   uint32_t m_PageObjNum;  // For PageContent, StreamContent, Object.
   uint32_t m_RefObjNum;   // For StreamContent, Object.
   uint32_t m_ContentId;   // For PageContent, StreamContent.
 };
 
-class CPDF_StructElement : public CFX_Retainable {
+class CPDF_StructElement : public Retainable {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   const ByteString& GetType() const { return m_Type; }
   const ByteString& GetTitle() const { return m_Title; }
diff --git a/core/fpdfdoc/cpdf_structtree.cpp b/core/fpdfdoc/cpdf_structtree.cpp
index 9168a4f..0e9b529 100644
--- a/core/fpdfdoc/cpdf_structtree.cpp
+++ b/core/fpdfdoc/cpdf_structtree.cpp
@@ -85,16 +85,16 @@
   if (!pParentArray)
     return;
 
-  std::map<CPDF_Dictionary*, CFX_RetainPtr<CPDF_StructElement>> element_map;
+  std::map<CPDF_Dictionary*, RetainPtr<CPDF_StructElement>> element_map;
   for (size_t i = 0; i < pParentArray->GetCount(); i++) {
     if (CPDF_Dictionary* pParent = pParentArray->GetDictAt(i))
       AddPageNode(pParent, &element_map, 0);
   }
 }
 
-CFX_RetainPtr<CPDF_StructElement> CPDF_StructTree::AddPageNode(
+RetainPtr<CPDF_StructElement> CPDF_StructTree::AddPageNode(
     CPDF_Dictionary* pDict,
-    std::map<CPDF_Dictionary*, CFX_RetainPtr<CPDF_StructElement>>* map,
+    std::map<CPDF_Dictionary*, RetainPtr<CPDF_StructElement>>* map,
     int nLevel) {
   if (nLevel > nMaxRecursion)
     return nullptr;
@@ -112,7 +112,7 @@
     return pElement;
   }
 
-  CFX_RetainPtr<CPDF_StructElement> pParentElement =
+  RetainPtr<CPDF_StructElement> pParentElement =
       AddPageNode(pParent, map, nLevel + 1);
   bool bSave = false;
   for (CPDF_StructKid& kid : *pParentElement->GetKids()) {
@@ -128,7 +128,7 @@
 
 bool CPDF_StructTree::AddTopLevelNode(
     CPDF_Dictionary* pDict,
-    const CFX_RetainPtr<CPDF_StructElement>& pElement) {
+    const RetainPtr<CPDF_StructElement>& pElement) {
   CPDF_Object* pObj = m_pTreeRoot->GetDirectObjectFor("K");
   if (!pObj)
     return false;
diff --git a/core/fpdfdoc/cpdf_structtree.h b/core/fpdfdoc/cpdf_structtree.h
index 037512a..9603620 100644
--- a/core/fpdfdoc/cpdf_structtree.h
+++ b/core/fpdfdoc/cpdf_structtree.h
@@ -11,8 +11,8 @@
 #include <memory>
 #include <vector>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_Dictionary;
 class CPDF_Document;
@@ -35,17 +35,17 @@
 
  private:
   void LoadPageTree(const CPDF_Dictionary* pPageDict);
-  CFX_RetainPtr<CPDF_StructElement> AddPageNode(
+  RetainPtr<CPDF_StructElement> AddPageNode(
       CPDF_Dictionary* pElement,
-      std::map<CPDF_Dictionary*, CFX_RetainPtr<CPDF_StructElement>>* map,
+      std::map<CPDF_Dictionary*, RetainPtr<CPDF_StructElement>>* map,
       int nLevel);
   bool AddTopLevelNode(CPDF_Dictionary* pDict,
-                       const CFX_RetainPtr<CPDF_StructElement>& pElement);
+                       const RetainPtr<CPDF_StructElement>& pElement);
 
   CFX_UnownedPtr<const CPDF_Dictionary> const m_pTreeRoot;
   CFX_UnownedPtr<const CPDF_Dictionary> const m_pRoleMap;
   CFX_UnownedPtr<const CPDF_Dictionary> m_pPage;
-  std::vector<CFX_RetainPtr<CPDF_StructElement>> m_Kids;
+  std::vector<RetainPtr<CPDF_StructElement>> m_Kids;
 };
 
 #endif  // CORE_FPDFDOC_CPDF_STRUCTTREE_H_
diff --git a/core/fxcodec/codec/ccodec_jbig2module.h b/core/fxcodec/codec/ccodec_jbig2module.h
index 6b36f19..4fa4a81 100644
--- a/core/fxcodec/codec/ccodec_jbig2module.h
+++ b/core/fxcodec/codec/ccodec_jbig2module.h
@@ -10,7 +10,7 @@
 #include <memory>
 
 #include "core/fxcodec/fx_codec_def.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CJBig2_Context;
 class CJBig2_Image;
@@ -25,8 +25,8 @@
 
   uint32_t m_width;
   uint32_t m_height;
-  CFX_RetainPtr<CPDF_StreamAcc> m_pGlobalStream;
-  CFX_RetainPtr<CPDF_StreamAcc> m_pSrcStream;
+  RetainPtr<CPDF_StreamAcc> m_pGlobalStream;
+  RetainPtr<CPDF_StreamAcc> m_pSrcStream;
   uint8_t* m_dest_buf;
   uint32_t m_dest_pitch;
   std::unique_ptr<CJBig2_Context> m_pContext;
@@ -42,8 +42,8 @@
       std::unique_ptr<JBig2_DocumentContext>* pContextHolder,
       uint32_t width,
       uint32_t height,
-      const CFX_RetainPtr<CPDF_StreamAcc>& src_stream,
-      const CFX_RetainPtr<CPDF_StreamAcc>& global_stream,
+      const RetainPtr<CPDF_StreamAcc>& src_stream,
+      const RetainPtr<CPDF_StreamAcc>& global_stream,
       uint8_t* dest_buf,
       uint32_t dest_pitch,
       IFX_PauseIndicator* pPause);
diff --git a/core/fxcodec/codec/ccodec_jpegmodule.h b/core/fxcodec/codec/ccodec_jpegmodule.h
index a583717..d7e484d 100644
--- a/core/fxcodec/codec/ccodec_jpegmodule.h
+++ b/core/fxcodec/codec/ccodec_jpegmodule.h
@@ -9,8 +9,8 @@
 
 #include <memory>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CCodec_ScanlineDecoder;
 class CFX_DIBSource;
@@ -58,7 +58,7 @@
   uint32_t GetAvailInput(Context* pContext, uint8_t** avail_buf_ptr);
 
 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
-  static bool JpegEncode(const CFX_RetainPtr<CFX_DIBSource>& pSource,
+  static bool JpegEncode(const RetainPtr<CFX_DIBSource>& pSource,
                          uint8_t** dest_buf,
                          FX_STRSIZE* dest_size);
 #endif
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index 4417e47..3ce1940 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -16,9 +16,9 @@
 #include "core/fxcodec/codec/ccodec_pngmodule.h"
 #include "core/fxcodec/codec/ccodec_tiffmodule.h"
 #include "core/fxcodec/fx_codec_def.h"
-#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"
 #include "core/fxge/fx_dib.h"
 
 class CCodec_ModuleMgr;
@@ -44,11 +44,10 @@
   explicit CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr);
   virtual ~CCodec_ProgressiveDecoder();
 
-  FXCODEC_STATUS LoadImageInfo(
-      const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
-      FXCODEC_IMAGE_TYPE imageType,
-      CFX_DIBAttribute* pAttribute,
-      bool bSkipImageTypeCheck);
+  FXCODEC_STATUS LoadImageInfo(const RetainPtr<IFX_SeekableReadStream>& pFile,
+                               FXCODEC_IMAGE_TYPE imageType,
+                               CFX_DIBAttribute* pAttribute,
+                               bool bSkipImageTypeCheck);
 
   FXCODEC_IMAGE_TYPE GetType() const { return m_imagType; }
   int32_t GetWidth() const { return m_SrcWidth; }
@@ -58,7 +57,7 @@
   void SetClipBox(FX_RECT* clip);
 
   FXCODEC_STATUS GetFrames(int32_t& frames);
-  FXCODEC_STATUS StartDecode(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+  FXCODEC_STATUS StartDecode(const RetainPtr<CFX_DIBitmap>& pDIBitmap,
                              int start_x,
                              int start_y,
                              int size_x,
@@ -158,38 +157,36 @@
                        FXCODEC_STATUS& err_status);
   bool GifReadMoreData(CCodec_GifModule* pGifModule,
                        FXCODEC_STATUS& err_status);
-  void GifDoubleLineResampleVert(
-      const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
-      double scale_y,
-      int des_row);
-  void PngOneOneMapResampleHorz(
-      const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
-      int32_t des_line,
-      uint8_t* src_scan,
-      FXCodec_Format src_format);
+  void GifDoubleLineResampleVert(const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+                                 double scale_y,
+                                 int des_row);
+  void PngOneOneMapResampleHorz(const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+                                int32_t des_line,
+                                uint8_t* src_scan,
+                                FXCodec_Format src_format);
   bool DetectImageType(FXCODEC_IMAGE_TYPE imageType,
                        CFX_DIBAttribute* pAttribute);
   void GetDownScale(int& down_scale);
   void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format);
-  void ReSampleScanline(const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+  void ReSampleScanline(const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
                         int32_t des_line,
                         uint8_t* src_scan,
                         FXCodec_Format src_format);
-  void Resample(const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+  void Resample(const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
                 int32_t src_line,
                 uint8_t* src_scan,
                 FXCodec_Format src_format);
-  void ResampleVert(const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+  void ResampleVert(const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
                     double scale_y,
                     int des_row);
   bool JpegReadMoreData(CCodec_JpegModule* pJpegModule,
                         FXCODEC_STATUS& err_status);
-  void ResampleVertBT(const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+  void ResampleVertBT(const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
                       double scale_y,
                       int des_row);
 
-  CFX_RetainPtr<IFX_SeekableReadStream> m_pFile;
-  CFX_RetainPtr<CFX_DIBitmap> m_pDeviceBitmap;
+  RetainPtr<IFX_SeekableReadStream> m_pFile;
+  RetainPtr<CFX_DIBitmap> m_pDeviceBitmap;
   CFX_UnownedPtr<CCodec_ModuleMgr> m_pCodecMgr;
   std::unique_ptr<CCodec_JpegModule::Context> m_pJpegContext;
   std::unique_ptr<CCodec_PngModule::Context> m_pPngContext;
diff --git a/core/fxcodec/codec/ccodec_tiffmodule.cpp b/core/fxcodec/codec/ccodec_tiffmodule.cpp
index e0cb719..07d1892 100644
--- a/core/fxcodec/codec/ccodec_tiffmodule.cpp
+++ b/core/fxcodec/codec/ccodec_tiffmodule.cpp
@@ -10,9 +10,9 @@
 
 #include "core/fxcodec/codec/codec_int.h"
 #include "core/fxcodec/fx_codec.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_safe_types.h"
 #include "core/fxcrt/fx_stream.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "core/fxge/fx_dib.h"
 #include "third_party/base/logging.h"
@@ -27,39 +27,39 @@
   CTiffContext();
   ~CTiffContext() override;
 
-  bool InitDecoder(const CFX_RetainPtr<IFX_SeekableReadStream>& file_ptr);
+  bool InitDecoder(const RetainPtr<IFX_SeekableReadStream>& file_ptr);
   bool LoadFrameInfo(int32_t frame,
                      int32_t* width,
                      int32_t* height,
                      int32_t* comps,
                      int32_t* bpc,
                      CFX_DIBAttribute* pAttribute);
-  bool Decode(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap);
+  bool Decode(const RetainPtr<CFX_DIBitmap>& pDIBitmap);
 
-  CFX_RetainPtr<IFX_SeekableReadStream> io_in() const { return m_io_in; }
+  RetainPtr<IFX_SeekableReadStream> io_in() const { return m_io_in; }
   uint32_t offset() const { return m_offset; }
   void set_offset(uint32_t offset) { m_offset = offset; }
 
  private:
-  bool IsSupport(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) const;
-  void SetPalette(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap, uint16_t bps);
-  bool Decode1bppRGB(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+  bool IsSupport(const RetainPtr<CFX_DIBitmap>& pDIBitmap) const;
+  void SetPalette(const RetainPtr<CFX_DIBitmap>& pDIBitmap, uint16_t bps);
+  bool Decode1bppRGB(const RetainPtr<CFX_DIBitmap>& pDIBitmap,
                      int32_t height,
                      int32_t width,
                      uint16_t bps,
                      uint16_t spp);
-  bool Decode8bppRGB(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+  bool Decode8bppRGB(const RetainPtr<CFX_DIBitmap>& pDIBitmap,
                      int32_t height,
                      int32_t width,
                      uint16_t bps,
                      uint16_t spp);
-  bool Decode24bppRGB(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+  bool Decode24bppRGB(const RetainPtr<CFX_DIBitmap>& pDIBitmap,
                       int32_t height,
                       int32_t width,
                       uint16_t bps,
                       uint16_t spp);
 
-  CFX_RetainPtr<IFX_SeekableReadStream> m_io_in;
+  RetainPtr<IFX_SeekableReadStream> m_io_in;
   uint32_t m_offset;
   TIFF* m_tif_ctx;
 };
@@ -228,7 +228,7 @@
 }
 
 bool CTiffContext::InitDecoder(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& file_ptr) {
+    const RetainPtr<IFX_SeekableReadStream>& file_ptr) {
   m_io_in = file_ptr;
   m_tif_ctx = tiff_open(this, "r");
   return !!m_tif_ctx;
@@ -291,8 +291,7 @@
   return true;
 }
 
-bool CTiffContext::IsSupport(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) const {
+bool CTiffContext::IsSupport(const RetainPtr<CFX_DIBitmap>& pDIBitmap) const {
   if (TIFFIsTiled(m_tif_ctx))
     return false;
 
@@ -322,7 +321,7 @@
   return planarconfig != PLANARCONFIG_SEPARATE;
 }
 
-void CTiffContext::SetPalette(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+void CTiffContext::SetPalette(const RetainPtr<CFX_DIBitmap>& pDIBitmap,
                               uint16_t bps) {
   uint16_t* red_orig = nullptr;
   uint16_t* green_orig = nullptr;
@@ -346,7 +345,7 @@
   }
 }
 
-bool CTiffContext::Decode1bppRGB(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+bool CTiffContext::Decode1bppRGB(const RetainPtr<CFX_DIBitmap>& pDIBitmap,
                                  int32_t height,
                                  int32_t width,
                                  uint16_t bps,
@@ -374,7 +373,7 @@
   return true;
 }
 
-bool CTiffContext::Decode8bppRGB(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+bool CTiffContext::Decode8bppRGB(const RetainPtr<CFX_DIBitmap>& pDIBitmap,
                                  int32_t height,
                                  int32_t width,
                                  uint16_t bps,
@@ -410,7 +409,7 @@
   return true;
 }
 
-bool CTiffContext::Decode24bppRGB(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+bool CTiffContext::Decode24bppRGB(const RetainPtr<CFX_DIBitmap>& pDIBitmap,
                                   int32_t height,
                                   int32_t width,
                                   uint16_t bps,
@@ -438,7 +437,7 @@
   return true;
 }
 
-bool CTiffContext::Decode(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) {
+bool CTiffContext::Decode(const RetainPtr<CFX_DIBitmap>& pDIBitmap) {
   uint32_t img_wid = pDIBitmap->GetWidth();
   uint32_t img_hei = pDIBitmap->GetHeight();
   uint32_t width = 0;
@@ -480,7 +479,7 @@
 }
 
 std::unique_ptr<CCodec_TiffModule::Context> CCodec_TiffModule::CreateDecoder(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& file_ptr) {
+    const RetainPtr<IFX_SeekableReadStream>& file_ptr) {
   auto pDecoder = pdfium::MakeUnique<CTiffContext>();
   if (!pDecoder->InitDecoder(file_ptr))
     return nullptr;
@@ -500,7 +499,7 @@
 }
 
 bool CCodec_TiffModule::Decode(Context* pContext,
-                               const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) {
+                               const RetainPtr<CFX_DIBitmap>& pDIBitmap) {
   auto* ctx = static_cast<CTiffContext*>(pContext);
   return ctx->Decode(pDIBitmap);
 }
diff --git a/core/fxcodec/codec/ccodec_tiffmodule.h b/core/fxcodec/codec/ccodec_tiffmodule.h
index 6e6e36b..8d3bed7 100644
--- a/core/fxcodec/codec/ccodec_tiffmodule.h
+++ b/core/fxcodec/codec/ccodec_tiffmodule.h
@@ -9,8 +9,8 @@
 
 #include <memory>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/dib/cfx_dibitmap.h"
 
 class CFX_DIBAttribute;
@@ -24,7 +24,7 @@
   };
 
   std::unique_ptr<Context> CreateDecoder(
-      const CFX_RetainPtr<IFX_SeekableReadStream>& file_ptr);
+      const RetainPtr<IFX_SeekableReadStream>& file_ptr);
   bool LoadFrameInfo(Context* ctx,
                      int32_t frame,
                      int32_t* width,
@@ -32,7 +32,7 @@
                      int32_t* comps,
                      int32_t* bpc,
                      CFX_DIBAttribute* pAttribute);
-  bool Decode(Context* ctx, const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap);
+  bool Decode(Context* ctx, const RetainPtr<CFX_DIBitmap>& pDIBitmap);
 };
 
 #endif  // CORE_FXCODEC_CODEC_CCODEC_TIFFMODULE_H_
diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp
index f6ace30..543aeeb 100644
--- a/core/fxcodec/codec/fx_codec_jbig.cpp
+++ b/core/fxcodec/codec/fx_codec_jbig.cpp
@@ -44,8 +44,8 @@
     std::unique_ptr<JBig2_DocumentContext>* pContextHolder,
     uint32_t width,
     uint32_t height,
-    const CFX_RetainPtr<CPDF_StreamAcc>& src_stream,
-    const CFX_RetainPtr<CPDF_StreamAcc>& global_stream,
+    const RetainPtr<CPDF_StreamAcc>& src_stream,
+    const RetainPtr<CPDF_StreamAcc>& global_stream,
     uint8_t* dest_buf,
     uint32_t dest_pitch,
     IFX_PauseIndicator* pPause) {
diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp
index 1084529..ea32f00 100644
--- a/core/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/fxcodec/codec/fx_codec_jpeg.cpp
@@ -508,7 +508,7 @@
 
 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
 #define JPEG_BLOCK_SIZE 1048576
-bool CCodec_JpegModule::JpegEncode(const CFX_RetainPtr<CFX_DIBSource>& pSource,
+bool CCodec_JpegModule::JpegEncode(const RetainPtr<CFX_DIBSource>& pSource,
                                    uint8_t** dest_buf,
                                    FX_STRSIZE* dest_size) {
   struct jpeg_error_mgr jerr;
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index a70041b..8b90d3a 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -396,7 +396,7 @@
 }
 
 bool CCodec_ProgressiveDecoder::PngAskScanlineBuf(int line, uint8_t*& src_buf) {
-  CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
+  RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
   if (!pDIBitmap) {
     NOTREACHED();
     return false;
@@ -465,7 +465,7 @@
 }
 
 void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+    const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
     int32_t des_line,
     uint8_t* src_scan,
     FXCodec_Format src_format) {
@@ -538,7 +538,7 @@
 
 void CCodec_ProgressiveDecoder::PngFillScanlineBufCompleted(int pass,
                                                             int line) {
-  CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
+  RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
   ASSERT(pDIBitmap);
   int src_top = m_clipBox.top;
   int src_bottom = m_clipBox.bottom;
@@ -645,7 +645,7 @@
   m_GifFrameRect = img_rc;
   m_SrcPassNumber = interlace ? 4 : 1;
   int32_t pal_index = m_GifBgIndex;
-  CFX_RetainPtr<CFX_DIBitmap> pDevice = m_pDeviceBitmap;
+  RetainPtr<CFX_DIBitmap> pDevice = m_pDeviceBitmap;
   if (trans_index >= pal_num)
     trans_index = -1;
   if (trans_index != -1) {
@@ -695,7 +695,7 @@
 
 void CCodec_ProgressiveDecoder::GifReadScanline(int32_t row_num,
                                                 uint8_t* row_buf) {
-  CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
+  RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
   ASSERT(pDIBitmap);
   int32_t img_width = m_GifFrameRect.Width();
   if (!pDIBitmap->HasAlpha()) {
@@ -757,7 +757,7 @@
 }
 
 void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+    const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
     double scale_y,
     int des_row) {
   int des_Bpp = pDeviceBitmap->GetBPP() >> 3;
@@ -883,7 +883,7 @@
 void CCodec_ProgressiveDecoder::BmpReadScanline(
     uint32_t row_num,
     const std::vector<uint8_t>& row_buf) {
-  CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
+  RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
   ASSERT(pDIBitmap);
   std::copy(row_buf.begin(), row_buf.begin() + m_ScanlineSize, m_pDecodeBuf);
   int src_top = m_clipBox.top;
@@ -914,7 +914,7 @@
 }
 
 void CCodec_ProgressiveDecoder::ResampleVertBT(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+    const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
     double scale_y,
     int des_row) {
   int des_Bpp = pDeviceBitmap->GetBPP() >> 3;
@@ -1254,7 +1254,7 @@
 }
 
 FXCODEC_STATUS CCodec_ProgressiveDecoder::LoadImageInfo(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+    const RetainPtr<IFX_SeekableReadStream>& pFile,
     FXCODEC_IMAGE_TYPE imageType,
     CFX_DIBAttribute* pAttribute,
     bool bSkipImageTypeCheck) {
@@ -1446,7 +1446,7 @@
 }
 
 void CCodec_ProgressiveDecoder::ReSampleScanline(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+    const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
     int des_line,
     uint8_t* src_scan,
     FXCodec_Format src_format) {
@@ -1653,7 +1653,7 @@
 }
 
 void CCodec_ProgressiveDecoder::ResampleVert(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+    const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
     double scale_y,
     int des_row) {
   int des_Bpp = pDeviceBitmap->GetBPP() >> 3;
@@ -1769,7 +1769,7 @@
 }
 
 void CCodec_ProgressiveDecoder::Resample(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+    const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
     int32_t src_line,
     uint8_t* src_scan,
     FXCodec_Format src_format) {
@@ -1837,7 +1837,7 @@
 }
 
 FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+    const RetainPtr<CFX_DIBitmap>& pDIBitmap,
     int start_x,
     int start_y,
     int size_x,
@@ -2206,7 +2206,7 @@
         m_status = FXCODEC_STATUS_ERROR;
         return m_status;
       }
-      CFX_RetainPtr<CFX_DIBitmap> pClipBitmap =
+      RetainPtr<CFX_DIBitmap> pClipBitmap =
           (m_clipBox.left == 0 && m_clipBox.top == 0 &&
            m_clipBox.right == m_SrcWidth && m_clipBox.bottom == m_SrcHeight)
               ? pDIBitmap
@@ -2217,7 +2217,7 @@
         m_status = FXCODEC_STATUS_ERR_MEMORY;
         return m_status;
       }
-      CFX_RetainPtr<CFX_DIBitmap> pFormatBitmap;
+      RetainPtr<CFX_DIBitmap> pFormatBitmap;
       switch (m_pDeviceBitmap->GetFormat()) {
         case FXDIB_8bppRgb:
           pFormatBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
@@ -2289,7 +2289,7 @@
         m_status = FXCODEC_STATUS_ERR_MEMORY;
         return m_status;
       }
-      CFX_RetainPtr<CFX_DIBitmap> pStrechBitmap = pFormatBitmap->StretchTo(
+      RetainPtr<CFX_DIBitmap> pStrechBitmap = pFormatBitmap->StretchTo(
           m_sizeX, m_sizeY, m_bInterpol ? FXDIB_INTERPOL : FXDIB_DOWNSAMPLE,
           nullptr);
       pFormatBitmap = nullptr;
diff --git a/core/fxcodec/jbig2/JBig2_BitStream.cpp b/core/fxcodec/jbig2/JBig2_BitStream.cpp
index 921fa2a..a72099d 100644
--- a/core/fxcodec/jbig2/JBig2_BitStream.cpp
+++ b/core/fxcodec/jbig2/JBig2_BitStream.cpp
@@ -11,8 +11,7 @@
 #include "core/fpdfapi/parser/cpdf_stream.h"
 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
 
-CJBig2_BitStream::CJBig2_BitStream(
-    const CFX_RetainPtr<CPDF_StreamAcc>& pSrcStream)
+CJBig2_BitStream::CJBig2_BitStream(const RetainPtr<CPDF_StreamAcc>& pSrcStream)
     : m_pBuf(pSrcStream->GetData()),
       m_dwLength(pSrcStream->GetSize()),
       m_dwByteIdx(0),
diff --git a/core/fxcodec/jbig2/JBig2_BitStream.h b/core/fxcodec/jbig2/JBig2_BitStream.h
index 0be6c4b..0edb432 100644
--- a/core/fxcodec/jbig2/JBig2_BitStream.h
+++ b/core/fxcodec/jbig2/JBig2_BitStream.h
@@ -7,13 +7,13 @@
 #ifndef CORE_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_
 #define CORE_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_
 
-#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CPDF_StreamAcc;
 
 class CJBig2_BitStream {
  public:
-  explicit CJBig2_BitStream(const CFX_RetainPtr<CPDF_StreamAcc>& pSrcStream);
+  explicit CJBig2_BitStream(const RetainPtr<CPDF_StreamAcc>& pSrcStream);
   ~CJBig2_BitStream();
 
   // TODO(thestig): readFoo() should return bool.
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index 363be2f..7c79ad8 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -48,11 +48,10 @@
 // difference for typical JBIG2 documents.
 static const int kSymbolDictCacheMaxSize = 2;
 
-CJBig2_Context::CJBig2_Context(
-    const CFX_RetainPtr<CPDF_StreamAcc>& pGlobalStream,
-    const CFX_RetainPtr<CPDF_StreamAcc>& pSrcStream,
-    std::list<CJBig2_CachePair>* pSymbolDictCache,
-    bool bIsGlobal)
+CJBig2_Context::CJBig2_Context(const RetainPtr<CPDF_StreamAcc>& pGlobalStream,
+                               const RetainPtr<CPDF_StreamAcc>& pSrcStream,
+                               std::list<CJBig2_CachePair>* pSymbolDictCache,
+                               bool bIsGlobal)
     : m_nSegmentDecoded(0),
       m_bInPage(false),
       m_bBufSpecified(false),
diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h
index c88fc6f..bed1079 100644
--- a/core/fxcodec/jbig2/JBig2_Context.h
+++ b/core/fxcodec/jbig2/JBig2_Context.h
@@ -40,8 +40,8 @@
 
 class CJBig2_Context {
  public:
-  CJBig2_Context(const CFX_RetainPtr<CPDF_StreamAcc>& pGlobalStream,
-                 const CFX_RetainPtr<CPDF_StreamAcc>& pSrcStream,
+  CJBig2_Context(const RetainPtr<CPDF_StreamAcc>& pGlobalStream,
+                 const RetainPtr<CPDF_StreamAcc>& pSrcStream,
                  std::list<CJBig2_CachePair>* pSymbolDictCache,
                  bool bIsGlobal);
   ~CJBig2_Context();
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp
index dd4dbd9..2d343ff 100644
--- a/core/fxcrt/bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -298,7 +298,7 @@
     return;
   }
 
-  CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
+  RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
   if (m_pData) {
     FX_STRSIZE nCopyLength = std::min(m_pData->m_nDataLength, nNewLength);
     pNewData->CopyContents(m_pData->m_String, nCopyLength);
@@ -365,7 +365,7 @@
   if (nMinBufLength == 0)
     return nullptr;
 
-  CFX_RetainPtr<StringData> pNewData(StringData::Create(nMinBufLength));
+  RetainPtr<StringData> pNewData(StringData::Create(nMinBufLength));
   pNewData->CopyContents(*m_pData);
   pNewData->m_nDataLength = m_pData->m_nDataLength;
   m_pData.Swap(pNewData);
@@ -408,7 +408,7 @@
     return;
   }
 
-  CFX_RetainPtr<StringData> pNewData(
+  RetainPtr<StringData> pNewData(
       StringData::Create(m_pData->m_nDataLength + nSrcLen));
   pNewData->CopyContents(*m_pData);
   pNewData->CopyContentsAt(m_pData->m_nDataLength, pSrcData, nSrcLen);
@@ -454,7 +454,7 @@
   if (nCopyLen == 0)
     return;
 
-  CFX_RetainPtr<StringData> pNewData(
+  RetainPtr<StringData> pNewData(
       StringData::Create(m_pData->m_String + nCopyIndex, nCopyLen));
   dest.m_pData.Swap(pNewData);
 }
@@ -637,7 +637,7 @@
     return nCount;
   }
 
-  CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
+  RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
   pStart = m_pData->m_String;
   char* pDest = pNewData->m_String;
   for (FX_STRSIZE i = 0; i < nCount; i++) {
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
index 0220e70..7342fdb 100644
--- a/core/fxcrt/bytestring.h
+++ b/core/fxcrt/bytestring.h
@@ -12,9 +12,9 @@
 #include <sstream>
 #include <utility>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_string_data_template.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/string_view_template.h"
 #include "third_party/base/optional.h"
 
@@ -195,7 +195,7 @@
   void AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen);
   void Concat(const char* lpszSrcData, FX_STRSIZE nSrcLen);
 
-  CFX_RetainPtr<StringData> m_pData;
+  RetainPtr<StringData> m_pData;
 
   friend ByteString_Concat_Test;
   friend fxcrt_ByteStringPool_Test;
diff --git a/core/fxcrt/cfx_char.h b/core/fxcrt/cfx_char.h
index 74f0a4f..fb625ee 100644
--- a/core/fxcrt/cfx_char.h
+++ b/core/fxcrt/cfx_char.h
@@ -40,7 +40,7 @@
   int16_t m_iBidiOrder;
   int32_t m_iFontSize;
   uint32_t m_dwIdentity;
-  CFX_RetainPtr<CFX_Retainable> m_pUserData;
+  RetainPtr<Retainable> m_pUserData;
 
  private:
   uint16_t m_wCharCode;
diff --git a/core/fxcrt/cfx_checksumcontext.cpp b/core/fxcrt/cfx_checksumcontext.cpp
index c75e440..3d3409d 100644
--- a/core/fxcrt/cfx_checksumcontext.cpp
+++ b/core/fxcrt/cfx_checksumcontext.cpp
@@ -105,7 +105,7 @@
 }
 
 bool CFX_ChecksumContext::UpdateChecksum(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pSrcFile,
+    const RetainPtr<IFX_SeekableReadStream>& pSrcFile,
     FX_FILESIZE offset,
     size_t size) {
   if (!m_pSAXReader || !pSrcFile)
diff --git a/core/fxcrt/cfx_checksumcontext.h b/core/fxcrt/cfx_checksumcontext.h
index 4231e09..6d7963a 100644
--- a/core/fxcrt/cfx_checksumcontext.h
+++ b/core/fxcrt/cfx_checksumcontext.h
@@ -19,7 +19,7 @@
 
   void StartChecksum();
   void Update(const ByteStringView& bsText);
-  bool UpdateChecksum(const CFX_RetainPtr<IFX_SeekableReadStream>& pSrcFile,
+  bool UpdateChecksum(const RetainPtr<IFX_SeekableReadStream>& pSrcFile,
                       FX_FILESIZE offset = 0,
                       size_t size = 0);
   void FinishChecksum();
diff --git a/core/fxcrt/cfx_crtfileaccess.cpp b/core/fxcrt/cfx_crtfileaccess.cpp
index 2479c95..b6a6a74 100644
--- a/core/fxcrt/cfx_crtfileaccess.cpp
+++ b/core/fxcrt/cfx_crtfileaccess.cpp
@@ -11,7 +11,7 @@
 
 CFX_CRTFileAccess::~CFX_CRTFileAccess() {}
 
-CFX_RetainPtr<IFX_SeekableStream> CFX_CRTFileAccess::CreateFileStream(
+RetainPtr<IFX_SeekableStream> CFX_CRTFileAccess::CreateFileStream(
     uint32_t dwModes) {
   return IFX_SeekableStream::CreateFromFilename(m_path.c_str(), dwModes);
 }
diff --git a/core/fxcrt/cfx_crtfileaccess.h b/core/fxcrt/cfx_crtfileaccess.h
index 3c63aa3..962a6d1 100644
--- a/core/fxcrt/cfx_crtfileaccess.h
+++ b/core/fxcrt/cfx_crtfileaccess.h
@@ -7,16 +7,16 @@
 #ifndef CORE_FXCRT_CFX_CRTFILEACCESS_H_
 #define CORE_FXCRT_CFX_CRTFILEACCESS_H_
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_stream.h"
 #include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/retain_ptr.h"
 
-class CFX_CRTFileAccess : public CFX_Retainable {
+class CFX_CRTFileAccess : public Retainable {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
-  CFX_RetainPtr<IFX_SeekableStream> CreateFileStream(uint32_t dwModes);
+  RetainPtr<IFX_SeekableStream> CreateFileStream(uint32_t dwModes);
 
  private:
   explicit CFX_CRTFileAccess(const WideStringView& wsPath);
diff --git a/core/fxcrt/cfx_memorystream.h b/core/fxcrt/cfx_memorystream.h
index 2112280..ef66080 100644
--- a/core/fxcrt/cfx_memorystream.h
+++ b/core/fxcrt/cfx_memorystream.h
@@ -9,15 +9,15 @@
 
 #include <vector>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_stream.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CFX_MemoryStream : public IFX_SeekableStream {
  public:
   enum Type { kConsecutive = 1 << 0, kTakeOver = 1 << 1 };
 
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   // IFX_SeekableStream
   FX_FILESIZE GetSize() override;
diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp
index 6a6c6e6..611c3eb 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.cpp
+++ b/core/fxcrt/cfx_seekablestreamproxy.cpp
@@ -134,7 +134,7 @@
 #define BOM_UTF16_LE 0x0000FEFF
 
 CFX_SeekableStreamProxy::CFX_SeekableStreamProxy(
-    const CFX_RetainPtr<IFX_SeekableStream>& stream,
+    const RetainPtr<IFX_SeekableStream>& stream,
     bool isWriteStream)
     : m_IsWriteStream(isWriteStream),
       m_wCodePage(FX_CODEPAGE_DefANSI),
diff --git a/core/fxcrt/cfx_seekablestreamproxy.h b/core/fxcrt/cfx_seekablestreamproxy.h
index fc041b4..cadc968 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.h
+++ b/core/fxcrt/cfx_seekablestreamproxy.h
@@ -9,11 +9,11 @@
 
 #include <algorithm>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_stream.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
-class CFX_SeekableStreamProxy : public CFX_Retainable {
+class CFX_SeekableStreamProxy : public Retainable {
  public:
   enum class From {
     Begin = 0,
@@ -21,7 +21,7 @@
   };
 
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   FX_FILESIZE GetLength() const { return m_pStream->GetSize(); }
   FX_FILESIZE GetPosition() { return m_iPosition; }
@@ -37,7 +37,7 @@
   void SetCodePage(uint16_t wCodePage);
 
  private:
-  CFX_SeekableStreamProxy(const CFX_RetainPtr<IFX_SeekableStream>& stream,
+  CFX_SeekableStreamProxy(const RetainPtr<IFX_SeekableStream>& stream,
                           bool isWriteSteam);
   CFX_SeekableStreamProxy(uint8_t* data, FX_STRSIZE size);
   ~CFX_SeekableStreamProxy() override;
@@ -48,7 +48,7 @@
   uint16_t m_wCodePage;
   FX_STRSIZE m_wBOMLength;
   FX_FILESIZE m_iPosition;
-  CFX_RetainPtr<IFX_SeekableStream> m_pStream;
+  RetainPtr<IFX_SeekableStream> m_pStream;
 };
 
 #endif  // CORE_FXCRT_CFX_SEEKABLESTREAMPROXY_H_
diff --git a/core/fxcrt/cfx_shared_copy_on_write.h b/core/fxcrt/cfx_shared_copy_on_write.h
index c87d965..f897368 100644
--- a/core/fxcrt/cfx_shared_copy_on_write.h
+++ b/core/fxcrt/cfx_shared_copy_on_write.h
@@ -7,8 +7,8 @@
 #ifndef CORE_FXCRT_CFX_SHARED_COPY_ON_WRITE_H_
 #define CORE_FXCRT_CFX_SHARED_COPY_ON_WRITE_H_
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
 // A shared object with Copy on Write semantics that makes it appear as
 // if each one were independent.
@@ -79,7 +79,7 @@
     intptr_t m_RefCount;
   };
 
-  CFX_RetainPtr<CountedObj> m_pObject;
+  RetainPtr<CountedObj> m_pObject;
 };
 
 #endif  // CORE_FXCRT_CFX_SHARED_COPY_ON_WRITE_H_
diff --git a/core/fxcrt/cfx_weak_ptr.h b/core/fxcrt/cfx_weak_ptr.h
index 4aca1c3..da96000 100644
--- a/core/fxcrt/cfx_weak_ptr.h
+++ b/core/fxcrt/cfx_weak_ptr.h
@@ -11,8 +11,8 @@
 #include <memory>
 #include <utility>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 
 template <class T, class D = std::default_delete<T>>
 class CFX_WeakPtr {
@@ -80,7 +80,7 @@
     std::unique_ptr<T, D> m_pObj;
   };
 
-  CFX_RetainPtr<Handle> m_pHandle;
+  RetainPtr<Handle> m_pHandle;
 };
 
 #endif  // CORE_FXCRT_CFX_WEAK_PTR_H_
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.h b/core/fxcrt/css/cfx_csscomputedstyle.h
index b05339a..4b44a6d 100644
--- a/core/fxcrt/css/cfx_csscomputedstyle.h
+++ b/core/fxcrt/css/cfx_csscomputedstyle.h
@@ -15,7 +15,7 @@
 
 class CFX_CSSValueList;
 
-class CFX_CSSComputedStyle : public CFX_Retainable {
+class CFX_CSSComputedStyle : public Retainable {
  public:
   class InheritedData {
    public:
@@ -25,7 +25,7 @@
     CFX_CSSLength m_LetterSpacing;
     CFX_CSSLength m_WordSpacing;
     CFX_CSSLength m_TextIndent;
-    CFX_RetainPtr<CFX_CSSValueList> m_pFontFamily;
+    RetainPtr<CFX_CSSValueList> m_pFontFamily;
     float m_fFontSize;
     float m_fLineHeight;
     FX_ARGB m_dwFontColor;
@@ -98,7 +98,7 @@
 
  private:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   CFX_CSSComputedStyle();
   ~CFX_CSSComputedStyle() override;
diff --git a/core/fxcrt/css/cfx_cssdeclaration.cpp b/core/fxcrt/css/cfx_cssdeclaration.cpp
index f2c7d39..c44c878 100644
--- a/core/fxcrt/css/cfx_cssdeclaration.cpp
+++ b/core/fxcrt/css/cfx_cssdeclaration.cpp
@@ -285,7 +285,7 @@
 
 CFX_CSSDeclaration::~CFX_CSSDeclaration() {}
 
-CFX_RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::GetProperty(
+RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::GetProperty(
     CFX_CSSProperty eProperty,
     bool* bImportant) const {
   for (const auto& p : properties_) {
@@ -298,7 +298,7 @@
 }
 
 void CFX_CSSDeclaration::AddPropertyHolder(CFX_CSSProperty eProperty,
-                                           CFX_RetainPtr<CFX_CSSValue> pValue,
+                                           RetainPtr<CFX_CSSValue> pValue,
                                            bool bImportant) {
   auto pHolder = pdfium::MakeUnique<CFX_CSSPropertyHolder>();
   pHolder->bImportant = bImportant;
@@ -335,7 +335,7 @@
         if (dwMatch == 0) {
           continue;
         }
-        CFX_RetainPtr<CFX_CSSValue> pCSSValue;
+        RetainPtr<CFX_CSSValue> pCSSValue;
         switch (dwMatch) {
           case CFX_CSSVALUETYPE_MaybeNumber:
             pCSSValue = ParseNumber(pszValue, iValueLen);
@@ -363,7 +363,7 @@
       break;
     }
     case CFX_CSSVALUETYPE_Shorthand: {
-      CFX_RetainPtr<CFX_CSSValue> pWidth;
+      RetainPtr<CFX_CSSValue> pWidth;
       switch (pTable->eName) {
         case CFX_CSSProperty::Font:
           ParseFontProperty(pszValue, iValueLen, bImportant);
@@ -428,9 +428,8 @@
       pdfium::MakeUnique<CFX_CSSCustomProperty>(prop, value));
 }
 
-CFX_RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::ParseNumber(
-    const wchar_t* pszValue,
-    int32_t iValueLen) {
+RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::ParseNumber(const wchar_t* pszValue,
+                                                        int32_t iValueLen) {
   float fValue;
   CFX_CSSNumberType eUnit;
   if (!ParseCSSNumber(pszValue, iValueLen, fValue, eUnit))
@@ -438,26 +437,23 @@
   return pdfium::MakeRetain<CFX_CSSNumberValue>(eUnit, fValue);
 }
 
-CFX_RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::ParseEnum(
-    const wchar_t* pszValue,
-    int32_t iValueLen) {
+RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::ParseEnum(const wchar_t* pszValue,
+                                                      int32_t iValueLen) {
   const CFX_CSSPropertyValueTable* pValue =
       GetCSSPropertyValueByName(WideStringView(pszValue, iValueLen));
   return pValue ? pdfium::MakeRetain<CFX_CSSEnumValue>(pValue->eName) : nullptr;
 }
 
-CFX_RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::ParseColor(
-    const wchar_t* pszValue,
-    int32_t iValueLen) {
+RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::ParseColor(const wchar_t* pszValue,
+                                                       int32_t iValueLen) {
   FX_ARGB dwColor;
   if (!ParseCSSColor(pszValue, iValueLen, &dwColor))
     return nullptr;
   return pdfium::MakeRetain<CFX_CSSColorValue>(dwColor);
 }
 
-CFX_RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::ParseString(
-    const wchar_t* pszValue,
-    int32_t iValueLen) {
+RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::ParseString(const wchar_t* pszValue,
+                                                        int32_t iValueLen) {
   int32_t iOffset;
   if (!ParseCSSString(pszValue, iValueLen, &iOffset, &iValueLen))
     return nullptr;
@@ -480,7 +476,7 @@
 
   const uint32_t dwType = pTable->dwType;
   CFX_CSSPrimitiveType eType;
-  std::vector<CFX_RetainPtr<CFX_CSSValue>> list;
+  std::vector<RetainPtr<CFX_CSSValue>> list;
   while (parser.NextValue(eType, pszValue, iValueLen)) {
     switch (eType) {
       case CFX_CSSPrimitiveType::Number:
@@ -556,7 +552,7 @@
 }
 
 void CFX_CSSDeclaration::Add4ValuesProperty(
-    const std::vector<CFX_RetainPtr<CFX_CSSValue>>& list,
+    const std::vector<RetainPtr<CFX_CSSValue>>& list,
     bool bImportant,
     CFX_CSSProperty eLeft,
     CFX_CSSProperty eTop,
@@ -595,7 +591,7 @@
 bool CFX_CSSDeclaration::ParseBorderProperty(
     const wchar_t* pszValue,
     int32_t iValueLen,
-    CFX_RetainPtr<CFX_CSSValue>& pWidth) const {
+    RetainPtr<CFX_CSSValue>& pWidth) const {
   pWidth.Reset(nullptr);
 
   CFX_CSSValueListParser parser(pszValue, iValueLen, ' ');
@@ -650,12 +646,12 @@
                                            int32_t iValueLen,
                                            bool bImportant) {
   CFX_CSSValueListParser parser(pszValue, iValueLen, '/');
-  CFX_RetainPtr<CFX_CSSValue> pStyle;
-  CFX_RetainPtr<CFX_CSSValue> pVariant;
-  CFX_RetainPtr<CFX_CSSValue> pWeight;
-  CFX_RetainPtr<CFX_CSSValue> pFontSize;
-  CFX_RetainPtr<CFX_CSSValue> pLineHeight;
-  std::vector<CFX_RetainPtr<CFX_CSSValue>> familyList;
+  RetainPtr<CFX_CSSValue> pStyle;
+  RetainPtr<CFX_CSSValue> pVariant;
+  RetainPtr<CFX_CSSValue> pWeight;
+  RetainPtr<CFX_CSSValue> pFontSize;
+  RetainPtr<CFX_CSSValue> pLineHeight;
+  std::vector<RetainPtr<CFX_CSSValue>> familyList;
   CFX_CSSPrimitiveType eType;
   while (parser.NextValue(eType, pszValue, iValueLen)) {
     switch (eType) {
diff --git a/core/fxcrt/css/cfx_cssdeclaration.h b/core/fxcrt/css/cfx_cssdeclaration.h
index dba1d44..7dd0bba 100644
--- a/core/fxcrt/css/cfx_cssdeclaration.h
+++ b/core/fxcrt/css/cfx_cssdeclaration.h
@@ -34,8 +34,8 @@
   CFX_CSSDeclaration();
   ~CFX_CSSDeclaration();
 
-  CFX_RetainPtr<CFX_CSSValue> GetProperty(CFX_CSSProperty eProperty,
-                                          bool* bImportant) const;
+  RetainPtr<CFX_CSSValue> GetProperty(CFX_CSSProperty eProperty,
+                                      bool* bImportant) const;
 
   const_prop_iterator begin() const { return properties_.begin(); }
   const_prop_iterator end() const { return properties_.end(); }
@@ -63,27 +63,26 @@
                          bool bImportant);
   bool ParseBorderProperty(const wchar_t* pszValue,
                            int32_t iValueLen,
-                           CFX_RetainPtr<CFX_CSSValue>& pWidth) const;
+                           RetainPtr<CFX_CSSValue>& pWidth) const;
   void ParseValueListProperty(const CFX_CSSPropertyTable* pTable,
                               const wchar_t* pszValue,
                               int32_t iValueLen,
                               bool bImportant);
-  void Add4ValuesProperty(const std::vector<CFX_RetainPtr<CFX_CSSValue>>& list,
+  void Add4ValuesProperty(const std::vector<RetainPtr<CFX_CSSValue>>& list,
                           bool bImportant,
                           CFX_CSSProperty eLeft,
                           CFX_CSSProperty eTop,
                           CFX_CSSProperty eRight,
                           CFX_CSSProperty eBottom);
-  CFX_RetainPtr<CFX_CSSValue> ParseNumber(const wchar_t* pszValue,
-                                          int32_t iValueLen);
-  CFX_RetainPtr<CFX_CSSValue> ParseEnum(const wchar_t* pszValue,
-                                        int32_t iValueLen);
-  CFX_RetainPtr<CFX_CSSValue> ParseColor(const wchar_t* pszValue,
-                                         int32_t iValueLen);
-  CFX_RetainPtr<CFX_CSSValue> ParseString(const wchar_t* pszValue,
-                                          int32_t iValueLen);
+  RetainPtr<CFX_CSSValue> ParseNumber(const wchar_t* pszValue,
+                                      int32_t iValueLen);
+  RetainPtr<CFX_CSSValue> ParseEnum(const wchar_t* pszValue, int32_t iValueLen);
+  RetainPtr<CFX_CSSValue> ParseColor(const wchar_t* pszValue,
+                                     int32_t iValueLen);
+  RetainPtr<CFX_CSSValue> ParseString(const wchar_t* pszValue,
+                                      int32_t iValueLen);
   void AddPropertyHolder(CFX_CSSProperty eProperty,
-                         CFX_RetainPtr<CFX_CSSValue> pValue,
+                         RetainPtr<CFX_CSSValue> pValue,
                          bool bImportant);
 
   std::vector<std::unique_ptr<CFX_CSSPropertyHolder>> properties_;
diff --git a/core/fxcrt/css/cfx_csspropertyholder.h b/core/fxcrt/css/cfx_csspropertyholder.h
index ab0e0ae..a271bda 100644
--- a/core/fxcrt/css/cfx_csspropertyholder.h
+++ b/core/fxcrt/css/cfx_csspropertyholder.h
@@ -7,9 +7,9 @@
 #ifndef CORE_FXCRT_CSS_CFX_CSSPROPERTYHOLDER_H_
 #define CORE_FXCRT_CSS_CFX_CSSPROPERTYHOLDER_H_
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/css/cfx_css.h"
 #include "core/fxcrt/css/cfx_cssvalue.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CFX_CSSPropertyHolder {
  public:
@@ -18,7 +18,7 @@
 
   CFX_CSSProperty eProperty;
   bool bImportant;
-  CFX_RetainPtr<CFX_CSSValue> pValue;
+  RetainPtr<CFX_CSSValue> pValue;
 };
 
 #endif  // CORE_FXCRT_CSS_CFX_CSSPROPERTYHOLDER_H_
diff --git a/core/fxcrt/css/cfx_cssstyleselector.cpp b/core/fxcrt/css/cfx_cssstyleselector.cpp
index 9ae2b87..cb9ab2f 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.cpp
+++ b/core/fxcrt/css/cfx_cssstyleselector.cpp
@@ -31,7 +31,7 @@
   m_fDefFontSize = fFontSize;
 }
 
-CFX_RetainPtr<CFX_CSSComputedStyle> CFX_CSSStyleSelector::CreateComputedStyle(
+RetainPtr<CFX_CSSComputedStyle> CFX_CSSStyleSelector::CreateComputedStyle(
     CFX_CSSComputedStyle* pParentStyle) {
   auto pStyle = pdfium::MakeRetain<CFX_CSSComputedStyle>();
   if (pParentStyle)
@@ -168,10 +168,9 @@
   }
 }
 
-void CFX_CSSStyleSelector::ApplyProperty(
-    CFX_CSSProperty eProperty,
-    const CFX_RetainPtr<CFX_CSSValue>& pValue,
-    CFX_CSSComputedStyle* pComputedStyle) {
+void CFX_CSSStyleSelector::ApplyProperty(CFX_CSSProperty eProperty,
+                                         const RetainPtr<CFX_CSSValue>& pValue,
+                                         CFX_CSSComputedStyle* pComputedStyle) {
   if (pValue->GetType() != CFX_CSSPrimitiveType::List) {
     CFX_CSSPrimitiveType eType = pValue->GetType();
     switch (eProperty) {
@@ -192,7 +191,7 @@
       } break;
       case CFX_CSSProperty::LineHeight:
         if (eType == CFX_CSSPrimitiveType::Number) {
-          CFX_RetainPtr<CFX_CSSNumberValue> v = pValue.As<CFX_CSSNumberValue>();
+          RetainPtr<CFX_CSSNumberValue> v = pValue.As<CFX_CSSNumberValue>();
           if (v->Kind() == CFX_CSSNumberType::Number) {
             pComputedStyle->m_InheritedData.m_fLineHeight =
                 v->Value() * pComputedStyle->m_InheritedData.m_fFontSize;
@@ -392,7 +391,7 @@
         break;
     }
   } else if (pValue->GetType() == CFX_CSSPrimitiveType::List) {
-    CFX_RetainPtr<CFX_CSSValueList> pList = pValue.As<CFX_CSSValueList>();
+    RetainPtr<CFX_CSSValueList> pList = pValue.As<CFX_CSSValueList>();
     int32_t iCount = pList->CountValues();
     if (iCount > 0) {
       switch (eProperty) {
@@ -473,10 +472,10 @@
 bool CFX_CSSStyleSelector::SetLengthWithPercent(
     CFX_CSSLength& width,
     CFX_CSSPrimitiveType eType,
-    const CFX_RetainPtr<CFX_CSSValue>& pValue,
+    const RetainPtr<CFX_CSSValue>& pValue,
     float fFontSize) {
   if (eType == CFX_CSSPrimitiveType::Number) {
-    CFX_RetainPtr<CFX_CSSNumberValue> v = pValue.As<CFX_CSSNumberValue>();
+    RetainPtr<CFX_CSSNumberValue> v = pValue.As<CFX_CSSNumberValue>();
     if (v->Kind() == CFX_CSSNumberType::Percent) {
       width.Set(CFX_CSSLengthUnit::Percent,
                 pValue.As<CFX_CSSNumberValue>()->Value() / 100.0f);
@@ -560,10 +559,10 @@
 }
 
 uint32_t CFX_CSSStyleSelector::ToTextDecoration(
-    const CFX_RetainPtr<CFX_CSSValueList>& pValue) {
+    const RetainPtr<CFX_CSSValueList>& pValue) {
   uint32_t dwDecoration = 0;
   for (int32_t i = pValue->CountValues() - 1; i >= 0; --i) {
-    const CFX_RetainPtr<CFX_CSSValue> pVal = pValue->GetValue(i);
+    const RetainPtr<CFX_CSSValue> pVal = pValue->GetValue(i);
     if (pVal->GetType() != CFX_CSSPrimitiveType::Enum)
       continue;
 
diff --git a/core/fxcrt/css/cfx_cssstyleselector.h b/core/fxcrt/css/cfx_cssstyleselector.h
index b59e304..13a0f74 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.h
+++ b/core/fxcrt/css/cfx_cssstyleselector.h
@@ -32,7 +32,7 @@
   void SetUAStyleSheet(std::unique_ptr<CFX_CSSStyleSheet> pSheet);
   void UpdateStyleIndex();
 
-  CFX_RetainPtr<CFX_CSSComputedStyle> CreateComputedStyle(
+  RetainPtr<CFX_CSSComputedStyle> CreateComputedStyle(
       CFX_CSSComputedStyle* pParentStyle);
 
   // Note, the dest style has to be an out param because the CXFA_TextParser
@@ -55,7 +55,7 @@
       const CFX_CSSDeclaration* extraDecl,
       CFX_CSSComputedStyle* pDestStyle);
   void ApplyProperty(CFX_CSSProperty eProperty,
-                     const CFX_RetainPtr<CFX_CSSValue>& pValue,
+                     const RetainPtr<CFX_CSSValue>& pValue,
                      CFX_CSSComputedStyle* pComputedStyle);
   void ExtractValues(const CFX_CSSDeclaration* decl,
                      std::vector<const CFX_CSSPropertyHolder*>* importants,
@@ -64,7 +64,7 @@
 
   bool SetLengthWithPercent(CFX_CSSLength& width,
                             CFX_CSSPrimitiveType eType,
-                            const CFX_RetainPtr<CFX_CSSValue>& pValue,
+                            const RetainPtr<CFX_CSSValue>& pValue,
                             float fFontSize);
   float ToFontSize(CFX_CSSPropertyValue eValue, float fCurFontSize);
   CFX_CSSDisplay ToDisplay(CFX_CSSPropertyValue eValue);
@@ -72,7 +72,7 @@
   uint16_t ToFontWeight(CFX_CSSPropertyValue eValue);
   CFX_CSSFontStyle ToFontStyle(CFX_CSSPropertyValue eValue);
   CFX_CSSVerticalAlign ToVerticalAlign(CFX_CSSPropertyValue eValue);
-  uint32_t ToTextDecoration(const CFX_RetainPtr<CFX_CSSValueList>& pList);
+  uint32_t ToTextDecoration(const RetainPtr<CFX_CSSValueList>& pList);
   CFX_CSSFontVariant ToFontVariant(CFX_CSSPropertyValue eValue);
 
   float m_fDefFontSize;
diff --git a/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp b/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
index abcd2f6..3029824 100644
--- a/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
+++ b/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
@@ -51,7 +51,7 @@
     ASSERT(decl_);
 
     bool important;
-    CFX_RetainPtr<CFX_CSSValue> v = decl_->GetProperty(prop, &important);
+    RetainPtr<CFX_CSSValue> v = decl_->GetProperty(prop, &important);
     EXPECT_EQ(v->GetType(), CFX_CSSPrimitiveType::Number);
     EXPECT_EQ(v.As<CFX_CSSNumberValue>()->Kind(), type);
     EXPECT_EQ(v.As<CFX_CSSNumberValue>()->Value(), val);
@@ -61,7 +61,7 @@
     ASSERT(decl_);
 
     bool important;
-    CFX_RetainPtr<CFX_CSSValue> v = decl_->GetProperty(prop, &important);
+    RetainPtr<CFX_CSSValue> v = decl_->GetProperty(prop, &important);
     EXPECT_EQ(v->GetType(), CFX_CSSPrimitiveType::Enum);
     EXPECT_EQ(v.As<CFX_CSSEnumValue>()->Value(), val);
   }
@@ -71,12 +71,12 @@
     ASSERT(decl_);
 
     bool important;
-    CFX_RetainPtr<CFX_CSSValueList> list =
+    RetainPtr<CFX_CSSValueList> list =
         decl_->GetProperty(prop, &important).As<CFX_CSSValueList>();
     EXPECT_EQ(list->CountValues(), pdfium::CollectionSize<int32_t>(values));
 
     for (size_t i = 0; i < values.size(); i++) {
-      CFX_RetainPtr<CFX_CSSValue> val = list->GetValue(i);
+      RetainPtr<CFX_CSSValue> val = list->GetValue(i);
       EXPECT_EQ(val->GetType(), CFX_CSSPrimitiveType::Enum);
       EXPECT_EQ(val.As<CFX_CSSEnumValue>()->Value(), values[i]);
     }
diff --git a/core/fxcrt/css/cfx_cssvalue.h b/core/fxcrt/css/cfx_cssvalue.h
index 4f11e4e..f143e96 100644
--- a/core/fxcrt/css/cfx_cssvalue.h
+++ b/core/fxcrt/css/cfx_cssvalue.h
@@ -9,7 +9,7 @@
 
 #include "core/fxcrt/css/cfx_css.h"
 
-class CFX_CSSValue : public CFX_Retainable {
+class CFX_CSSValue : public Retainable {
  public:
   CFX_CSSPrimitiveType GetType() const { return m_value; }
 
diff --git a/core/fxcrt/css/cfx_cssvaluelist.cpp b/core/fxcrt/css/cfx_cssvaluelist.cpp
index 18b5d82..b96f165 100644
--- a/core/fxcrt/css/cfx_cssvaluelist.cpp
+++ b/core/fxcrt/css/cfx_cssvaluelist.cpp
@@ -10,8 +10,7 @@
 
 #include "core/fxcrt/css/cfx_css.h"
 
-CFX_CSSValueList::CFX_CSSValueList(
-    std::vector<CFX_RetainPtr<CFX_CSSValue>>& list)
+CFX_CSSValueList::CFX_CSSValueList(std::vector<RetainPtr<CFX_CSSValue>>& list)
     : CFX_CSSValue(CFX_CSSPrimitiveType::List), m_ppList(std::move(list)) {}
 
 CFX_CSSValueList::~CFX_CSSValueList() {}
@@ -20,6 +19,6 @@
   return m_ppList.size();
 }
 
-CFX_RetainPtr<CFX_CSSValue> CFX_CSSValueList::GetValue(int32_t index) const {
+RetainPtr<CFX_CSSValue> CFX_CSSValueList::GetValue(int32_t index) const {
   return m_ppList[index];
 }
diff --git a/core/fxcrt/css/cfx_cssvaluelist.h b/core/fxcrt/css/cfx_cssvaluelist.h
index 475abf4..d2b0c6e 100644
--- a/core/fxcrt/css/cfx_cssvaluelist.h
+++ b/core/fxcrt/css/cfx_cssvaluelist.h
@@ -13,14 +13,14 @@
 
 class CFX_CSSValueList : public CFX_CSSValue {
  public:
-  explicit CFX_CSSValueList(std::vector<CFX_RetainPtr<CFX_CSSValue>>& list);
+  explicit CFX_CSSValueList(std::vector<RetainPtr<CFX_CSSValue>>& list);
   ~CFX_CSSValueList() override;
 
   int32_t CountValues() const;
-  CFX_RetainPtr<CFX_CSSValue> GetValue(int32_t index) const;
+  RetainPtr<CFX_CSSValue> GetValue(int32_t index) const;
 
  protected:
-  std::vector<CFX_RetainPtr<CFX_CSSValue>> m_ppList;
+  std::vector<RetainPtr<CFX_CSSValue>> m_ppList;
 };
 
 #endif  // CORE_FXCRT_CSS_CFX_CSSVALUELIST_H_
diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp
index a04e781..e15fdb0 100644
--- a/core/fxcrt/fx_stream.cpp
+++ b/core/fxcrt/fx_stream.cpp
@@ -20,7 +20,7 @@
 class CFX_CRTFileStream final : public IFX_SeekableStream {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   // IFX_SeekableStream:
   FX_FILESIZE GetSize() override { return m_pFile->GetSize(); }
@@ -50,7 +50,7 @@
 }  // namespace
 
 // static
-CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename(
+RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename(
     const char* filename,
     uint32_t dwModes) {
   std::unique_ptr<IFX_FileAccess> pFA = IFX_FileAccess::Create();
@@ -60,7 +60,7 @@
 }
 
 // static
-CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename(
+RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename(
     const wchar_t* filename,
     uint32_t dwModes) {
   std::unique_ptr<IFX_FileAccess> pFA = IFX_FileAccess::Create();
@@ -70,8 +70,8 @@
 }
 
 // static
-CFX_RetainPtr<IFX_SeekableReadStream>
-IFX_SeekableReadStream::CreateFromFilename(const char* filename) {
+RetainPtr<IFX_SeekableReadStream> IFX_SeekableReadStream::CreateFromFilename(
+    const char* filename) {
   return IFX_SeekableStream::CreateFromFilename(filename, FX_FILEMODE_ReadOnly);
 }
 
diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h
index 08331e9..d794416 100644
--- a/core/fxcrt/fx_stream.h
+++ b/core/fxcrt/fx_stream.h
@@ -7,9 +7,9 @@
 #ifndef CORE_FXCRT_FX_STREAM_H_
 #define CORE_FXCRT_FX_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"
 
 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
 #include <direct.h>
@@ -36,7 +36,7 @@
 #define FX_FILEMODE_ReadOnly 1
 #define FX_FILEMODE_Truncate 2
 
-class IFX_WriteStream : virtual public CFX_Retainable {
+class IFX_WriteStream : virtual public Retainable {
  public:
   virtual bool WriteBlock(const void* pData, size_t size) = 0;
   virtual bool WriteString(const ByteStringView& str) = 0;
@@ -49,7 +49,7 @@
   virtual FX_FILESIZE CurrentOffset() const = 0;
 };
 
-class IFX_ReadStream : virtual public CFX_Retainable {
+class IFX_ReadStream : virtual public Retainable {
  public:
   virtual bool IsEOF() = 0;
   virtual FX_FILESIZE GetPosition() = 0;
@@ -70,7 +70,7 @@
 
 class IFX_SeekableReadStream : public IFX_ReadStream {
  public:
-  static CFX_RetainPtr<IFX_SeekableReadStream> CreateFromFilename(
+  static RetainPtr<IFX_SeekableReadStream> CreateFromFilename(
       const char* filename);
 
   // IFX_ReadStream:
@@ -85,11 +85,10 @@
 class IFX_SeekableStream : public IFX_SeekableReadStream,
                            public IFX_SeekableWriteStream {
  public:
-  static CFX_RetainPtr<IFX_SeekableStream> CreateFromFilename(
-      const char* filename,
-      uint32_t dwModes);
+  static RetainPtr<IFX_SeekableStream> CreateFromFilename(const char* filename,
+                                                          uint32_t dwModes);
 
-  static CFX_RetainPtr<IFX_SeekableStream> CreateFromFilename(
+  static RetainPtr<IFX_SeekableStream> CreateFromFilename(
       const wchar_t* filename,
       uint32_t dwModes);
 
diff --git a/core/fxcrt/fx_unicode.h b/core/fxcrt/fx_unicode.h
index a4a237a..18657bd 100644
--- a/core/fxcrt/fx_unicode.h
+++ b/core/fxcrt/fx_unicode.h
@@ -7,7 +7,7 @@
 #ifndef CORE_FXCRT_FX_UNICODE_H_
 #define CORE_FXCRT_FX_UNICODE_H_
 
-#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 
 uint32_t FX_GetUnicodeProperties(wchar_t wch);
 wchar_t FX_GetMirrorChar(wchar_t wch);
diff --git a/core/fxcrt/cfx_retain_ptr.h b/core/fxcrt/retain_ptr.h
similarity index 61%
rename from core/fxcrt/cfx_retain_ptr.h
rename to core/fxcrt/retain_ptr.h
index d3896ba..481bfbb 100644
--- a/core/fxcrt/cfx_retain_ptr.h
+++ b/core/fxcrt/retain_ptr.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CORE_FXCRT_CFX_RETAIN_PTR_H_
-#define CORE_FXCRT_CFX_RETAIN_PTR_H_
+#ifndef CORE_FXCRT_RETAIN_PTR_H_
+#define CORE_FXCRT_RETAIN_PTR_H_
 
 #include <functional>
 #include <memory>
@@ -11,6 +11,8 @@
 
 #include "core/fxcrt/fx_system.h"
 
+namespace fxcrt {
+
 // Used with std::unique_ptr to Release() objects that can't be deleted.
 template <class T>
 struct ReleaseDeleter {
@@ -19,27 +21,27 @@
 
 // Analogous to base's scoped_refptr.
 template <class T>
-class CFX_RetainPtr {
+class RetainPtr {
  public:
-  explicit CFX_RetainPtr(T* pObj) : m_pObj(pObj) {
+  explicit RetainPtr(T* pObj) : m_pObj(pObj) {
     if (m_pObj)
       m_pObj->Retain();
   }
 
-  CFX_RetainPtr() {}
-  CFX_RetainPtr(const CFX_RetainPtr& that) : CFX_RetainPtr(that.Get()) {}
-  CFX_RetainPtr(CFX_RetainPtr&& that) noexcept { Swap(that); }
+  RetainPtr() {}
+  RetainPtr(const RetainPtr& that) : RetainPtr(that.Get()) {}
+  RetainPtr(RetainPtr&& that) noexcept { Swap(that); }
 
   // Deliberately implicit to allow returning nullptrs.
   // NOLINTNEXTLINE(runtime/explicit)
-  CFX_RetainPtr(std::nullptr_t ptr) {}
+  RetainPtr(std::nullptr_t ptr) {}
 
   template <class U>
-  CFX_RetainPtr(const CFX_RetainPtr<U>& that) : CFX_RetainPtr(that.Get()) {}
+  RetainPtr(const RetainPtr<U>& that) : RetainPtr(that.Get()) {}
 
   template <class U>
-  CFX_RetainPtr<U> As() const {
-    return CFX_RetainPtr<U>(static_cast<U*>(Get()));
+  RetainPtr<U> As() const {
+    return RetainPtr<U>(static_cast<U*>(Get()));
   }
 
   void Reset(T* obj = nullptr) {
@@ -49,29 +51,27 @@
   }
 
   T* Get() const { return m_pObj.get(); }
-  void Swap(CFX_RetainPtr& that) { m_pObj.swap(that.m_pObj); }
+  void Swap(RetainPtr& that) { m_pObj.swap(that.m_pObj); }
 
   // Useful for passing notion of object ownership across a C API.
   T* Leak() { return m_pObj.release(); }
   void Unleak(T* ptr) { m_pObj.reset(ptr); }
 
-  CFX_RetainPtr& operator=(const CFX_RetainPtr& that) {
+  RetainPtr& operator=(const RetainPtr& that) {
     if (*this != that)
       Reset(that.Get());
     return *this;
   }
 
-  CFX_RetainPtr& operator=(CFX_RetainPtr&& that) {
+  RetainPtr& operator=(RetainPtr&& that) {
     m_pObj.reset(that.Leak());
     return *this;
   }
 
-  bool operator==(const CFX_RetainPtr& that) const {
-    return Get() == that.Get();
-  }
-  bool operator!=(const CFX_RetainPtr& that) const { return !(*this == that); }
+  bool operator==(const RetainPtr& that) const { return Get() == that.Get(); }
+  bool operator!=(const RetainPtr& that) const { return !(*this == that); }
 
-  bool operator<(const CFX_RetainPtr& that) const {
+  bool operator<(const RetainPtr& that) const {
     return std::less<T*>()(Get(), that.Get());
   }
 
@@ -84,19 +84,19 @@
 };
 
 // Trivial implementation - internal ref count with virtual destructor.
-class CFX_Retainable {
+class Retainable {
  public:
   bool HasOneRef() const { return m_nRefCount == 1; }
 
  protected:
-  virtual ~CFX_Retainable() {}
+  virtual ~Retainable() {}
 
  private:
   template <typename U>
   friend struct ReleaseDeleter;
 
   template <typename U>
-  friend class CFX_RetainPtr;
+  friend class RetainPtr;
 
   void Retain() { ++m_nRefCount; }
   void Release() {
@@ -108,17 +108,23 @@
   intptr_t m_nRefCount = 0;
 };
 
+}  // namespace fxcrt
+
+using fxcrt::ReleaseDeleter;
+using fxcrt::RetainPtr;
+using fxcrt::Retainable;
+
 namespace pdfium {
 
-// Helper to make a CFX_RetainPtr along the lines of std::make_unique<>(),
+// Helper to make a RetainPtr along the lines of std::make_unique<>(),
 // or pdfium::MakeUnique<>(). Arguments are forwarded to T's constructor.
-// Classes managed by CFX_RetainPtr should have protected (or private)
+// Classes managed by RetainPtr should have protected (or private)
 // constructors, and should friend this function.
 template <typename T, typename... Args>
-CFX_RetainPtr<T> MakeRetain(Args&&... args) {
-  return CFX_RetainPtr<T>(new T(std::forward<Args>(args)...));
+RetainPtr<T> MakeRetain(Args&&... args) {
+  return RetainPtr<T>(new T(std::forward<Args>(args)...));
 }
 
 }  // namespace pdfium
 
-#endif  // CORE_FXCRT_CFX_RETAIN_PTR_H_
+#endif  // CORE_FXCRT_RETAIN_PTR_H_
diff --git a/core/fxcrt/cfx_retain_ptr_unittest.cpp b/core/fxcrt/retain_ptr_unittest.cpp
similarity index 69%
rename from core/fxcrt/cfx_retain_ptr_unittest.cpp
rename to core/fxcrt/retain_ptr_unittest.cpp
index eae542f..3e14478 100644
--- a/core/fxcrt/cfx_retain_ptr_unittest.cpp
+++ b/core/fxcrt/retain_ptr_unittest.cpp
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 
 #include <utility>
 #include <vector>
@@ -26,15 +26,15 @@
 
 }  // namespace
 
-TEST(fxcrt, RetainPtrNull) {
-  CFX_RetainPtr<PseudoRetainable> ptr;
+TEST(RetainPtr, Null) {
+  RetainPtr<PseudoRetainable> ptr;
   EXPECT_EQ(nullptr, ptr.Get());
 }
 
-TEST(fxcrt, RetainPtrNormal) {
+TEST(RetainPtr, Normal) {
   PseudoRetainable obj;
   {
-    CFX_RetainPtr<PseudoRetainable> ptr(&obj);
+    RetainPtr<PseudoRetainable> ptr(&obj);
     EXPECT_EQ(&obj, ptr.Get());
     EXPECT_EQ(1, obj.retain_count());
     EXPECT_EQ(0, obj.release_count());
@@ -43,12 +43,12 @@
   EXPECT_EQ(1, obj.release_count());
 }
 
-TEST(fxcrt, RetainPtrCopyCtor) {
+TEST(RetainPtr, CopyCtor) {
   PseudoRetainable obj;
   {
-    CFX_RetainPtr<PseudoRetainable> ptr1(&obj);
+    RetainPtr<PseudoRetainable> ptr1(&obj);
     {
-      CFX_RetainPtr<PseudoRetainable> ptr2(ptr1);
+      RetainPtr<PseudoRetainable> ptr2(ptr1);
       EXPECT_EQ(2, obj.retain_count());
       EXPECT_EQ(0, obj.release_count());
     }
@@ -59,12 +59,12 @@
   EXPECT_EQ(2, obj.release_count());
 }
 
-TEST(fxcrt, RetainPtrMoveCtor) {
+TEST(RetainPtr, MoveCtor) {
   PseudoRetainable obj;
   {
-    CFX_RetainPtr<PseudoRetainable> ptr1(&obj);
+    RetainPtr<PseudoRetainable> ptr1(&obj);
     {
-      CFX_RetainPtr<PseudoRetainable> ptr2(std::move(ptr1));
+      RetainPtr<PseudoRetainable> ptr2(std::move(ptr1));
       EXPECT_EQ(nullptr, ptr1.Get());
       EXPECT_EQ(&obj, ptr2.Get());
       EXPECT_EQ(1, obj.retain_count());
@@ -77,10 +77,10 @@
   EXPECT_EQ(1, obj.release_count());
 }
 
-TEST(fxcrt, RetainPtrResetNull) {
+TEST(RetainPtr, ResetNull) {
   PseudoRetainable obj;
   {
-    CFX_RetainPtr<PseudoRetainable> ptr(&obj);
+    RetainPtr<PseudoRetainable> ptr(&obj);
     ptr.Reset();
     EXPECT_EQ(1, obj.retain_count());
     EXPECT_EQ(1, obj.release_count());
@@ -89,11 +89,11 @@
   EXPECT_EQ(1, obj.release_count());
 }
 
-TEST(fxcrt, RetainPtrReset) {
+TEST(RetainPtr, Reset) {
   PseudoRetainable obj1;
   PseudoRetainable obj2;
   {
-    CFX_RetainPtr<PseudoRetainable> ptr(&obj1);
+    RetainPtr<PseudoRetainable> ptr(&obj1);
     ptr.Reset(&obj2);
     EXPECT_EQ(1, obj1.retain_count());
     EXPECT_EQ(1, obj1.release_count());
@@ -106,13 +106,13 @@
   EXPECT_EQ(1, obj2.release_count());
 }
 
-TEST(fxcrt, RetainPtrSwap) {
+TEST(RetainPtr, Swap) {
   PseudoRetainable obj1;
   PseudoRetainable obj2;
   {
-    CFX_RetainPtr<PseudoRetainable> ptr1(&obj1);
+    RetainPtr<PseudoRetainable> ptr1(&obj1);
     {
-      CFX_RetainPtr<PseudoRetainable> ptr2(&obj2);
+      RetainPtr<PseudoRetainable> ptr2(&obj2);
       ptr1.Swap(ptr2);
       EXPECT_EQ(1, obj1.retain_count());
       EXPECT_EQ(0, obj1.release_count());
@@ -130,11 +130,11 @@
   EXPECT_EQ(1, obj2.release_count());
 }
 
-TEST(fxcrt, RetainPtrLeak) {
+TEST(RetainPtr, Leak) {
   PseudoRetainable obj;
   PseudoRetainable* leak;
   {
-    CFX_RetainPtr<PseudoRetainable> ptr(&obj);
+    RetainPtr<PseudoRetainable> ptr(&obj);
     leak = ptr.Leak();
     EXPECT_EQ(1, obj.retain_count());
     EXPECT_EQ(0, obj.release_count());
@@ -142,7 +142,7 @@
   EXPECT_EQ(1, obj.retain_count());
   EXPECT_EQ(0, obj.release_count());
   {
-    CFX_RetainPtr<PseudoRetainable> ptr;
+    RetainPtr<PseudoRetainable> ptr;
     ptr.Unleak(leak);
     EXPECT_EQ(1, obj.retain_count());
     EXPECT_EQ(0, obj.release_count());
@@ -151,12 +151,12 @@
   EXPECT_EQ(1, obj.release_count());
 }
 
-TEST(fxcrt, RetainPtrSwapNull) {
+TEST(RetainPtr, SwapNull) {
   PseudoRetainable obj1;
   {
-    CFX_RetainPtr<PseudoRetainable> ptr1(&obj1);
+    RetainPtr<PseudoRetainable> ptr1(&obj1);
     {
-      CFX_RetainPtr<PseudoRetainable> ptr2;
+      RetainPtr<PseudoRetainable> ptr2;
       ptr1.Swap(ptr2);
       EXPECT_FALSE(ptr1);
       EXPECT_TRUE(ptr2);
@@ -170,12 +170,12 @@
   EXPECT_EQ(1, obj1.release_count());
 }
 
-TEST(fxcrt, RetainPtrAssign) {
+TEST(RetainPtr, Assign) {
   PseudoRetainable obj;
   {
-    CFX_RetainPtr<PseudoRetainable> ptr(&obj);
+    RetainPtr<PseudoRetainable> ptr(&obj);
     {
-      CFX_RetainPtr<PseudoRetainable> ptr2;
+      RetainPtr<PseudoRetainable> ptr2;
       ptr2 = ptr;
       EXPECT_EQ(2, obj.retain_count());
       EXPECT_EQ(0, obj.release_count());
@@ -187,12 +187,12 @@
   EXPECT_EQ(2, obj.release_count());
 }
 
-TEST(fxcrt, RetainPtrMoveAssign) {
+TEST(RetainPtr, MoveAssign) {
   PseudoRetainable obj;
   {
-    CFX_RetainPtr<PseudoRetainable> ptr1(&obj);
+    RetainPtr<PseudoRetainable> ptr1(&obj);
     {
-      CFX_RetainPtr<PseudoRetainable> ptr2;
+      RetainPtr<PseudoRetainable> ptr2;
       EXPECT_EQ(&obj, ptr1.Get());
       EXPECT_EQ(nullptr, ptr2.Get());
       ptr2 = std::move(ptr1);
@@ -208,20 +208,20 @@
   EXPECT_EQ(1, obj.release_count());
 }
 
-TEST(fxcrt, RetainPtrEquals) {
+TEST(RetainPtr, Equals) {
   PseudoRetainable obj1;
   PseudoRetainable obj2;
-  CFX_RetainPtr<PseudoRetainable> null_ptr1;
-  CFX_RetainPtr<PseudoRetainable> obj1_ptr1(&obj1);
-  CFX_RetainPtr<PseudoRetainable> obj2_ptr1(&obj2);
+  RetainPtr<PseudoRetainable> null_ptr1;
+  RetainPtr<PseudoRetainable> obj1_ptr1(&obj1);
+  RetainPtr<PseudoRetainable> obj2_ptr1(&obj2);
   {
-    CFX_RetainPtr<PseudoRetainable> null_ptr2;
+    RetainPtr<PseudoRetainable> null_ptr2;
     EXPECT_TRUE(null_ptr1 == null_ptr2);
 
-    CFX_RetainPtr<PseudoRetainable> obj1_ptr2(&obj1);
+    RetainPtr<PseudoRetainable> obj1_ptr2(&obj1);
     EXPECT_TRUE(obj1_ptr1 == obj1_ptr2);
 
-    CFX_RetainPtr<PseudoRetainable> obj2_ptr2(&obj2);
+    RetainPtr<PseudoRetainable> obj2_ptr2(&obj2);
     EXPECT_TRUE(obj2_ptr1 == obj2_ptr2);
   }
   EXPECT_FALSE(null_ptr1 == obj1_ptr1);
@@ -229,16 +229,16 @@
   EXPECT_FALSE(obj1_ptr1 == obj2_ptr1);
 }
 
-TEST(fxcrt, RetainPtrNotEquals) {
+TEST(RetainPtr, NotEquals) {
   PseudoRetainable obj1;
   PseudoRetainable obj2;
-  CFX_RetainPtr<PseudoRetainable> null_ptr1;
-  CFX_RetainPtr<PseudoRetainable> obj1_ptr1(&obj1);
-  CFX_RetainPtr<PseudoRetainable> obj2_ptr1(&obj2);
+  RetainPtr<PseudoRetainable> null_ptr1;
+  RetainPtr<PseudoRetainable> obj1_ptr1(&obj1);
+  RetainPtr<PseudoRetainable> obj2_ptr1(&obj2);
   {
-    CFX_RetainPtr<PseudoRetainable> null_ptr2;
-    CFX_RetainPtr<PseudoRetainable> obj1_ptr2(&obj1);
-    CFX_RetainPtr<PseudoRetainable> obj2_ptr2(&obj2);
+    RetainPtr<PseudoRetainable> null_ptr2;
+    RetainPtr<PseudoRetainable> obj1_ptr2(&obj1);
+    RetainPtr<PseudoRetainable> obj2_ptr2(&obj2);
     EXPECT_FALSE(null_ptr1 != null_ptr2);
     EXPECT_FALSE(obj1_ptr1 != obj1_ptr2);
     EXPECT_FALSE(obj2_ptr1 != obj2_ptr2);
@@ -248,46 +248,46 @@
   EXPECT_TRUE(obj1_ptr1 != obj2_ptr1);
 }
 
-TEST(fxcrt, RetainPtrLessThan) {
+TEST(RetainPtr, LessThan) {
   PseudoRetainable objs[2];
-  CFX_RetainPtr<PseudoRetainable> obj1_ptr(&objs[0]);
-  CFX_RetainPtr<PseudoRetainable> obj2_ptr(&objs[1]);
+  RetainPtr<PseudoRetainable> obj1_ptr(&objs[0]);
+  RetainPtr<PseudoRetainable> obj2_ptr(&objs[1]);
   EXPECT_TRUE(obj1_ptr < obj2_ptr);
   EXPECT_FALSE(obj2_ptr < obj1_ptr);
 }
 
-TEST(fxcrt, RetainPtrBool) {
+TEST(RetainPtr, Bool) {
   PseudoRetainable obj1;
-  CFX_RetainPtr<PseudoRetainable> null_ptr;
-  CFX_RetainPtr<PseudoRetainable> obj1_ptr(&obj1);
+  RetainPtr<PseudoRetainable> null_ptr;
+  RetainPtr<PseudoRetainable> obj1_ptr(&obj1);
   bool null_bool = !!null_ptr;
   bool obj1_bool = !!obj1_ptr;
   EXPECT_FALSE(null_bool);
   EXPECT_TRUE(obj1_bool);
 }
 
-TEST(fxcrt, RetainPtrMakeRetained) {
-  auto ptr = pdfium::MakeRetain<CFX_Retainable>();
+TEST(RetainPtr, MakeRetained) {
+  auto ptr = pdfium::MakeRetain<Retainable>();
   EXPECT_TRUE(ptr->HasOneRef());
   {
-    CFX_RetainPtr<CFX_Retainable> other = ptr;
+    RetainPtr<Retainable> other = ptr;
     EXPECT_FALSE(ptr->HasOneRef());
   }
   EXPECT_TRUE(ptr->HasOneRef());
 }
 
-TEST(fxcrt, RetainPtrVectorMove) {
+TEST(RetainPtr, VectorMove) {
   // Proves move ctor is selected by std::vector over copy/delete, this
   // may require the ctor to be marked "noexcept".
   PseudoRetainable obj;
   {
-    CFX_RetainPtr<PseudoRetainable> ptr(&obj);
-    std::vector<CFX_RetainPtr<PseudoRetainable>> vec1;
+    RetainPtr<PseudoRetainable> ptr(&obj);
+    std::vector<RetainPtr<PseudoRetainable>> vec1;
     vec1.push_back(std::move(ptr));
     EXPECT_EQ(1, obj.retain_count());
     EXPECT_EQ(0, obj.release_count());
 
-    std::vector<CFX_RetainPtr<PseudoRetainable>> vec2 = std::move(vec1);
+    std::vector<RetainPtr<PseudoRetainable>> vec2 = std::move(vec1);
     EXPECT_EQ(1, obj.retain_count());
     EXPECT_EQ(0, obj.release_count());
 
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index fa5c801..e90d8ce 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -458,7 +458,7 @@
     return;
   }
 
-  CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
+  RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
   if (m_pData) {
     FX_STRSIZE nCopyLength = std::min(m_pData->m_nDataLength, nNewLength);
     pNewData->CopyContents(m_pData->m_String, nCopyLength);
@@ -525,7 +525,7 @@
   if (nMinBufLength == 0)
     return nullptr;
 
-  CFX_RetainPtr<StringData> pNewData(StringData::Create(nMinBufLength));
+  RetainPtr<StringData> pNewData(StringData::Create(nMinBufLength));
   pNewData->CopyContents(*m_pData);
   pNewData->m_nDataLength = m_pData->m_nDataLength;
   m_pData.Swap(pNewData);
@@ -568,7 +568,7 @@
     return;
   }
 
-  CFX_RetainPtr<StringData> pNewData(
+  RetainPtr<StringData> pNewData(
       StringData::Create(m_pData->m_nDataLength + nSrcLen));
   pNewData->CopyContents(*m_pData);
   pNewData->CopyContentsAt(m_pData->m_nDataLength, pSrcData, nSrcLen);
@@ -635,7 +635,7 @@
   if (nCopyLen == 0)
     return;
 
-  CFX_RetainPtr<StringData> pNewData(
+  RetainPtr<StringData> pNewData(
       StringData::Create(m_pData->m_String + nCopyIndex, nCopyLen));
   dest.m_pData.Swap(pNewData);
 }
@@ -816,7 +816,7 @@
     return count;
   }
 
-  CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
+  RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
   pStart = m_pData->m_String;
   wchar_t* pDest = pNewData->m_String;
   for (FX_STRSIZE i = 0; i < count; i++) {
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
index 8841c84..4dc0abb 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -11,10 +11,10 @@
 #include <iterator>
 #include <utility>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_string_data_template.h"
 #include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/string_view_template.h"
 #include "third_party/base/optional.h"
 
@@ -192,7 +192,7 @@
   // Returns true unless we ran out of space.
   bool TryVSWPrintf(FX_STRSIZE size, const wchar_t* format, va_list argList);
 
-  CFX_RetainPtr<StringData> m_pData;
+  RetainPtr<StringData> m_pData;
 
   friend WideString_ConcatInPlace_Test;
   friend fxcrt_WideStringPool_Test;
diff --git a/core/fxcrt/xml/cfx_saxreader.cpp b/core/fxcrt/xml/cfx_saxreader.cpp
index e2c09d1..762144f 100644
--- a/core/fxcrt/xml/cfx_saxreader.cpp
+++ b/core/fxcrt/xml/cfx_saxreader.cpp
@@ -54,7 +54,7 @@
 
 CFX_SAXFile::~CFX_SAXFile() {}
 
-bool CFX_SAXFile::StartFile(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+bool CFX_SAXFile::StartFile(const RetainPtr<IFX_SeekableReadStream>& pFile,
                             uint32_t dwStart,
                             uint32_t dwLen) {
   ASSERT(!m_pFile && pFile);
@@ -186,7 +186,7 @@
 }
 
 int32_t CFX_SAXReader::StartParse(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+    const RetainPtr<IFX_SeekableReadStream>& pFile,
     uint32_t dwStart,
     uint32_t dwLen,
     uint32_t dwParseMode) {
diff --git a/core/fxcrt/xml/cfx_saxreader.h b/core/fxcrt/xml/cfx_saxreader.h
index 51d9e43..9ff755d 100644
--- a/core/fxcrt/xml/cfx_saxreader.h
+++ b/core/fxcrt/xml/cfx_saxreader.h
@@ -11,8 +11,8 @@
 #include <stack>
 #include <vector>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CFX_SAXCommentContext;
 class CFX_SAXContext;
@@ -45,13 +45,13 @@
   CFX_SAXFile();
   ~CFX_SAXFile();
 
-  bool StartFile(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+  bool StartFile(const RetainPtr<IFX_SeekableReadStream>& pFile,
                  uint32_t dwStart,
                  uint32_t dwLen);
   bool ReadNextBlock();
   void Reset();
 
-  CFX_RetainPtr<IFX_SeekableReadStream> m_pFile;
+  RetainPtr<IFX_SeekableReadStream> m_pFile;
   uint32_t m_dwStart;
   uint32_t m_dwEnd;
   uint32_t m_dwCur;
@@ -99,7 +99,7 @@
   CFX_SAXReader();
   ~CFX_SAXReader();
 
-  int32_t StartParse(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+  int32_t StartParse(const RetainPtr<IFX_SeekableReadStream>& pFile,
                      uint32_t dwStart = 0,
                      uint32_t dwLen = -1,
                      uint32_t dwParseMode = 0);
diff --git a/core/fxcrt/xml/cfx_xmldoc.cpp b/core/fxcrt/xml/cfx_xmldoc.cpp
index e9a09b7..30e4a47 100644
--- a/core/fxcrt/xml/cfx_xmldoc.cpp
+++ b/core/fxcrt/xml/cfx_xmldoc.cpp
@@ -48,7 +48,7 @@
 }
 
 void CFX_XMLDoc::SaveXMLNode(
-    const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream,
+    const RetainPtr<CFX_SeekableStreamProxy>& pXMLStream,
     CFX_XMLNode* pINode) {
   CFX_XMLNode* pNode = (CFX_XMLNode*)pINode;
   switch (pNode->GetType()) {
diff --git a/core/fxcrt/xml/cfx_xmldoc.h b/core/fxcrt/xml/cfx_xmldoc.h
index c182504..28de7fd 100644
--- a/core/fxcrt/xml/cfx_xmldoc.h
+++ b/core/fxcrt/xml/cfx_xmldoc.h
@@ -9,8 +9,8 @@
 
 #include <memory>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_seekablestreamproxy.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/xml/cfx_xmlnode.h"
 #include "core/fxcrt/xml/cfx_xmlparser.h"
 
@@ -24,14 +24,14 @@
   void CloseXML();
 
   CFX_XMLNode* GetRoot() const { return m_pRoot.get(); }
-  void SaveXMLNode(const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream,
+  void SaveXMLNode(const RetainPtr<CFX_SeekableStreamProxy>& pXMLStream,
                    CFX_XMLNode* pNode);
 
  private:
   int32_t m_iStatus;
   std::unique_ptr<CFX_XMLNode> m_pRoot;
   std::unique_ptr<CFX_XMLParser> m_pXMLParser;
-  CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream;
+  RetainPtr<CFX_SeekableStreamProxy> m_pStream;
 };
 
 #endif  // CORE_FXCRT_XML_CFX_XMLDOC_H_
diff --git a/core/fxcrt/xml/cfx_xmlnode.cpp b/core/fxcrt/xml/cfx_xmlnode.cpp
index 7a893af..a1e3ac2 100644
--- a/core/fxcrt/xml/cfx_xmlnode.cpp
+++ b/core/fxcrt/xml/cfx_xmlnode.cpp
@@ -330,7 +330,7 @@
 }
 
 void CFX_XMLNode::SaveXMLNode(
-    const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream) {
+    const RetainPtr<CFX_SeekableStreamProxy>& pXMLStream) {
   CFX_XMLNode* pNode = (CFX_XMLNode*)this;
   switch (pNode->GetType()) {
     case FX_XMLNODE_Instruction: {
diff --git a/core/fxcrt/xml/cfx_xmlnode.h b/core/fxcrt/xml/cfx_xmlnode.h
index 7cbc2b6..278b3bf 100644
--- a/core/fxcrt/xml/cfx_xmlnode.h
+++ b/core/fxcrt/xml/cfx_xmlnode.h
@@ -9,8 +9,8 @@
 
 #include <memory>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_seekablestreamproxy.h"
+#include "core/fxcrt/retain_ptr.h"
 
 enum FX_XMLNODETYPE {
   FX_XMLNODE_Unknown = 0,
@@ -64,7 +64,7 @@
   bool InsertNodeItem(CFX_XMLNode::NodeItem eItem, CFX_XMLNode* pNode);
   CFX_XMLNode* RemoveNodeItem(CFX_XMLNode::NodeItem eItem);
 
-  void SaveXMLNode(const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream);
+  void SaveXMLNode(const RetainPtr<CFX_SeekableStreamProxy>& pXMLStream);
 
   CFX_XMLNode* m_pParent;
   CFX_XMLNode* m_pChild;
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp
index 280c06d..a8bb2c9 100644
--- a/core/fxcrt/xml/cfx_xmlparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlparser.cpp
@@ -13,9 +13,8 @@
 #include "core/fxcrt/xml/cfx_xmltext.h"
 #include "third_party/base/ptr_util.h"
 
-CFX_XMLParser::CFX_XMLParser(
-    CFX_XMLNode* pParent,
-    const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream)
+CFX_XMLParser::CFX_XMLParser(CFX_XMLNode* pParent,
+                             const RetainPtr<CFX_SeekableStreamProxy>& pStream)
     : m_nElementStart(0),
       m_dwCheckStatus(0),
       m_dwCurrentCheckStatus(0),
diff --git a/core/fxcrt/xml/cfx_xmlparser.h b/core/fxcrt/xml/cfx_xmlparser.h
index f98b658..0038f6d 100644
--- a/core/fxcrt/xml/cfx_xmlparser.h
+++ b/core/fxcrt/xml/cfx_xmlparser.h
@@ -10,8 +10,8 @@
 #include <memory>
 #include <stack>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/xml/cfx_xmlsyntaxparser.h"
 
 class CFX_XMLElement;
@@ -21,7 +21,7 @@
 class CFX_XMLParser {
  public:
   CFX_XMLParser(CFX_XMLNode* pParent,
-                const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream);
+                const RetainPtr<CFX_SeekableStreamProxy>& pStream);
   ~CFX_XMLParser();
 
   int32_t DoParser();
@@ -33,7 +33,7 @@
   uint16_t m_dwCurrentCheckStatus;
 
  private:
-  CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream;
+  RetainPtr<CFX_SeekableStreamProxy> m_pStream;
   std::unique_ptr<CFX_XMLSyntaxParser> m_pParser;
   CFX_XMLNode* m_pParent;
   CFX_XMLNode* m_pChild;
diff --git a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
index d559852..5dcb867 100644
--- a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
@@ -76,7 +76,7 @@
 }
 
 CFX_XMLSyntaxParser::CFX_XMLSyntaxParser(
-    const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream)
+    const RetainPtr<CFX_SeekableStreamProxy>& pStream)
     : m_pStream(pStream),
       m_iXMLPlaneSize(32 * 1024),
       m_iCurrentPos(0),
diff --git a/core/fxcrt/xml/cfx_xmlsyntaxparser.h b/core/fxcrt/xml/cfx_xmlsyntaxparser.h
index d3f4bf2..8379aa4 100644
--- a/core/fxcrt/xml/cfx_xmlsyntaxparser.h
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.h
@@ -11,9 +11,9 @@
 #include <vector>
 
 #include "core/fxcrt/cfx_blockbuffer.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_seekablestreamproxy.h"
 #include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/xml/cfx_xmlnode.h"
 
 enum class FX_XmlSyntaxResult {
@@ -39,7 +39,7 @@
   static bool IsXMLNameChar(wchar_t ch, bool bFirstChar);
 
   explicit CFX_XMLSyntaxParser(
-      const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream);
+      const RetainPtr<CFX_SeekableStreamProxy>& pStream);
   ~CFX_XMLSyntaxParser();
 
   FX_XmlSyntaxResult DoSyntaxParse();
@@ -100,7 +100,7 @@
 
   void ParseTextChar(wchar_t ch);
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream;
+  RetainPtr<CFX_SeekableStreamProxy> m_pStream;
   FX_STRSIZE m_iXMLPlaneSize;
   FX_FILESIZE m_iCurrentPos;
   int32_t m_iCurrentNodeNum;
diff --git a/core/fxcrt/xml/cfx_xmlsyntaxparser_unittest.cpp b/core/fxcrt/xml/cfx_xmlsyntaxparser_unittest.cpp
index c3cc3d2..b7f7c41 100644
--- a/core/fxcrt/xml/cfx_xmlsyntaxparser_unittest.cpp
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser_unittest.cpp
@@ -26,7 +26,7 @@
       L"      app.alert(\"Tclams\");\n"
       L"  ";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -74,7 +74,7 @@
       L"    </script>\n"
       L"  ";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -111,7 +111,7 @@
       "  <!>\n"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -146,7 +146,7 @@
       "  <![>\n"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -176,7 +176,7 @@
       "  <![CDATA>\n"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -206,7 +206,7 @@
       "  <![CDATA[\n"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -236,7 +236,7 @@
       "  <![CDATA[]]>\n"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -273,7 +273,7 @@
       "  <!-- A Comment -->\n"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -307,7 +307,7 @@
       "  <!- A Comment -->\n"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -341,7 +341,7 @@
       "  <!---->\n"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -375,7 +375,7 @@
       "  <!--->\n"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -403,7 +403,7 @@
       "  <!-->\n"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -435,7 +435,7 @@
       "&#x0000000000000000000;"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -467,7 +467,7 @@
       "&#xafffffffffffffffffffffffffffffffff;"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
@@ -499,7 +499,7 @@
       "&#29149102052342342134521341234512351234213452315;"
       "</script>";
 
-  CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
+  RetainPtr<CFX_SeekableStreamProxy> stream =
       pdfium::MakeRetain<CFX_SeekableStreamProxy>(
           reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
   stream->SetCodePage(FX_CODEPAGE_UTF8);
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 5e0308c..3ba05ce 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -35,7 +35,7 @@
                     pdfium::clamp(pos.y, -kMaxPos, kMaxPos));
 }
 
-void RgbByteOrderSetPixel(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+void RgbByteOrderSetPixel(const RetainPtr<CFX_DIBitmap>& pBitmap,
                           int x,
                           int y,
                           uint32_t argb) {
@@ -55,7 +55,7 @@
   pos[2] = (FXARGB_B(argb) * alpha + pos[2] * (255 - alpha)) / 255;
 }
 
-void RgbByteOrderCompositeRect(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+void RgbByteOrderCompositeRect(const RetainPtr<CFX_DIBitmap>& pBitmap,
                                int left,
                                int top,
                                int width,
@@ -130,12 +130,12 @@
   }
 }
 
-void RgbByteOrderTransferBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+void RgbByteOrderTransferBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap,
                                 int dest_left,
                                 int dest_top,
                                 int width,
                                 int height,
-                                const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                 int src_left,
                                 int src_top) {
   if (!pBitmap)
@@ -228,7 +228,7 @@
   }
 }
 
-bool DibSetPixel(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
+bool DibSetPixel(const RetainPtr<CFX_DIBitmap>& pDevice,
                  int x,
                  int y,
                  uint32_t color) {
@@ -377,8 +377,8 @@
                          uint8_t* clip_scan,
                          uint8_t* dest_extra_alpha_scan);
 
-  bool Init(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
-            const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
+  bool Init(const RetainPtr<CFX_DIBitmap>& pDevice,
+            const RetainPtr<CFX_DIBitmap>& pOriDevice,
             const CFX_ClipRgn* pClipRgn,
             uint32_t color,
             bool bFullCover,
@@ -434,9 +434,9 @@
   bool m_bFullCover;
   bool m_bRgbByteOrder;
   FX_RECT m_ClipBox;
-  CFX_RetainPtr<CFX_DIBitmap> m_pOriDevice;
-  CFX_RetainPtr<CFX_DIBitmap> m_pClipMask;
-  CFX_RetainPtr<CFX_DIBitmap> m_pDevice;
+  RetainPtr<CFX_DIBitmap> m_pOriDevice;
+  RetainPtr<CFX_DIBitmap> m_pClipMask;
+  RetainPtr<CFX_DIBitmap> m_pDevice;
   CFX_UnownedPtr<const CFX_ClipRgn> m_pClipRgn;
 };
 
@@ -876,8 +876,8 @@
   }
 }
 
-bool CFX_Renderer::Init(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
-                        const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
+bool CFX_Renderer::Init(const RetainPtr<CFX_DIBitmap>& pDevice,
+                        const RetainPtr<CFX_DIBitmap>& pOriDevice,
                         const CFX_ClipRgn* pClipRgn,
                         uint32_t color,
                         bool bFullCover,
@@ -938,7 +938,7 @@
 
   uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * y;
   uint8_t* dest_scan_extra_alpha = nullptr;
-  CFX_RetainPtr<CFX_DIBitmap> pAlphaMask = m_pDevice->m_pAlphaMask;
+  RetainPtr<CFX_DIBitmap> pAlphaMask = m_pDevice->m_pAlphaMask;
   if (pAlphaMask) {
     dest_scan_extra_alpha =
         pAlphaMask->GetBuffer() + pAlphaMask->GetPitch() * y;
@@ -1104,9 +1104,9 @@
 }
 
 CFX_AggDeviceDriver::CFX_AggDeviceDriver(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+    const RetainPtr<CFX_DIBitmap>& pBitmap,
     bool bRgbByteOrder,
-    const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
+    const RetainPtr<CFX_DIBitmap>& pOriDevice,
     bool bGroupKnockout)
     : m_pBitmap(pBitmap),
 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -1283,7 +1283,7 @@
     uint32_t color,
     bool bFullCover,
     bool bGroupKnockout) {
-  CFX_RetainPtr<CFX_DIBitmap> pt = bGroupKnockout ? m_pOriDevice : nullptr;
+  RetainPtr<CFX_DIBitmap> pt = bGroupKnockout ? m_pOriDevice : nullptr;
   CFX_Renderer render;
   if (!render.Init(m_pBitmap, pt, m_pClipRgn.get(), color, bFullCover,
                    m_bRgbByteOrder)) {
@@ -1445,7 +1445,7 @@
   return true;
 }
 
-bool CFX_AggDeviceDriver::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+bool CFX_AggDeviceDriver::GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
                                     int left,
                                     int top) {
   if (!m_pBitmap || !m_pBitmap->GetBuffer())
@@ -1453,7 +1453,7 @@
 
   FX_RECT rect(left, top, left + pBitmap->GetWidth(),
                top + pBitmap->GetHeight());
-  CFX_RetainPtr<CFX_DIBitmap> pBack;
+  RetainPtr<CFX_DIBitmap> pBack;
   if (m_pOriDevice) {
     pBack = m_pOriDevice->Clone(&rect);
     if (!pBack)
@@ -1478,11 +1478,11 @@
                                  top);
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_AggDeviceDriver::GetBackDrop() {
+RetainPtr<CFX_DIBitmap> CFX_AggDeviceDriver::GetBackDrop() {
   return m_pOriDevice;
 }
 
-bool CFX_AggDeviceDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+bool CFX_AggDeviceDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                                     uint32_t argb,
                                     const FX_RECT* pSrcRect,
                                     int left,
@@ -1502,16 +1502,15 @@
       pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder);
 }
 
-bool CFX_AggDeviceDriver::StretchDIBits(
-    const CFX_RetainPtr<CFX_DIBSource>& pSource,
-    uint32_t argb,
-    int dest_left,
-    int dest_top,
-    int dest_width,
-    int dest_height,
-    const FX_RECT* pClipRect,
-    uint32_t flags,
-    int blend_type) {
+bool CFX_AggDeviceDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource,
+                                        uint32_t argb,
+                                        int dest_left,
+                                        int dest_top,
+                                        int dest_width,
+                                        int dest_height,
+                                        const FX_RECT* pClipRect,
+                                        uint32_t flags,
+                                        int blend_type) {
   if (!m_pBitmap->GetBuffer())
     return true;
 
@@ -1537,7 +1536,7 @@
 }
 
 bool CFX_AggDeviceDriver::StartDIBits(
-    const CFX_RetainPtr<CFX_DIBSource>& pSource,
+    const RetainPtr<CFX_DIBSource>& pSource,
     int bitmap_alpha,
     uint32_t argb,
     const CFX_Matrix* pMatrix,
@@ -1563,11 +1562,10 @@
 
 CFX_DefaultRenderDevice::~CFX_DefaultRenderDevice() {}
 
-bool CFX_DefaultRenderDevice::Attach(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
-    bool bRgbByteOrder,
-    const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
-    bool bGroupKnockout) {
+bool CFX_DefaultRenderDevice::Attach(const RetainPtr<CFX_DIBitmap>& pBitmap,
+                                     bool bRgbByteOrder,
+                                     const RetainPtr<CFX_DIBitmap>& pOriDevice,
+                                     bool bGroupKnockout) {
   if (!pBitmap)
     return false;
 
@@ -1581,7 +1579,7 @@
     int width,
     int height,
     FXDIB_Format format,
-    const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice) {
+    const RetainPtr<CFX_DIBitmap>& pOriDevice) {
   auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
   if (!pBitmap->Create(width, height, format))
     return false;
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h
index c6aafeb..0afc7e3 100644
--- a/core/fxge/agg/fx_agg_driver.h
+++ b/core/fxge/agg/fx_agg_driver.h
@@ -32,9 +32,9 @@
 
 class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
  public:
-  CFX_AggDeviceDriver(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+  CFX_AggDeviceDriver(const RetainPtr<CFX_DIBitmap>& pBitmap,
                       bool bRgbByteOrder,
-                      const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
+                      const RetainPtr<CFX_DIBitmap>& pOriDevice,
                       bool bGroupKnockout);
   ~CFX_AggDeviceDriver() override;
 
@@ -63,17 +63,17 @@
                          uint32_t fill_color,
                          int blend_type) override;
   bool GetClipBox(FX_RECT* pRect) override;
-  bool GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+  bool GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
                  int left,
                  int top) override;
-  CFX_RetainPtr<CFX_DIBitmap> GetBackDrop() override;
-  bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  RetainPtr<CFX_DIBitmap> GetBackDrop() override;
+  bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                  uint32_t color,
                  const FX_RECT* pSrcRect,
                  int left,
                  int top,
                  int blend_type) override;
-  bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                      uint32_t color,
                      int dest_left,
                      int dest_top,
@@ -82,7 +82,7 @@
                      const FX_RECT* pClipRect,
                      uint32_t flags,
                      int blend_type) override;
-  bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                    int bitmap_alpha,
                    uint32_t color,
                    const CFX_Matrix* pMatrix,
@@ -109,7 +109,7 @@
   virtual uint8_t* GetBuffer() const;
 
  private:
-  CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+  RetainPtr<CFX_DIBitmap> m_pBitmap;
   std::unique_ptr<CFX_ClipRgn> m_pClipRgn;
   std::vector<std::unique_ptr<CFX_ClipRgn>> m_StateStack;
 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -117,7 +117,7 @@
 #endif
   int m_FillFlags;
   bool m_bRgbByteOrder;
-  CFX_RetainPtr<CFX_DIBitmap> m_pOriDevice;
+  RetainPtr<CFX_DIBitmap> m_pOriDevice;
   bool m_bGroupKnockout;
 };
 
diff --git a/core/fxge/android/cfpf_skiafilefont.h b/core/fxge/android/cfpf_skiafilefont.h
index 4496fde..5e2ebbc 100644
--- a/core/fxge/android/cfpf_skiafilefont.h
+++ b/core/fxge/android/cfpf_skiafilefont.h
@@ -7,7 +7,7 @@
 #ifndef CORE_FXGE_ANDROID_CFPF_SKIAFILEFONT_H_
 #define CORE_FXGE_ANDROID_CFPF_SKIAFILEFONT_H_
 
-#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/android/cfpf_skiafontdescriptor.h"
 
 class IFX_SeekableReadStream;
@@ -22,7 +22,7 @@
   // CFPF_SkiaFontDescriptor
   int32_t GetType() const override;
 
-  CFX_RetainPtr<IFX_SeekableReadStream> m_pFile;
+  RetainPtr<IFX_SeekableReadStream> m_pFile;
 };
 
 #endif  // CORE_FXGE_ANDROID_CFPF_SKIAFILEFONT_H_
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index a50b9ea..4be3566 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -363,7 +363,7 @@
 }
 
 FXFT_Face CFPF_SkiaFontMgr::GetFontFace(
-    const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
+    const RetainPtr<IFX_SeekableReadStream>& pFileRead,
     int32_t iFaceIndex) {
   if (!pFileRead)
     return nullptr;
diff --git a/core/fxge/android/cfpf_skiafontmgr.h b/core/fxge/android/cfpf_skiafontmgr.h
index 78d0171..11ad47a 100644
--- a/core/fxge/android/cfpf_skiafontmgr.h
+++ b/core/fxge/android/cfpf_skiafontmgr.h
@@ -31,7 +31,7 @@
                             uint32_t dwMatch = 0);
 
   bool InitFTLibrary();
-  FXFT_Face GetFontFace(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
+  FXFT_Face GetFontFace(const RetainPtr<IFX_SeekableReadStream>& pFileRead,
                         int32_t iFaceIndex = 0);
   FXFT_Face GetFontFace(const ByteStringView& bsFile, int32_t iFaceIndex = 0);
   FXFT_Face GetFontFace(const uint8_t* pBuffer,
diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h
index f1b9fcf..82415ec 100644
--- a/core/fxge/apple/apple_int.h
+++ b/core/fxge/apple/apple_int.h
@@ -19,7 +19,7 @@
 
 class CQuartz2D {
  public:
-  void* createGraphics(const CFX_RetainPtr<CFX_DIBitmap>& bitmap);
+  void* createGraphics(const RetainPtr<CFX_DIBitmap>& bitmap);
   void destroyGraphics(void* graphics);
 
   void* CreateFont(const uint8_t* pFontData, uint32_t dwFontSize);
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index b3a3f26..05ae70a 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -131,7 +131,7 @@
     rect_cg =
         CGRectMake(m_pClipRgn->GetBox().left, m_pClipRgn->GetBox().top,
                    m_pClipRgn->GetBox().Width(), m_pClipRgn->GetBox().Height());
-    CFX_RetainPtr<CFX_DIBitmap> pClipMask = m_pClipRgn->GetMask();
+    RetainPtr<CFX_DIBitmap> pClipMask = m_pClipRgn->GetMask();
     if (pClipMask) {
       CGDataProviderRef pClipMaskDataProvider = CGDataProviderCreateWithData(
           nullptr, pClipMask->GetBuffer(),
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index f92db2b..1e9fdda 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -23,7 +23,7 @@
 #error Expected CGFLOAT_IS_DOUBLE to be defined by CoreGraphics headers
 #endif
 
-void* CQuartz2D::createGraphics(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
+void* CQuartz2D::createGraphics(const RetainPtr<CFX_DIBitmap>& pBitmap) {
   if (!pBitmap)
     return nullptr;
   CGBitmapInfo bmpInfo = kCGBitmapByteOrder32Little;
diff --git a/core/fxge/cfx_cliprgn.cpp b/core/fxge/cfx_cliprgn.cpp
index 087c110..9569ee9 100644
--- a/core/fxge/cfx_cliprgn.cpp
+++ b/core/fxge/cfx_cliprgn.cpp
@@ -41,7 +41,7 @@
 
 void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect,
                                     FX_RECT mask_rect,
-                                    const CFX_RetainPtr<CFX_DIBitmap>& pMask) {
+                                    const RetainPtr<CFX_DIBitmap>& pMask) {
   m_Type = MaskF;
   m_Box = rect;
   m_Box.Intersect(mask_rect);
@@ -53,7 +53,7 @@
     m_Mask = pMask;
     return;
   }
-  CFX_RetainPtr<CFX_DIBitmap> pOldMask(pMask);
+  RetainPtr<CFX_DIBitmap> pOldMask(pMask);
   m_Mask = pdfium::MakeRetain<CFX_DIBitmap>();
   m_Mask->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask);
   for (int row = m_Box.top; row < m_Box.bottom; row++) {
@@ -68,7 +68,7 @@
 
 void CFX_ClipRgn::IntersectMaskF(int left,
                                  int top,
-                                 const CFX_RetainPtr<CFX_DIBitmap>& pMask) {
+                                 const RetainPtr<CFX_DIBitmap>& pMask) {
   ASSERT(pMask->GetFormat() == FXDIB_8bppMask);
   FX_RECT mask_box(left, top, left + pMask->GetWidth(),
                    top + pMask->GetHeight());
diff --git a/core/fxge/cfx_cliprgn.h b/core/fxge/cfx_cliprgn.h
index 0dfc499..58ebb4d 100644
--- a/core/fxge/cfx_cliprgn.h
+++ b/core/fxge/cfx_cliprgn.h
@@ -7,8 +7,8 @@
 #ifndef CORE_FXGE_CFX_CLIPRGN_H_
 #define CORE_FXGE_CFX_CLIPRGN_H_
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CFX_DIBitmap;
 
@@ -22,22 +22,20 @@
 
   ClipType GetType() const { return m_Type; }
   const FX_RECT& GetBox() const { return m_Box; }
-  CFX_RetainPtr<CFX_DIBitmap> GetMask() const { return m_Mask; }
+  RetainPtr<CFX_DIBitmap> GetMask() const { return m_Mask; }
 
   void Reset(const FX_RECT& rect);
   void IntersectRect(const FX_RECT& rect);
-  void IntersectMaskF(int left,
-                      int top,
-                      const CFX_RetainPtr<CFX_DIBitmap>& Mask);
+  void IntersectMaskF(int left, int top, const RetainPtr<CFX_DIBitmap>& Mask);
 
  private:
   void IntersectMaskRect(FX_RECT rect,
                          FX_RECT mask_box,
-                         const CFX_RetainPtr<CFX_DIBitmap>& Mask);
+                         const RetainPtr<CFX_DIBitmap>& Mask);
 
   ClipType m_Type;
   FX_RECT m_Box;
-  CFX_RetainPtr<CFX_DIBitmap> m_Mask;
+  RetainPtr<CFX_DIBitmap> m_Mask;
 };
 
 #endif  // CORE_FXGE_CFX_CLIPRGN_H_
diff --git a/core/fxge/cfx_defaultrenderdevice.h b/core/fxge/cfx_defaultrenderdevice.h
index e2dc1f3..59415df 100644
--- a/core/fxge/cfx_defaultrenderdevice.h
+++ b/core/fxge/cfx_defaultrenderdevice.h
@@ -17,22 +17,22 @@
   CFX_DefaultRenderDevice();
   ~CFX_DefaultRenderDevice() override;
 
-  bool Attach(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+  bool Attach(const RetainPtr<CFX_DIBitmap>& pBitmap,
               bool bRgbByteOrder,
-              const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
+              const RetainPtr<CFX_DIBitmap>& pOriDevice,
               bool bGroupKnockout);
   bool Create(int width,
               int height,
               FXDIB_Format format,
-              const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice);
+              const RetainPtr<CFX_DIBitmap>& pOriDevice);
 
 #ifdef _SKIA_SUPPORT_
   bool AttachRecorder(SkPictureRecorder* recorder);
   void Clear(uint32_t color);
   SkPictureRecorder* CreateRecorder(int size_x, int size_y);
   void DebugVerifyBitmapIsPreMultiplied() const override;
-  bool SetBitsWithMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-                       const CFX_RetainPtr<CFX_DIBSource>& pMask,
+  bool SetBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap,
+                       const RetainPtr<CFX_DIBSource>& pMask,
                        int left,
                        int top,
                        int bitmap_alpha,
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 017b120..9e6a2cf 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -54,7 +54,7 @@
 
 bool LoadFileImp(FXFT_Library library,
                  FXFT_Face* Face,
-                 const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+                 const RetainPtr<IFX_SeekableReadStream>& pFile,
                  int32_t faceIndex,
                  std::unique_ptr<FXFT_StreamRec>* stream) {
   auto stream1 = pdfium::MakeUnique<FXFT_StreamRec>();
@@ -311,7 +311,7 @@
 }
 
 #ifdef PDF_ENABLE_XFA
-bool CFX_Font::LoadFile(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+bool CFX_Font::LoadFile(const RetainPtr<IFX_SeekableReadStream>& pFile,
                         int nFaceIndex) {
   m_bEmbedded = false;
 
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 5e9f5ae..c6f9411 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -197,8 +197,8 @@
     alpha[3] = 255;
 }
 
-void DrawNormalTextHelper(const CFX_RetainPtr<CFX_DIBitmap>& bitmap,
-                          const CFX_RetainPtr<CFX_DIBitmap>& pGlyph,
+void DrawNormalTextHelper(const RetainPtr<CFX_DIBitmap>& bitmap,
+                          const RetainPtr<CFX_DIBitmap>& pGlyph,
                           int nrows,
                           int left,
                           int top,
@@ -428,7 +428,7 @@
 }
 
 bool CFX_RenderDevice::CreateCompatibleBitmap(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDIB,
+    const RetainPtr<CFX_DIBitmap>& pDIB,
     int width,
     int height) const {
   if (m_RenderCaps & FXRC_CMYK_OUTPUT) {
@@ -707,19 +707,19 @@
                                    fill_mode, blend_type);
 }
 
-bool CFX_RenderDevice::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+bool CFX_RenderDevice::GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
                                  int left,
                                  int top) {
   return (m_RenderCaps & FXRC_GET_BITS) &&
          m_pDeviceDriver->GetDIBits(pBitmap, left, top);
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_RenderDevice::GetBackDrop() {
+RetainPtr<CFX_DIBitmap> CFX_RenderDevice::GetBackDrop() {
   return m_pDeviceDriver->GetBackDrop();
 }
 
 bool CFX_RenderDevice::SetDIBitsWithBlend(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+    const RetainPtr<CFX_DIBSource>& pBitmap,
     int left,
     int top,
     int blend_mode) {
@@ -771,7 +771,7 @@
 }
 
 bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+    const RetainPtr<CFX_DIBSource>& pBitmap,
     int left,
     int top,
     int dest_width,
@@ -786,7 +786,7 @@
                                    dest_height, &clip_box, flags, blend_mode);
 }
 
-bool CFX_RenderDevice::SetBitMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+bool CFX_RenderDevice::SetBitMask(const RetainPtr<CFX_DIBSource>& pBitmap,
                                   int left,
                                   int top,
                                   uint32_t argb) {
@@ -795,19 +795,18 @@
                                     FXDIB_BLEND_NORMAL);
 }
 
-bool CFX_RenderDevice::StretchBitMask(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-    int left,
-    int top,
-    int dest_width,
-    int dest_height,
-    uint32_t color) {
+bool CFX_RenderDevice::StretchBitMask(const RetainPtr<CFX_DIBSource>& pBitmap,
+                                      int left,
+                                      int top,
+                                      int dest_width,
+                                      int dest_height,
+                                      uint32_t color) {
   return StretchBitMaskWithFlags(pBitmap, left, top, dest_width, dest_height,
                                  color, 0);
 }
 
 bool CFX_RenderDevice::StretchBitMaskWithFlags(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+    const RetainPtr<CFX_DIBSource>& pBitmap,
     int left,
     int top,
     int dest_width,
@@ -823,7 +822,7 @@
 }
 
 bool CFX_RenderDevice::StartDIBitsWithBlend(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+    const RetainPtr<CFX_DIBSource>& pBitmap,
     int bitmap_alpha,
     uint32_t argb,
     const CFX_Matrix* pMatrix,
@@ -844,13 +843,12 @@
   SkASSERT(0);
 }
 
-bool CFX_RenderDevice::SetBitsWithMask(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-    const CFX_RetainPtr<CFX_DIBSource>& pMask,
-    int left,
-    int top,
-    int bitmap_alpha,
-    int blend_type) {
+bool CFX_RenderDevice::SetBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap,
+                                       const RetainPtr<CFX_DIBSource>& pMask,
+                                       int left,
+                                       int top,
+                                       int bitmap_alpha,
+                                       int blend_type) {
   return m_pDeviceDriver->SetBitsWithMask(pBitmap, pMask, left, top,
                                           bitmap_alpha, blend_type);
 }
@@ -989,7 +987,7 @@
     for (const FXTEXT_GLYPHPOS& glyph : glyphs) {
       if (!glyph.m_pGlyph)
         continue;
-      CFX_RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap;
+      RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap;
       bitmap->TransferBitmap(
           glyph.m_Origin.x + glyph.m_pGlyph->m_Left - pixel_left,
           glyph.m_Origin.y - glyph.m_pGlyph->m_Top - pixel_top,
@@ -1038,7 +1036,7 @@
     if (!top.IsValid())
       return false;
 
-    CFX_RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap;
+    RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap;
     int ncols = pGlyph->GetWidth();
     int nrows = pGlyph->GetHeight();
     if (anti_alias == FXFT_RENDER_MODE_NORMAL) {
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index 36fb5ed..75b0ef3 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -112,11 +112,11 @@
   int GetRenderCaps() const { return m_RenderCaps; }
   int GetDeviceCaps(int id) const;
   CFX_Matrix GetCTM() const;
-  CFX_RetainPtr<CFX_DIBitmap> GetBitmap() const { return m_pBitmap; }
-  void SetBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
+  RetainPtr<CFX_DIBitmap> GetBitmap() const { return m_pBitmap; }
+  void SetBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap) {
     m_pBitmap = pBitmap;
   }
-  bool CreateCompatibleBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pDIB,
+  bool CreateCompatibleBitmap(const RetainPtr<CFX_DIBitmap>& pDIB,
                               int width,
                               int height) const;
   const FX_RECT& GetClipBox() const { return m_ClipBox; }
@@ -148,18 +148,16 @@
     return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL);
   }
 
-  CFX_RetainPtr<CFX_DIBitmap> GetBackDrop();
-  bool GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, int left, int top);
-  bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-                 int left,
-                 int top) {
+  RetainPtr<CFX_DIBitmap> GetBackDrop();
+  bool GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap, int left, int top);
+  bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, int left, int top) {
     return SetDIBitsWithBlend(pBitmap, left, top, FXDIB_BLEND_NORMAL);
   }
-  bool SetDIBitsWithBlend(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool SetDIBitsWithBlend(const RetainPtr<CFX_DIBSource>& pBitmap,
                           int left,
                           int top,
                           int blend_type);
-  bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                      int left,
                      int top,
                      int dest_width,
@@ -167,32 +165,31 @@
     return StretchDIBitsWithFlagsAndBlend(pBitmap, left, top, dest_width,
                                           dest_height, 0, FXDIB_BLEND_NORMAL);
   }
-  bool StretchDIBitsWithFlagsAndBlend(
-      const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-      int left,
-      int top,
-      int dest_width,
-      int dest_height,
-      uint32_t flags,
-      int blend_type);
-  bool SetBitMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StretchDIBitsWithFlagsAndBlend(const RetainPtr<CFX_DIBSource>& pBitmap,
+                                      int left,
+                                      int top,
+                                      int dest_width,
+                                      int dest_height,
+                                      uint32_t flags,
+                                      int blend_type);
+  bool SetBitMask(const RetainPtr<CFX_DIBSource>& pBitmap,
                   int left,
                   int top,
                   uint32_t color);
-  bool StretchBitMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StretchBitMask(const RetainPtr<CFX_DIBSource>& pBitmap,
                       int left,
                       int top,
                       int dest_width,
                       int dest_height,
                       uint32_t color);
-  bool StretchBitMaskWithFlags(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StretchBitMaskWithFlags(const RetainPtr<CFX_DIBSource>& pBitmap,
                                int left,
                                int top,
                                int dest_width,
                                int dest_height,
                                uint32_t color,
                                uint32_t flags);
-  bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                    int bitmap_alpha,
                    uint32_t color,
                    const CFX_Matrix* pMatrix,
@@ -201,7 +198,7 @@
     return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, pMatrix, flags,
                                 handle, FXDIB_BLEND_NORMAL);
   }
-  bool StartDIBitsWithBlend(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StartDIBitsWithBlend(const RetainPtr<CFX_DIBSource>& pBitmap,
                             int bitmap_alpha,
                             uint32_t color,
                             const CFX_Matrix* pMatrix,
@@ -267,8 +264,8 @@
 
 #ifdef _SKIA_SUPPORT_
   virtual void DebugVerifyBitmapIsPreMultiplied() const;
-  virtual bool SetBitsWithMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-                               const CFX_RetainPtr<CFX_DIBSource>& pMask,
+  virtual bool SetBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap,
+                               const RetainPtr<CFX_DIBSource>& pMask,
                                int left,
                                int top,
                                int bitmap_alpha,
@@ -295,7 +292,7 @@
                         int blend_type);
   bool FillRectWithBlend(const FX_RECT* pRect, uint32_t color, int blend_type);
 
-  CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+  RetainPtr<CFX_DIBitmap> m_pBitmap;
   int m_Width;
   int m_Height;
   int m_bpp;
diff --git a/core/fxge/dib/cfx_bitmapcomposer.cpp b/core/fxge/dib/cfx_bitmapcomposer.cpp
index 5657190..3854949 100644
--- a/core/fxge/dib/cfx_bitmapcomposer.cpp
+++ b/core/fxge/dib/cfx_bitmapcomposer.cpp
@@ -14,7 +14,7 @@
 
 CFX_BitmapComposer::~CFX_BitmapComposer() {}
 
-void CFX_BitmapComposer::Compose(const CFX_RetainPtr<CFX_DIBitmap>& pDest,
+void CFX_BitmapComposer::Compose(const RetainPtr<CFX_DIBitmap>& pDest,
                                  const CFX_ClipRgn* pClipRgn,
                                  int bitmap_alpha,
                                  uint32_t mask_color,
diff --git a/core/fxge/dib/cfx_bitmapcomposer.h b/core/fxge/dib/cfx_bitmapcomposer.h
index cc4ecb1..7fb3037 100644
--- a/core/fxge/dib/cfx_bitmapcomposer.h
+++ b/core/fxge/dib/cfx_bitmapcomposer.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"
 #include "core/fxge/dib/cfx_scanlinecompositor.h"
 #include "core/fxge/dib/ifx_scanlinecomposer.h"
 
@@ -23,7 +23,7 @@
   CFX_BitmapComposer();
   ~CFX_BitmapComposer() override;
 
-  void Compose(const CFX_RetainPtr<CFX_DIBitmap>& pDest,
+  void Compose(const RetainPtr<CFX_DIBitmap>& pDest,
                const CFX_ClipRgn* pClipRgn,
                int bitmap_alpha,
                uint32_t mask_color,
@@ -56,7 +56,7 @@
                         const uint8_t* scanline,
                         const uint8_t* scan_extra_alpha);
 
-  CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+  RetainPtr<CFX_DIBitmap> m_pBitmap;
   CFX_UnownedPtr<const CFX_ClipRgn> m_pClipRgn;
   FXDIB_Format m_SrcFormat;
   int m_DestLeft;
@@ -65,7 +65,7 @@
   int m_DestHeight;
   int m_BitmapAlpha;
   uint32_t m_MaskColor;
-  CFX_RetainPtr<CFX_DIBitmap> m_pClipMask;
+  RetainPtr<CFX_DIBitmap> m_pClipMask;
   CFX_ScanlineCompositor m_Compositor;
   bool m_bVertical;
   bool m_bFlipX;
diff --git a/core/fxge/dib/cfx_bitmapstorer.cpp b/core/fxge/dib/cfx_bitmapstorer.cpp
index 1e09708..f649e0c 100644
--- a/core/fxge/dib/cfx_bitmapstorer.cpp
+++ b/core/fxge/dib/cfx_bitmapstorer.cpp
@@ -14,11 +14,11 @@
 
 CFX_BitmapStorer::~CFX_BitmapStorer() {}
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_BitmapStorer::Detach() {
+RetainPtr<CFX_DIBitmap> CFX_BitmapStorer::Detach() {
   return std::move(m_pBitmap);
 }
 
-void CFX_BitmapStorer::Replace(CFX_RetainPtr<CFX_DIBitmap>&& pBitmap) {
+void CFX_BitmapStorer::Replace(RetainPtr<CFX_DIBitmap>&& pBitmap) {
   m_pBitmap = std::move(pBitmap);
 }
 
diff --git a/core/fxge/dib/cfx_bitmapstorer.h b/core/fxge/dib/cfx_bitmapstorer.h
index a574493..3d3416d 100644
--- a/core/fxge/dib/cfx_bitmapstorer.h
+++ b/core/fxge/dib/cfx_bitmapstorer.h
@@ -10,8 +10,8 @@
 #include <memory>
 #include <vector>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "core/fxge/dib/ifx_scanlinecomposer.h"
 #include "third_party/base/stl_util.h"
@@ -30,12 +30,12 @@
                FXDIB_Format src_format,
                uint32_t* pSrcPalette) override;
 
-  CFX_RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pBitmap; }
-  CFX_RetainPtr<CFX_DIBitmap> Detach();
-  void Replace(CFX_RetainPtr<CFX_DIBitmap>&& pBitmap);
+  RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pBitmap; }
+  RetainPtr<CFX_DIBitmap> Detach();
+  void Replace(RetainPtr<CFX_DIBitmap>&& pBitmap);
 
  private:
-  CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+  RetainPtr<CFX_DIBitmap> m_pBitmap;
 };
 
 #endif  // CORE_FXGE_DIB_CFX_BITMAPSTORER_H_
diff --git a/core/fxge/dib/cfx_dibextractor.cpp b/core/fxge/dib/cfx_dibextractor.cpp
index 325454a..13ad461 100644
--- a/core/fxge/dib/cfx_dibextractor.cpp
+++ b/core/fxge/dib/cfx_dibextractor.cpp
@@ -8,12 +8,12 @@
 
 #include "core/fxge/dib/cfx_dibsource.h"
 
-CFX_DIBExtractor::CFX_DIBExtractor(const CFX_RetainPtr<CFX_DIBSource>& pSrc) {
+CFX_DIBExtractor::CFX_DIBExtractor(const RetainPtr<CFX_DIBSource>& pSrc) {
   if (!pSrc->GetBuffer()) {
     m_pBitmap = pSrc->Clone(nullptr);
     return;
   }
-  CFX_RetainPtr<CFX_DIBSource> pOldSrc(pSrc);
+  RetainPtr<CFX_DIBSource> pOldSrc(pSrc);
   m_pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
   if (!m_pBitmap->Create(pOldSrc->GetWidth(), pOldSrc->GetHeight(),
                          pOldSrc->GetFormat(), pOldSrc->GetBuffer())) {
diff --git a/core/fxge/dib/cfx_dibextractor.h b/core/fxge/dib/cfx_dibextractor.h
index 25d80ec..b6c27a7 100644
--- a/core/fxge/dib/cfx_dibextractor.h
+++ b/core/fxge/dib/cfx_dibextractor.h
@@ -7,20 +7,20 @@
 #ifndef CORE_FXGE_DIB_CFX_DIBEXTRACTOR_H_
 #define CORE_FXGE_DIB_CFX_DIBEXTRACTOR_H_
 
-#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/dib/cfx_dibitmap.h"
 
 class CFX_DIBSource;
 
 class CFX_DIBExtractor {
  public:
-  explicit CFX_DIBExtractor(const CFX_RetainPtr<CFX_DIBSource>& pSrc);
+  explicit CFX_DIBExtractor(const RetainPtr<CFX_DIBSource>& pSrc);
   ~CFX_DIBExtractor();
 
-  CFX_RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pBitmap; }
+  RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pBitmap; }
 
  private:
-  CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+  RetainPtr<CFX_DIBitmap> m_pBitmap;
 };
 
 #endif  // CORE_FXGE_DIB_CFX_DIBEXTRACTOR_H_
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
index fd6defe..8e10593 100644
--- a/core/fxge/dib/cfx_dibitmap.cpp
+++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -81,7 +81,7 @@
   return false;
 }
 
-bool CFX_DIBitmap::Copy(const CFX_RetainPtr<CFX_DIBSource>& pSrc) {
+bool CFX_DIBitmap::Copy(const RetainPtr<CFX_DIBSource>& pSrc) {
   if (m_pBuffer)
     return false;
 
@@ -105,7 +105,7 @@
   return m_pBuffer.Get() ? m_pBuffer.Get() + line * m_Pitch : nullptr;
 }
 
-void CFX_DIBitmap::TakeOver(CFX_RetainPtr<CFX_DIBitmap>&& pSrcBitmap) {
+void CFX_DIBitmap::TakeOver(RetainPtr<CFX_DIBitmap>&& pSrcBitmap) {
   m_pBuffer = std::move(pSrcBitmap->m_pBuffer);
   m_pPalette = std::move(pSrcBitmap->m_pPalette);
   m_pAlphaMask = pSrcBitmap->m_pAlphaMask;
@@ -180,14 +180,13 @@
   }
 }
 
-bool CFX_DIBitmap::TransferBitmap(
-    int dest_left,
-    int dest_top,
-    int width,
-    int height,
-    const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
-    int src_left,
-    int src_top) {
+bool CFX_DIBitmap::TransferBitmap(int dest_left,
+                                  int dest_top,
+                                  int width,
+                                  int height,
+                                  const RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                  int src_left,
+                                  int src_top) {
   if (!m_pBuffer)
     return false;
 
@@ -243,12 +242,12 @@
 }
 
 bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
-                               const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                               const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                FXDIB_Channel srcChannel) {
   if (!m_pBuffer)
     return false;
 
-  CFX_RetainPtr<CFX_DIBSource> pSrcClone = pSrcBitmap;
+  RetainPtr<CFX_DIBSource> pSrcClone = pSrcBitmap;
   int srcOffset;
   if (srcChannel == FXDIB_Alpha) {
     if (!pSrcBitmap->HasAlpha() && !pSrcBitmap->IsAlphaMask())
@@ -308,7 +307,7 @@
     destOffset = g_ChannelOffset[destChannel];
   }
   if (srcChannel == FXDIB_Alpha && pSrcClone->m_pAlphaMask) {
-    CFX_RetainPtr<CFX_DIBSource> pAlphaMask = pSrcClone->m_pAlphaMask;
+    RetainPtr<CFX_DIBSource> pAlphaMask = pSrcClone->m_pAlphaMask;
     if (pSrcClone->GetWidth() != m_Width ||
         pSrcClone->GetHeight() != m_Height) {
       if (pAlphaMask) {
@@ -321,14 +320,14 @@
     srcOffset = 0;
   } else if (pSrcClone->GetWidth() != m_Width ||
              pSrcClone->GetHeight() != m_Height) {
-    CFX_RetainPtr<CFX_DIBitmap> pSrcMatched =
+    RetainPtr<CFX_DIBitmap> pSrcMatched =
         pSrcClone->StretchTo(m_Width, m_Height, 0, nullptr);
     if (!pSrcMatched)
       return false;
 
     pSrcClone = std::move(pSrcMatched);
   }
-  CFX_RetainPtr<CFX_DIBitmap> pDst(this);
+  RetainPtr<CFX_DIBitmap> pDst(this);
   if (destChannel == FXDIB_Alpha && m_pAlphaMask) {
     pDst = m_pAlphaMask;
     destOffset = 0;
@@ -406,8 +405,7 @@
   return true;
 }
 
-bool CFX_DIBitmap::MultiplyAlpha(
-    const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap) {
+bool CFX_DIBitmap::MultiplyAlpha(const RetainPtr<CFX_DIBSource>& pSrcBitmap) {
   if (!m_pBuffer)
     return false;
 
@@ -418,7 +416,7 @@
   if (!IsAlphaMask() && !HasAlpha())
     return LoadChannel(FXDIB_Alpha, pSrcBitmap, FXDIB_Alpha);
 
-  CFX_RetainPtr<CFX_DIBitmap> pSrcClone = pSrcBitmap.As<CFX_DIBitmap>();
+  RetainPtr<CFX_DIBitmap> pSrcClone = pSrcBitmap.As<CFX_DIBitmap>();
   if (pSrcBitmap->GetWidth() != m_Width ||
       pSrcBitmap->GetHeight() != m_Height) {
     pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height, 0, nullptr);
@@ -834,17 +832,16 @@
   return true;
 }
 
-bool CFX_DIBitmap::CompositeBitmap(
-    int dest_left,
-    int dest_top,
-    int width,
-    int height,
-    const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
-    int src_left,
-    int src_top,
-    int blend_type,
-    const CFX_ClipRgn* pClipRgn,
-    bool bRgbByteOrder) {
+bool CFX_DIBitmap::CompositeBitmap(int dest_left,
+                                   int dest_top,
+                                   int width,
+                                   int height,
+                                   const RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                   int src_left,
+                                   int src_top,
+                                   int blend_type,
+                                   const CFX_ClipRgn* pClipRgn,
+                                   bool bRgbByteOrder) {
   if (!m_pBuffer)
     return false;
 
@@ -858,7 +855,7 @@
   if (width == 0 || height == 0) {
     return true;
   }
-  CFX_RetainPtr<CFX_DIBitmap> pClipMask;
+  RetainPtr<CFX_DIBitmap> pClipMask;
   FX_RECT clip_box;
   if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
     ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
@@ -874,7 +871,7 @@
   int dest_Bpp = m_bpp / 8;
   int src_Bpp = pSrcBitmap->GetBPP() / 8;
   bool bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage();
-  CFX_RetainPtr<CFX_DIBitmap> pSrcAlphaMask = pSrcBitmap->m_pAlphaMask;
+  RetainPtr<CFX_DIBitmap> pSrcAlphaMask = pSrcBitmap->m_pAlphaMask;
   for (int row = 0; row < height; row++) {
     uint8_t* dest_scan =
         m_pBuffer.Get() + (dest_top + row) * m_Pitch + dest_left * dest_Bpp;
@@ -910,7 +907,7 @@
                                  int dest_top,
                                  int width,
                                  int height,
-                                 const CFX_RetainPtr<CFX_DIBSource>& pMask,
+                                 const RetainPtr<CFX_DIBSource>& pMask,
                                  uint32_t color,
                                  int src_left,
                                  int src_top,
@@ -936,7 +933,7 @@
   if (src_alpha == 0)
     return true;
 
-  CFX_RetainPtr<CFX_DIBitmap> pClipMask;
+  RetainPtr<CFX_DIBitmap> pClipMask;
   FX_RECT clip_box;
   if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
     ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
@@ -1197,7 +1194,7 @@
   if (!dest_buf)
     return false;
 
-  CFX_RetainPtr<CFX_DIBitmap> pAlphaMask;
+  RetainPtr<CFX_DIBitmap> pAlphaMask;
   if (dest_format == FXDIB_Argb) {
     memset(dest_buf.get(), 0xff, dest_pitch * m_Height + 4);
     if (m_pAlphaMask) {
@@ -1226,7 +1223,7 @@
     }
   }
   bool ret = false;
-  CFX_RetainPtr<CFX_DIBSource> holder(this);
+  RetainPtr<CFX_DIBSource> holder(this);
   std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp;
   ret = ConvertBuffer(dest_format, dest_buf.get(), dest_pitch, m_Width,
                       m_Height, holder, 0, 0, &pal_8bpp);
diff --git a/core/fxge/dib/cfx_dibitmap.h b/core/fxge/dib/cfx_dibitmap.h
index 79eeaeb..7240829 100644
--- a/core/fxge/dib/cfx_dibitmap.h
+++ b/core/fxge/dib/cfx_dibitmap.h
@@ -7,16 +7,16 @@
 #ifndef CORE_FXGE_DIB_CFX_DIBITMAP_H_
 #define CORE_FXGE_DIB_CFX_DIBITMAP_H_
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/maybe_owned.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/dib/cfx_dibsource.h"
 #include "third_party/base/stl_util.h"
 
 class CFX_DIBitmap : public CFX_DIBSource {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   ~CFX_DIBitmap() override;
 
@@ -26,7 +26,7 @@
               uint8_t* pBuffer = nullptr,
               uint32_t pitch = 0);
 
-  bool Copy(const CFX_RetainPtr<CFX_DIBSource>& pSrc);
+  bool Copy(const RetainPtr<CFX_DIBSource>& pSrc);
 
   // CFX_DIBSource
   uint8_t* GetBuffer() const override;
@@ -39,7 +39,7 @@
                           int clip_left,
                           int clip_width) const override;
 
-  void TakeOver(CFX_RetainPtr<CFX_DIBitmap>&& pSrcBitmap);
+  void TakeOver(RetainPtr<CFX_DIBitmap>&& pSrcBitmap);
   bool ConvertFormat(FXDIB_Format format);
   void Clear(uint32_t color);
 
@@ -47,18 +47,18 @@
   void SetPixel(int x, int y, uint32_t color);
 
   bool LoadChannel(FXDIB_Channel destChannel,
-                   const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                   const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                    FXDIB_Channel srcChannel);
   bool LoadChannel(FXDIB_Channel destChannel, int value);
 
   bool MultiplyAlpha(int alpha);
-  bool MultiplyAlpha(const CFX_RetainPtr<CFX_DIBSource>& pAlphaMask);
+  bool MultiplyAlpha(const RetainPtr<CFX_DIBSource>& pAlphaMask);
 
   bool TransferBitmap(int dest_left,
                       int dest_top,
                       int width,
                       int height,
-                      const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                      const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                       int src_left,
                       int src_top);
 
@@ -66,7 +66,7 @@
                        int dest_top,
                        int width,
                        int height,
-                       const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                       const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                        int src_left,
                        int src_top,
                        int blend_type = FXDIB_BLEND_NORMAL,
@@ -77,7 +77,7 @@
                      int dest_top,
                      int width,
                      int height,
-                     const CFX_RetainPtr<CFX_DIBSource>& pMask,
+                     const RetainPtr<CFX_DIBSource>& pMask,
                      uint32_t color,
                      int src_left,
                      int src_top,
diff --git a/core/fxge/dib/cfx_dibsource.cpp b/core/fxge/dib/cfx_dibsource.cpp
index c0e7841..9382917 100644
--- a/core/fxge/dib/cfx_dibsource.cpp
+++ b/core/fxge/dib/cfx_dibsource.cpp
@@ -24,7 +24,7 @@
 
 class CFX_Palette {
  public:
-  explicit CFX_Palette(const CFX_RetainPtr<CFX_DIBSource>& pBitmap);
+  explicit CFX_Palette(const RetainPtr<CFX_DIBSource>& pBitmap);
   ~CFX_Palette();
 
   const uint32_t* GetPalette() { return m_Palette.data(); }
@@ -64,7 +64,7 @@
   }
 }
 
-CFX_Palette::CFX_Palette(const CFX_RetainPtr<CFX_DIBSource>& pBitmap)
+CFX_Palette::CFX_Palette(const RetainPtr<CFX_DIBSource>& pBitmap)
     : m_Palette(256), m_Luts(4096), m_lut(0) {
   int bpp = pBitmap->GetBPP() / 8;
   int width = pBitmap->GetWidth();
@@ -102,7 +102,7 @@
                                  int dest_pitch,
                                  int width,
                                  int height,
-                                 const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                 const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                  int src_left,
                                  int src_top) {
   uint8_t set_gray, reset_gray;
@@ -126,7 +126,7 @@
                                  int dest_pitch,
                                  int width,
                                  int height,
-                                 const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                 const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                  int src_left,
                                  int src_top) {
   for (int row = 0; row < height; row++) {
@@ -141,7 +141,7 @@
                                 int dest_pitch,
                                 int width,
                                 int height,
-                                const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                 int src_left,
                                 int src_top) {
   uint32_t* src_plt = pSrcBitmap->GetPalette();
@@ -188,7 +188,7 @@
                                 int dest_pitch,
                                 int width,
                                 int height,
-                                const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                 int src_left,
                                 int src_top) {
   uint32_t* src_plt = pSrcBitmap->GetPalette();
@@ -220,14 +220,13 @@
   return true;
 }
 
-bool ConvertBuffer_RgbOrCmyk2Gray(
-    uint8_t* dest_buf,
-    int dest_pitch,
-    int width,
-    int height,
-    const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
-    int src_left,
-    int src_top) {
+bool ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf,
+                                  int dest_pitch,
+                                  int width,
+                                  int height,
+                                  const RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                  int src_left,
+                                  int src_top) {
   int Bpp = pSrcBitmap->GetBPP() / 8;
   if (pSrcBitmap->IsCmykImage()) {
     for (int row = 0; row < height; row++) {
@@ -265,7 +264,7 @@
                              int dest_pitch,
                              int width,
                              int height,
-                             const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                             const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                              int src_left,
                              int src_top) {
   if (pSrcBitmap->GetBPP() == 1) {
@@ -296,7 +295,7 @@
                                int dest_pitch,
                                int width,
                                int height,
-                               const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                               const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                int src_left,
                                int src_top,
                                uint32_t* dst_plt) {
@@ -324,7 +323,7 @@
                                int dest_pitch,
                                int width,
                                int height,
-                               const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                               const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                int src_left,
                                int src_top,
                                uint32_t* dst_plt) {
@@ -387,7 +386,7 @@
                                 int dest_pitch,
                                 int width,
                                 int height,
-                                const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                 int src_left,
                                 int src_top) {
   int comps = (dst_format & 0xff) / 8;
@@ -418,7 +417,7 @@
                                 int dest_pitch,
                                 int width,
                                 int height,
-                                const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                 int src_left,
                                 int src_top) {
   int comps = (dst_format & 0xff) / 8;
@@ -442,7 +441,7 @@
                                int dest_pitch,
                                int width,
                                int height,
-                               const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                               const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                int src_left,
                                int src_top) {
   int comps = (dst_format & 0xff) / 8;
@@ -494,7 +493,7 @@
                                int dest_pitch,
                                int width,
                                int height,
-                               const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                               const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                int src_left,
                                int src_top) {
   int comps = (dst_format & 0xff) / 8;
@@ -534,14 +533,13 @@
   return true;
 }
 
-bool ConvertBuffer_24bppRgb2Rgb24(
-    uint8_t* dest_buf,
-    int dest_pitch,
-    int width,
-    int height,
-    const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
-    int src_left,
-    int src_top) {
+bool ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf,
+                                  int dest_pitch,
+                                  int width,
+                                  int height,
+                                  const RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                  int src_left,
+                                  int src_top) {
   for (int row = 0; row < height; row++) {
     uint8_t* dest_scan = dest_buf + row * dest_pitch;
     const uint8_t* src_scan =
@@ -551,14 +549,13 @@
   return true;
 }
 
-bool ConvertBuffer_32bppRgb2Rgb24(
-    uint8_t* dest_buf,
-    int dest_pitch,
-    int width,
-    int height,
-    const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
-    int src_left,
-    int src_top) {
+bool ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf,
+                                  int dest_pitch,
+                                  int width,
+                                  int height,
+                                  const RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                  int src_left,
+                                  int src_top) {
   for (int row = 0; row < height; row++) {
     uint8_t* dest_scan = dest_buf + row * dest_pitch;
     const uint8_t* src_scan =
@@ -577,7 +574,7 @@
                              int dest_pitch,
                              int width,
                              int height,
-                             const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                             const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                              int src_left,
                              int src_top) {
   int comps = pSrcBitmap->GetBPP() / 8;
@@ -596,14 +593,13 @@
   return true;
 }
 
-bool ConvertBuffer_32bppCmyk2Rgb32(
-    uint8_t* dest_buf,
-    int dest_pitch,
-    int width,
-    int height,
-    const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
-    int src_left,
-    int src_top) {
+bool ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf,
+                                   int dest_pitch,
+                                   int width,
+                                   int height,
+                                   const RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                   int src_left,
+                                   int src_top) {
   for (int row = 0; row < height; row++) {
     uint8_t* dest_scan = dest_buf + row * dest_pitch;
     const uint8_t* src_scan =
@@ -633,7 +629,7 @@
   return false;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::Clone(const FX_RECT* pClip) const {
+RetainPtr<CFX_DIBitmap> CFX_DIBSource::Clone(const FX_RECT* pClip) const {
   FX_RECT rect(0, 0, m_Width, m_Height);
   if (pClip) {
     rect.Intersect(*pClip);
@@ -829,7 +825,7 @@
   }
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneAlphaMask() const {
+RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneAlphaMask() const {
   ASSERT(GetFormat() == FXDIB_Argb);
   FX_RECT rect(0, 0, m_Width, m_Height);
   auto pMask = pdfium::MakeRetain<CFX_DIBitmap>();
@@ -848,7 +844,7 @@
   return pMask;
 }
 
-bool CFX_DIBSource::SetAlphaMask(const CFX_RetainPtr<CFX_DIBSource>& pAlphaMask,
+bool CFX_DIBSource::SetAlphaMask(const RetainPtr<CFX_DIBSource>& pAlphaMask,
                                  const FX_RECT* pClip) {
   if (!HasAlpha() || GetFormat() == FXDIB_Argb)
     return false;
@@ -876,8 +872,8 @@
   return true;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::FlipImage(bool bXFlip,
-                                                     bool bYFlip) const {
+RetainPtr<CFX_DIBitmap> CFX_DIBSource::FlipImage(bool bXFlip,
+                                                 bool bYFlip) const {
   auto pFlipped = pdfium::MakeRetain<CFX_DIBitmap>();
   if (!pFlipped->Create(m_Width, m_Height, GetFormat()))
     return nullptr;
@@ -948,8 +944,7 @@
   return pFlipped;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(
-    FXDIB_Format dest_format) {
+RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) {
   if (dest_format == GetFormat())
     return Clone(nullptr);
 
@@ -957,7 +952,7 @@
   if (!pClone->Create(m_Width, m_Height, dest_format))
     return nullptr;
 
-  CFX_RetainPtr<CFX_DIBitmap> pSrcAlpha;
+  RetainPtr<CFX_DIBitmap> pSrcAlpha;
   if (HasAlpha()) {
     if (GetFormat() == FXDIB_Argb)
       pSrcAlpha = CloneAlphaMask();
@@ -979,7 +974,7 @@
   if (!ret)
     return nullptr;
 
-  CFX_RetainPtr<CFX_DIBSource> holder(this);
+  RetainPtr<CFX_DIBSource> holder(this);
   std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp;
   if (!ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(),
                      m_Width, m_Height, holder, 0, 0, &pal_8bpp)) {
@@ -991,8 +986,7 @@
   return pClone;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY(bool bXFlip,
-                                                  bool bYFlip) const {
+RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY(bool bXFlip, bool bYFlip) const {
   FX_RECT dest_clip(0, 0, m_Height, m_Width);
   if (dest_clip.IsEmpty())
     return nullptr;
@@ -1086,11 +1080,11 @@
   return pTransBitmap;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::TransformTo(
+RetainPtr<CFX_DIBitmap> CFX_DIBSource::TransformTo(
     const CFX_Matrix* pDestMatrix,
     int* result_left,
     int* result_top) {
-  CFX_RetainPtr<CFX_DIBSource> holder(this);
+  RetainPtr<CFX_DIBSource> holder(this);
   CFX_ImageTransformer transformer(holder, pDestMatrix, 0, nullptr);
   transformer.Continue(nullptr);
   *result_left = transformer.result().left;
@@ -1098,11 +1092,11 @@
   return transformer.DetachBitmap();
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::StretchTo(int dest_width,
-                                                     int dest_height,
-                                                     uint32_t flags,
-                                                     const FX_RECT* pClip) {
-  CFX_RetainPtr<CFX_DIBSource> holder(this);
+RetainPtr<CFX_DIBitmap> CFX_DIBSource::StretchTo(int dest_width,
+                                                 int dest_height,
+                                                 uint32_t flags,
+                                                 const FX_RECT* pClip) {
+  RetainPtr<CFX_DIBSource> holder(this);
   FX_RECT clip_rect(0, 0, abs(dest_width), abs(dest_height));
   if (pClip)
     clip_rect.Intersect(*pClip);
@@ -1129,7 +1123,7 @@
     int dest_pitch,
     int width,
     int height,
-    const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+    const RetainPtr<CFX_DIBSource>& pSrcBitmap,
     int src_left,
     int src_top,
     std::unique_ptr<uint32_t, FxFreeDeleter>* p_pal) {
diff --git a/core/fxge/dib/cfx_dibsource.h b/core/fxge/dib/cfx_dibsource.h
index 2315318..e2cdfa6 100644
--- a/core/fxge/dib/cfx_dibsource.h
+++ b/core/fxge/dib/cfx_dibsource.h
@@ -9,9 +9,9 @@
 
 #include <memory>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/fx_memory.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/fx_dib.h"
 
 enum FXDIB_Channel {
@@ -29,7 +29,7 @@
 class CFX_DIBitmap;
 class IFX_PauseIndicator;
 
-class CFX_DIBSource : public CFX_Retainable {
+class CFX_DIBSource : public Retainable {
  public:
   ~CFX_DIBSource() override;
 
@@ -72,22 +72,22 @@
   // Copies into internally-owned palette.
   void SetPalette(const uint32_t* pSrcPal);
 
-  CFX_RetainPtr<CFX_DIBitmap> Clone(const FX_RECT* pClip) const;
-  CFX_RetainPtr<CFX_DIBitmap> CloneConvert(FXDIB_Format format);
-  CFX_RetainPtr<CFX_DIBitmap> StretchTo(int dest_width,
-                                        int dest_height,
-                                        uint32_t flags,
-                                        const FX_RECT* pClip);
-  CFX_RetainPtr<CFX_DIBitmap> TransformTo(const CFX_Matrix* pMatrix,
-                                          int* left,
-                                          int* top);
-  CFX_RetainPtr<CFX_DIBitmap> SwapXY(bool bXFlip, bool bYFlip) const;
-  CFX_RetainPtr<CFX_DIBitmap> FlipImage(bool bXFlip, bool bYFlip) const;
+  RetainPtr<CFX_DIBitmap> Clone(const FX_RECT* pClip) const;
+  RetainPtr<CFX_DIBitmap> CloneConvert(FXDIB_Format format);
+  RetainPtr<CFX_DIBitmap> StretchTo(int dest_width,
+                                    int dest_height,
+                                    uint32_t flags,
+                                    const FX_RECT* pClip);
+  RetainPtr<CFX_DIBitmap> TransformTo(const CFX_Matrix* pMatrix,
+                                      int* left,
+                                      int* top);
+  RetainPtr<CFX_DIBitmap> SwapXY(bool bXFlip, bool bYFlip) const;
+  RetainPtr<CFX_DIBitmap> FlipImage(bool bXFlip, bool bYFlip) const;
 
-  CFX_RetainPtr<CFX_DIBitmap> CloneAlphaMask() const;
+  RetainPtr<CFX_DIBitmap> CloneAlphaMask() const;
 
   // Copies into internally-owned mask.
-  bool SetAlphaMask(const CFX_RetainPtr<CFX_DIBSource>& pAlphaMask,
+  bool SetAlphaMask(const RetainPtr<CFX_DIBSource>& pAlphaMask,
                     const FX_RECT* pClip);
 
   void GetOverlapRect(int& dest_left,
@@ -104,7 +104,7 @@
   void DebugVerifyBitmapIsPreMultiplied(void* buffer) const;
 #endif
 
-  CFX_RetainPtr<CFX_DIBitmap> m_pAlphaMask;
+  RetainPtr<CFX_DIBitmap> m_pAlphaMask;
 
  protected:
   CFX_DIBSource();
@@ -114,7 +114,7 @@
                             int dest_pitch,
                             int width,
                             int height,
-                            const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                            const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                             int src_left,
                             int src_top,
                             std::unique_ptr<uint32_t, FxFreeDeleter>* pal);
diff --git a/core/fxge/dib/cfx_filtereddib.cpp b/core/fxge/dib/cfx_filtereddib.cpp
index 2d6edd0..96fc806 100644
--- a/core/fxge/dib/cfx_filtereddib.cpp
+++ b/core/fxge/dib/cfx_filtereddib.cpp
@@ -12,7 +12,7 @@
 
 CFX_FilteredDIB::~CFX_FilteredDIB() {}
 
-void CFX_FilteredDIB::LoadSrc(const CFX_RetainPtr<CFX_DIBSource>& pSrc) {
+void CFX_FilteredDIB::LoadSrc(const RetainPtr<CFX_DIBSource>& pSrc) {
   m_pSrc = pSrc;
   m_Width = pSrc->GetWidth();
   m_Height = pSrc->GetHeight();
diff --git a/core/fxge/dib/cfx_filtereddib.h b/core/fxge/dib/cfx_filtereddib.h
index 3a16bb0..e998c71 100644
--- a/core/fxge/dib/cfx_filtereddib.h
+++ b/core/fxge/dib/cfx_filtereddib.h
@@ -9,13 +9,13 @@
 
 #include <vector>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/dib/cfx_dibsource.h"
 
 class CFX_FilteredDIB : public CFX_DIBSource {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   ~CFX_FilteredDIB() override;
 
@@ -28,7 +28,7 @@
                                     int pixels,
                                     int Bpp) const = 0;
 
-  void LoadSrc(const CFX_RetainPtr<CFX_DIBSource>& pSrc);
+  void LoadSrc(const RetainPtr<CFX_DIBSource>& pSrc);
 
  protected:
   CFX_FilteredDIB();
@@ -43,7 +43,7 @@
                           int clip_left,
                           int clip_width) const override;
 
-  CFX_RetainPtr<CFX_DIBSource> m_pSrc;
+  RetainPtr<CFX_DIBSource> m_pSrc;
   mutable std::vector<uint8_t> m_Scanline;
 };
 
diff --git a/core/fxge/dib/cfx_imagerenderer.cpp b/core/fxge/dib/cfx_imagerenderer.cpp
index 2330fe0..658d363 100644
--- a/core/fxge/dib/cfx_imagerenderer.cpp
+++ b/core/fxge/dib/cfx_imagerenderer.cpp
@@ -13,15 +13,14 @@
 #include "core/fxge/dib/cfx_imagetransformer.h"
 #include "third_party/base/ptr_util.h"
 
-CFX_ImageRenderer::CFX_ImageRenderer(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
-    const CFX_ClipRgn* pClipRgn,
-    const CFX_RetainPtr<CFX_DIBSource>& pSource,
-    int bitmap_alpha,
-    uint32_t mask_color,
-    const CFX_Matrix* pMatrix,
-    uint32_t dib_flags,
-    bool bRgbByteOrder)
+CFX_ImageRenderer::CFX_ImageRenderer(const RetainPtr<CFX_DIBitmap>& pDevice,
+                                     const CFX_ClipRgn* pClipRgn,
+                                     const RetainPtr<CFX_DIBSource>& pSource,
+                                     int bitmap_alpha,
+                                     uint32_t mask_color,
+                                     const CFX_Matrix* pMatrix,
+                                     uint32_t dib_flags,
+                                     bool bRgbByteOrder)
     : m_pDevice(pDevice),
       m_pClipRgn(pClipRgn),
       m_Matrix(*pMatrix),
@@ -96,7 +95,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 || !pBitmap->GetBuffer())
     return false;
 
diff --git a/core/fxge/dib/cfx_imagerenderer.h b/core/fxge/dib/cfx_imagerenderer.h
index 068fe34..8a441fc 100644
--- a/core/fxge/dib/cfx_imagerenderer.h
+++ b/core/fxge/dib/cfx_imagerenderer.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"
 #include "core/fxge/dib/cfx_bitmapcomposer.h"
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "core/fxge/dib/cfx_dibsource.h"
@@ -23,9 +23,9 @@
 
 class CFX_ImageRenderer {
  public:
-  CFX_ImageRenderer(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
+  CFX_ImageRenderer(const RetainPtr<CFX_DIBitmap>& pDevice,
                     const CFX_ClipRgn* pClipRgn,
-                    const CFX_RetainPtr<CFX_DIBSource>& pSource,
+                    const RetainPtr<CFX_DIBSource>& pSource,
                     int bitmap_alpha,
                     uint32_t mask_color,
                     const CFX_Matrix* pMatrix,
@@ -36,7 +36,7 @@
   bool Continue(IFX_PauseIndicator* pPause);
 
  private:
-  const CFX_RetainPtr<CFX_DIBitmap> m_pDevice;
+  const RetainPtr<CFX_DIBitmap> m_pDevice;
   const CFX_UnownedPtr<const CFX_ClipRgn> m_pClipRgn;
   const CFX_Matrix m_Matrix;
   const int m_BitmapAlpha;
diff --git a/core/fxge/dib/cfx_imagestretcher.cpp b/core/fxge/dib/cfx_imagestretcher.cpp
index 0b7c542..03518c6 100644
--- a/core/fxge/dib/cfx_imagestretcher.cpp
+++ b/core/fxge/dib/cfx_imagestretcher.cpp
@@ -42,13 +42,12 @@
 
 }  // namespace
 
-CFX_ImageStretcher::CFX_ImageStretcher(
-    IFX_ScanlineComposer* pDest,
-    const CFX_RetainPtr<CFX_DIBSource>& pSource,
-    int dest_width,
-    int dest_height,
-    const FX_RECT& bitmap_rect,
-    uint32_t flags)
+CFX_ImageStretcher::CFX_ImageStretcher(IFX_ScanlineComposer* pDest,
+                                       const RetainPtr<CFX_DIBSource>& pSource,
+                                       int dest_width,
+                                       int dest_height,
+                                       const FX_RECT& bitmap_rect,
+                                       uint32_t flags)
     : m_pDest(pDest),
       m_pSource(pSource),
       m_Flags(flags),
diff --git a/core/fxge/dib/cfx_imagestretcher.h b/core/fxge/dib/cfx_imagestretcher.h
index 8441101..5c696b7 100644
--- a/core/fxge/dib/cfx_imagestretcher.h
+++ b/core/fxge/dib/cfx_imagestretcher.h
@@ -9,10 +9,10 @@
 
 #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/fx_memory.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/dib/ifx_scanlinecomposer.h"
 #include "core/fxge/fx_dib.h"
 
@@ -22,7 +22,7 @@
 class CFX_ImageStretcher {
  public:
   CFX_ImageStretcher(IFX_ScanlineComposer* pDest,
-                     const CFX_RetainPtr<CFX_DIBSource>& pSource,
+                     const RetainPtr<CFX_DIBSource>& pSource,
                      int dest_width,
                      int dest_height,
                      const FX_RECT& bitmap_rect,
@@ -32,7 +32,7 @@
   bool Start();
   bool Continue(IFX_PauseIndicator* pPause);
 
-  CFX_RetainPtr<CFX_DIBSource> source() { return m_pSource; }
+  RetainPtr<CFX_DIBSource> source() { return m_pSource; }
 
  private:
   bool StartQuickStretch();
@@ -41,7 +41,7 @@
   bool ContinueStretch(IFX_PauseIndicator* pPause);
 
   CFX_UnownedPtr<IFX_ScanlineComposer> const m_pDest;
-  CFX_RetainPtr<CFX_DIBSource> m_pSource;
+  RetainPtr<CFX_DIBSource> m_pSource;
   std::unique_ptr<CStretchEngine> m_pStretchEngine;
   std::unique_ptr<uint8_t, FxFreeDeleter> m_pScanline;
   std::unique_ptr<uint8_t, FxFreeDeleter> m_pMaskScanline;
diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp
index e64a264..51b7535 100644
--- a/core/fxge/dib/cfx_imagetransformer.cpp
+++ b/core/fxge/dib/cfx_imagetransformer.cpp
@@ -101,7 +101,7 @@
   v_w[3] = SDP_Table[512 - res_y];
 }
 
-FXDIB_Format GetTransformedFormat(const CFX_RetainPtr<CFX_DIBSource>& pDrc) {
+FXDIB_Format GetTransformedFormat(const RetainPtr<CFX_DIBSource>& pDrc) {
   FXDIB_Format format = pDrc->GetFormat();
   if (pDrc->IsAlphaMask()) {
     format = FXDIB_8bppMask;
@@ -177,11 +177,10 @@
 
 }  // namespace
 
-CFX_ImageTransformer::CFX_ImageTransformer(
-    const CFX_RetainPtr<CFX_DIBSource>& pSrc,
-    const CFX_Matrix* pMatrix,
-    int flags,
-    const FX_RECT* pClip)
+CFX_ImageTransformer::CFX_ImageTransformer(const RetainPtr<CFX_DIBSource>& pSrc,
+                                           const CFX_Matrix* pMatrix,
+                                           int flags,
+                                           const FX_RECT* pClip)
     : m_pSrc(pSrc),
       m_pMatrix(pMatrix),
       m_pClip(pClip),
@@ -818,6 +817,6 @@
   return false;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() {
+RetainPtr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() {
   return m_Storer.Detach();
 }
diff --git a/core/fxge/dib/cfx_imagetransformer.h b/core/fxge/dib/cfx_imagetransformer.h
index 0524a0c..65c8745 100644
--- a/core/fxge/dib/cfx_imagetransformer.h
+++ b/core/fxge/dib/cfx_imagetransformer.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"
 #include "core/fxge/dib/cfx_bitmapstorer.h"
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "core/fxge/dib/cfx_dibsource.h"
@@ -20,7 +20,7 @@
 
 class CFX_ImageTransformer {
  public:
-  CFX_ImageTransformer(const CFX_RetainPtr<CFX_DIBSource>& pSrc,
+  CFX_ImageTransformer(const RetainPtr<CFX_DIBSource>& pSrc,
                        const CFX_Matrix* pMatrix,
                        int flags,
                        const FX_RECT* pClip);
@@ -29,10 +29,10 @@
   bool Continue(IFX_PauseIndicator* pPause);
 
   const FX_RECT& result() const { return m_result; }
-  CFX_RetainPtr<CFX_DIBitmap> DetachBitmap();
+  RetainPtr<CFX_DIBitmap> DetachBitmap();
 
  private:
-  const CFX_RetainPtr<CFX_DIBSource> m_pSrc;
+  const RetainPtr<CFX_DIBSource> m_pSrc;
   CFX_UnownedPtr<const CFX_Matrix> const m_pMatrix;
   const FX_RECT* const m_pClip;
   FX_RECT m_StretchClip;
diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp
index 4822d32..6803959 100644
--- a/core/fxge/dib/cstretchengine.cpp
+++ b/core/fxge/dib/cstretchengine.cpp
@@ -222,7 +222,7 @@
                                int dest_width,
                                int dest_height,
                                const FX_RECT& clip_rect,
-                               const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                               const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                int flags) {
   m_State = 0;
   m_DestFormat = dest_format;
diff --git a/core/fxge/dib/cstretchengine.h b/core/fxge/dib/cstretchengine.h
index 14c0975..bdf7900 100644
--- a/core/fxge/dib/cstretchengine.h
+++ b/core/fxge/dib/cstretchengine.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"
 #include "core/fxge/fx_dib.h"
 
 class IFX_PauseIndicator;
@@ -24,7 +24,7 @@
                  int dest_width,
                  int dest_height,
                  const FX_RECT& clip_rect,
-                 const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                 const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                  int flags);
   ~CStretchEngine();
 
@@ -68,7 +68,7 @@
   std::vector<uint8_t> m_DestScanline;
   std::vector<uint8_t> m_DestMaskScanline;
   FX_RECT m_SrcClip;
-  CFX_RetainPtr<CFX_DIBSource> m_pSource;
+  RetainPtr<CFX_DIBSource> m_pSource;
   uint32_t* m_pSrcPalette;
   int m_SrcWidth;
   int m_SrcHeight;
diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h
index 021efee..89cda1e 100644
--- a/core/fxge/fx_font.h
+++ b/core/fxge/fx_font.h
@@ -100,8 +100,7 @@
   CFX_SubstFont* GetSubstFont() const { return m_pSubstFont.get(); }
 
 #ifdef PDF_ENABLE_XFA
-  bool LoadFile(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
-                int nFaceIndex);
+  bool LoadFile(const RetainPtr<IFX_SeekableReadStream>& pFile, int nFaceIndex);
 
   bool LoadClone(const CFX_Font* pFont);
   void SetFace(FXFT_Face face);
@@ -205,7 +204,7 @@
 
   int m_Top;
   int m_Left;
-  CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+  RetainPtr<CFX_DIBitmap> m_pBitmap;
 };
 
 inline CFX_GlyphBitmap::CFX_GlyphBitmap()
diff --git a/core/fxge/ifx_renderdevicedriver.cpp b/core/fxge/ifx_renderdevicedriver.cpp
index 378c9b8..669aadf 100644
--- a/core/fxge/ifx_renderdevicedriver.cpp
+++ b/core/fxge/ifx_renderdevicedriver.cpp
@@ -46,15 +46,14 @@
   return false;
 }
 
-bool IFX_RenderDeviceDriver::GetDIBits(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
-    int left,
-    int top) {
+bool IFX_RenderDeviceDriver::GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
+                                       int left,
+                                       int top) {
   return false;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> IFX_RenderDeviceDriver::GetBackDrop() {
-  return CFX_RetainPtr<CFX_DIBitmap>();
+RetainPtr<CFX_DIBitmap> IFX_RenderDeviceDriver::GetBackDrop() {
+  return RetainPtr<CFX_DIBitmap>();
 }
 
 bool IFX_RenderDeviceDriver::ContinueDIBits(CFX_ImageRenderer* handle,
@@ -86,8 +85,8 @@
 }
 
 bool IFX_RenderDeviceDriver::SetBitsWithMask(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-    const CFX_RetainPtr<CFX_DIBSource>& pMask,
+    const RetainPtr<CFX_DIBSource>& pBitmap,
+    const RetainPtr<CFX_DIBSource>& pMask,
     int left,
     int top,
     int bitmap_alpha,
diff --git a/core/fxge/ifx_renderdevicedriver.h b/core/fxge/ifx_renderdevicedriver.h
index cdea22e..e9498bd 100644
--- a/core/fxge/ifx_renderdevicedriver.h
+++ b/core/fxge/ifx_renderdevicedriver.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 CFX_DIBSource;
@@ -60,17 +60,17 @@
                                 int blend_type);
 
   virtual bool GetClipBox(FX_RECT* pRect) = 0;
-  virtual bool GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+  virtual bool GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
                          int left,
                          int top);
-  virtual CFX_RetainPtr<CFX_DIBitmap> GetBackDrop();
-  virtual bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  virtual RetainPtr<CFX_DIBitmap> GetBackDrop();
+  virtual bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                          uint32_t color,
                          const FX_RECT* pSrcRect,
                          int dest_left,
                          int dest_top,
                          int blend_type) = 0;
-  virtual bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  virtual bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                              uint32_t color,
                              int dest_left,
                              int dest_top,
@@ -79,7 +79,7 @@
                              const FX_RECT* pClipRect,
                              uint32_t flags,
                              int blend_type) = 0;
-  virtual bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  virtual bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                            int bitmap_alpha,
                            uint32_t color,
                            const CFX_Matrix* pMatrix,
@@ -101,8 +101,8 @@
                            const FX_RECT& clip_rect,
                            int alpha,
                            bool bAlphaMode);
-  virtual bool SetBitsWithMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-                               const CFX_RetainPtr<CFX_DIBSource>& pMask,
+  virtual bool SetBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap,
+                               const RetainPtr<CFX_DIBSource>& pMask,
                                int left,
                                int top,
                                int bitmap_alpha,
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 8ca7808..fe9fd1a 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -54,12 +54,12 @@
 namespace {
 
 #ifdef _SKIA_SUPPORT_PATHS_
-void RgbByteOrderTransferBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+void RgbByteOrderTransferBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap,
                                 int dest_left,
                                 int dest_top,
                                 int width,
                                 int height,
-                                const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+                                const RetainPtr<CFX_DIBSource>& pSrcBitmap,
                                 int src_left,
                                 int src_top) {
   if (!pBitmap)
@@ -262,8 +262,8 @@
 #endif  // DRAW_SKIA_CLIP
 
 #ifdef _SKIA_SUPPORT_
-static void DebugValidate(const CFX_RetainPtr<CFX_DIBitmap>& bitmap,
-                          const CFX_RetainPtr<CFX_DIBitmap>& device) {
+static void DebugValidate(const RetainPtr<CFX_DIBitmap>& bitmap,
+                          const RetainPtr<CFX_DIBitmap>& device) {
   if (bitmap) {
     SkASSERT(bitmap->GetBPP() == 8 || bitmap->GetBPP() == 32);
     if (bitmap->GetBPP() == 32) {
@@ -564,7 +564,7 @@
   paint->setAlpha(bitmap_alpha);
 }
 
-bool Upsample(const CFX_RetainPtr<CFX_DIBSource>& pSource,
+bool Upsample(const RetainPtr<CFX_DIBSource>& pSource,
               std::unique_ptr<uint8_t, FxFreeDeleter>& dst8Storage,
               std::unique_ptr<uint32_t, FxFreeDeleter>& dst32Storage,
               SkBitmap* skBitmap,
@@ -1492,9 +1492,9 @@
 }
 
 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+    const RetainPtr<CFX_DIBitmap>& pBitmap,
     bool bRgbByteOrder,
-    const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
+    const RetainPtr<CFX_DIBitmap>& pOriDevice,
     bool bGroupKnockout)
     : m_pBitmap(pBitmap),
       m_pOriDevice(pOriDevice),
@@ -2179,7 +2179,7 @@
   return true;
 }
 
-bool CFX_SkiaDeviceDriver::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+bool CFX_SkiaDeviceDriver::GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
                                      int left,
                                      int top) {
   if (!m_pBitmap)
@@ -2216,7 +2216,7 @@
   m_pBitmap->UnPreMultiply();
   FX_RECT rect(left, top, left + pBitmap->GetWidth(),
                top + pBitmap->GetHeight());
-  CFX_RetainPtr<CFX_DIBitmap> pBack;
+  RetainPtr<CFX_DIBitmap> pBack;
   if (m_pOriDevice) {
     pBack = m_pOriDevice->Clone(&rect);
     if (!pBack)
@@ -2244,17 +2244,16 @@
 #endif  // _SKIA_SUPPORT_PATHS_
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_SkiaDeviceDriver::GetBackDrop() {
+RetainPtr<CFX_DIBitmap> CFX_SkiaDeviceDriver::GetBackDrop() {
   return m_pOriDevice;
 }
 
-bool CFX_SkiaDeviceDriver::SetDIBits(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-    uint32_t argb,
-    const FX_RECT* pSrcRect,
-    int left,
-    int top,
-    int blend_type) {
+bool CFX_SkiaDeviceDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
+                                     uint32_t argb,
+                                     const FX_RECT* pSrcRect,
+                                     int left,
+                                     int top,
+                                     int blend_type) {
   if (!m_pBitmap || !m_pBitmap->GetBuffer())
     return true;
 
@@ -2280,7 +2279,7 @@
 }
 
 bool CFX_SkiaDeviceDriver::StretchDIBits(
-    const CFX_RetainPtr<CFX_DIBSource>& pSource,
+    const RetainPtr<CFX_DIBSource>& pSource,
     uint32_t argb,
     int dest_left,
     int dest_top,
@@ -2332,7 +2331,7 @@
 }
 
 bool CFX_SkiaDeviceDriver::StartDIBits(
-    const CFX_RetainPtr<CFX_DIBSource>& pSource,
+    const RetainPtr<CFX_DIBSource>& pSource,
     int bitmap_alpha,
     uint32_t argb,
     const CFX_Matrix* pMatrix,
@@ -2408,7 +2407,7 @@
 
 #if defined _SKIA_SUPPORT_
 void CFX_SkiaDeviceDriver::PreMultiply(
-    const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) {
+    const RetainPtr<CFX_DIBitmap>& pDIBitmap) {
   pDIBitmap->PreMultiply();
 }
 #endif  // _SKIA_SUPPORT_
@@ -2465,8 +2464,8 @@
 
 #ifdef _SKIA_SUPPORT_
 bool CFX_SkiaDeviceDriver::DrawBitsWithMask(
-    const CFX_RetainPtr<CFX_DIBSource>& pSource,
-    const CFX_RetainPtr<CFX_DIBSource>& pMask,
+    const RetainPtr<CFX_DIBSource>& pSource,
+    const RetainPtr<CFX_DIBSource>& pMask,
     int bitmap_alpha,
     const CFX_Matrix* pMatrix,
     int blend_type) {
@@ -2506,8 +2505,8 @@
 }
 
 bool CFX_SkiaDeviceDriver::SetBitsWithMask(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-    const CFX_RetainPtr<CFX_DIBSource>& pMask,
+    const RetainPtr<CFX_DIBSource>& pBitmap,
+    const RetainPtr<CFX_DIBSource>& pMask,
     int dest_left,
     int dest_top,
     int bitmap_alpha,
@@ -2555,11 +2554,10 @@
 }
 #endif  // _SKIA_SUPPORT_
 
-bool CFX_DefaultRenderDevice::Attach(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
-    bool bRgbByteOrder,
-    const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
-    bool bGroupKnockout) {
+bool CFX_DefaultRenderDevice::Attach(const RetainPtr<CFX_DIBitmap>& pBitmap,
+                                     bool bRgbByteOrder,
+                                     const RetainPtr<CFX_DIBitmap>& pOriDevice,
+                                     bool bGroupKnockout) {
   if (!pBitmap)
     return false;
   SetBitmap(pBitmap);
@@ -2581,7 +2579,7 @@
     int width,
     int height,
     FXDIB_Format format,
-    const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice) {
+    const RetainPtr<CFX_DIBitmap>& pOriDevice) {
   auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
   if (!pBitmap->Create(width, height, format)) {
     return false;
@@ -2607,8 +2605,8 @@
 }
 
 bool CFX_DefaultRenderDevice::SetBitsWithMask(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-    const CFX_RetainPtr<CFX_DIBSource>& pMask,
+    const RetainPtr<CFX_DIBSource>& pBitmap,
+    const RetainPtr<CFX_DIBSource>& pMask,
     int left,
     int top,
     int bitmap_alpha,
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index df28479..7dcf362 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -24,9 +24,9 @@
 
 class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
  public:
-  CFX_SkiaDeviceDriver(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+  CFX_SkiaDeviceDriver(const RetainPtr<CFX_DIBitmap>& pBitmap,
                        bool bRgbByteOrder,
-                       const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
+                       const RetainPtr<CFX_DIBitmap>& pOriDevice,
                        bool bGroupKnockout);
 #ifdef _SKIA_SUPPORT_
   explicit CFX_SkiaDeviceDriver(SkPictureRecorder* recorder);
@@ -77,21 +77,21 @@
   bool GetClipBox(FX_RECT* pRect) override;
 
   /** Load device buffer into a DIB */
-  bool GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+  bool GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
                  int left,
                  int top) override;
 
-  CFX_RetainPtr<CFX_DIBitmap> GetBackDrop() override;
+  RetainPtr<CFX_DIBitmap> GetBackDrop() override;
 
-  bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                  uint32_t color,
                  const FX_RECT* pSrcRect,
                  int dest_left,
                  int dest_top,
                  int blend_type) override;
 #ifdef _SKIA_SUPPORT_
-  bool SetBitsWithMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-                       const CFX_RetainPtr<CFX_DIBSource>& pMask,
+  bool SetBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap,
+                       const RetainPtr<CFX_DIBSource>& pMask,
                        int dest_left,
                        int dest_top,
                        int bitmap_alpha,
@@ -102,7 +102,7 @@
   void SetClipMask(const FX_RECT& clipBox, const SkPath& skClipPath);
 #endif
 
-  bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                      uint32_t color,
                      int dest_left,
                      int dest_top,
@@ -112,7 +112,7 @@
                      uint32_t flags,
                      int blend_type) override;
 
-  bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                    int bitmap_alpha,
                    uint32_t color,
                    const CFX_Matrix* pMatrix,
@@ -123,8 +123,8 @@
   bool ContinueDIBits(CFX_ImageRenderer* handle,
                       IFX_PauseIndicator* pPause) override;
 
-  bool DrawBitsWithMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-                        const CFX_RetainPtr<CFX_DIBSource>& pMask,
+  bool DrawBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap,
+                        const RetainPtr<CFX_DIBSource>& pMask,
                         int bitmap_alpha,
                         const CFX_Matrix* pMatrix,
                         int blend_type);
@@ -151,7 +151,7 @@
   void Flush() override;
   SkPictureRecorder* GetRecorder() const { return m_pRecorder; }
   void PreMultiply() { m_pBitmap->PreMultiply(); }
-  static void PreMultiply(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap);
+  static void PreMultiply(const RetainPtr<CFX_DIBitmap>& pDIBitmap);
   SkCanvas* SkiaCanvas() { return m_pCanvas; }
   void DebugVerifyBitmapIsPreMultiplied() const;
   void Dump() const;
@@ -159,8 +159,8 @@
  private:
   friend class SkiaState;
 
-  CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
-  CFX_RetainPtr<CFX_DIBitmap> m_pOriDevice;
+  RetainPtr<CFX_DIBitmap> m_pBitmap;
+  RetainPtr<CFX_DIBitmap> m_pOriDevice;
   SkCanvas* m_pCanvas;
   SkPictureRecorder* const m_pRecorder;
   std::unique_ptr<SkiaState> m_pCache;
diff --git a/core/fxge/skia/fx_skia_device_unittest.cpp b/core/fxge/skia/fx_skia_device_unittest.cpp
index 94d9a0f..a959b6e 100644
--- a/core/fxge/skia/fx_skia_device_unittest.cpp
+++ b/core/fxge/skia/fx_skia_device_unittest.cpp
@@ -124,7 +124,7 @@
     return;
   FPDFBitmap_FillRect(bitmap, 0, 0, w, h, 0x00000000);
   CFX_DefaultRenderDevice geDevice;
-  CFX_RetainPtr<CFX_DIBitmap> pBitmap(CFXBitmapFromFPDFBitmap(bitmap));
+  RetainPtr<CFX_DIBitmap> pBitmap(CFXBitmapFromFPDFBitmap(bitmap));
   geDevice.Attach(pBitmap, false, nullptr, false);
   CFX_SkiaDeviceDriver* driver =
       static_cast<CFX_SkiaDeviceDriver*>(geDevice.GetDeviceDriver());
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index 7e21b25..4f79ef3 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -101,7 +101,7 @@
 
 CFX_PSRenderer::~CFX_PSRenderer() {}
 
-void CFX_PSRenderer::Init(const CFX_RetainPtr<IFX_WriteStream>& pStream,
+void CFX_PSRenderer::Init(const RetainPtr<IFX_WriteStream>& pStream,
                           int pslevel,
                           int width,
                           int height,
@@ -342,7 +342,7 @@
     m_pStream->WriteBlock(buf.str().c_str(), buf.tellp());
 }
 
-bool CFX_PSRenderer::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
+bool CFX_PSRenderer::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource,
                                uint32_t color,
                                int left,
                                int top) {
@@ -353,7 +353,7 @@
   return DrawDIBits(pSource, color, &matrix, 0);
 }
 
-bool CFX_PSRenderer::StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
+bool CFX_PSRenderer::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource,
                                    uint32_t color,
                                    int dest_left,
                                    int dest_top,
@@ -366,7 +366,7 @@
   return DrawDIBits(pSource, color, &matrix, flags);
 }
 
-bool CFX_PSRenderer::DrawDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
+bool CFX_PSRenderer::DrawDIBits(const RetainPtr<CFX_DIBSource>& pSource,
                                 uint32_t color,
                                 const CFX_Matrix* pMatrix,
                                 uint32_t flags) {
@@ -428,7 +428,7 @@
     output_buf.release();
   } else {
     CFX_DIBExtractor source_extractor(pSource);
-    CFX_RetainPtr<CFX_DIBSource> pConverted = source_extractor.GetBitmap();
+    RetainPtr<CFX_DIBSource> pConverted = source_extractor.GetBitmap();
     if (!pConverted)
       return false;
     switch (pSource->GetFormat()) {
diff --git a/core/fxge/win32/cfx_psrenderer.h b/core/fxge/win32/cfx_psrenderer.h
index 01a9001..33829ea 100644
--- a/core/fxge/win32/cfx_psrenderer.h
+++ b/core/fxge/win32/cfx_psrenderer.h
@@ -10,10 +10,10 @@
 #include <memory>
 #include <vector>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/fx_stream.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/cfx_graphstatedata.h"
 
 class CFX_DIBSource;
@@ -30,7 +30,7 @@
   CFX_PSRenderer();
   ~CFX_PSRenderer();
 
-  void Init(const CFX_RetainPtr<IFX_WriteStream>& stream,
+  void Init(const RetainPtr<IFX_WriteStream>& stream,
             int pslevel,
             int width,
             int height,
@@ -52,18 +52,18 @@
                 uint32_t fill_color,
                 uint32_t stroke_color,
                 int fill_mode);
-  bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                  uint32_t color,
                  int dest_left,
                  int dest_top);
-  bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                      uint32_t color,
                      int dest_left,
                      int dest_top,
                      int dest_width,
                      int dest_height,
                      uint32_t flags);
-  bool DrawDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool DrawDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                   uint32_t color,
                   const CFX_Matrix* pMatrix,
                   uint32_t flags);
@@ -86,7 +86,7 @@
                        int* ps_glyphindex);
   void WritePSBinary(const uint8_t* data, int len);
 
-  CFX_RetainPtr<IFX_WriteStream> m_pStream;
+  RetainPtr<IFX_WriteStream> m_pStream;
   int m_PSLevel;
   CFX_GraphStateData m_CurGraphState;
   bool m_bGraphStateSet;
diff --git a/core/fxge/win32/cfx_windowsdib.h b/core/fxge/win32/cfx_windowsdib.h
index 28f152a..cc23050 100644
--- a/core/fxge/win32/cfx_windowsdib.h
+++ b/core/fxge/win32/cfx_windowsdib.h
@@ -29,18 +29,17 @@
 class CFX_WindowsDIB : public CFX_DIBitmap {
  public:
   template <typename T, typename... Args>
-  friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
   ~CFX_WindowsDIB() override;
 
-  static ByteString GetBitmapInfo(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap);
-  static HBITMAP GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
-                             HDC hDC);
+  static ByteString GetBitmapInfo(const RetainPtr<CFX_DIBitmap>& pBitmap);
+  static HBITMAP GetDDBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, HDC hDC);
 
-  static CFX_RetainPtr<CFX_DIBitmap> LoadFromBuf(BITMAPINFO* pbmi, void* pData);
-  static CFX_RetainPtr<CFX_DIBitmap> LoadFromFile(const wchar_t* filename);
-  static CFX_RetainPtr<CFX_DIBitmap> LoadFromFile(const char* filename);
-  static CFX_RetainPtr<CFX_DIBitmap> LoadDIBitmap(WINDIB_Open_Args_ args);
+  static RetainPtr<CFX_DIBitmap> LoadFromBuf(BITMAPINFO* pbmi, void* pData);
+  static RetainPtr<CFX_DIBitmap> LoadFromFile(const wchar_t* filename);
+  static RetainPtr<CFX_DIBitmap> LoadFromFile(const char* filename);
+  static RetainPtr<CFX_DIBitmap> LoadDIBitmap(WINDIB_Open_Args_ args);
 
   HBITMAP GetWindowsBitmap() const { return m_hBitmap; }
 
diff --git a/core/fxge/win32/dwrite_int.h b/core/fxge/win32/dwrite_int.h
index 2d1deb6..7fbb929 100644
--- a/core/fxge/win32/dwrite_int.h
+++ b/core/fxge/win32/dwrite_int.h
@@ -43,7 +43,7 @@
   void* DwCreateFontFaceFromStream(uint8_t* pData,
                                    uint32_t size,
                                    int simulation_style);
-  bool DwCreateRenderingTarget(const CFX_RetainPtr<CFX_DIBitmap>& pSrc,
+  bool DwCreateRenderingTarget(const RetainPtr<CFX_DIBitmap>& pSrc,
                                void** renderTarget);
   void DwDeleteRenderingTarget(void* renderTarget);
   bool DwRendingString(void* renderTarget,
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index ac13266..41c3dc3 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -781,13 +781,12 @@
     SaveDC(m_hDC);
 }
 
-bool CGdiDeviceDriver::GDI_SetDIBits(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap1,
-    const FX_RECT* pSrcRect,
-    int left,
-    int top) {
+bool CGdiDeviceDriver::GDI_SetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap1,
+                                     const FX_RECT* pSrcRect,
+                                     int left,
+                                     int top) {
   if (m_DeviceClass == FXDC_PRINTER) {
-    CFX_RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1->FlipImage(false, true);
+    RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1->FlipImage(false, true);
     if (!pBitmap)
       return false;
 
@@ -806,7 +805,7 @@
                     dst_height, pBuffer, (BITMAPINFO*)info.c_str(),
                     DIB_RGB_COLORS, SRCCOPY);
   } else {
-    CFX_RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1;
+    RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1;
     if (pBitmap->IsCmykImage()) {
       pBitmap = pBitmap->CloneConvert(FXDIB_Rgb);
       if (!pBitmap)
@@ -824,13 +823,13 @@
 }
 
 bool CGdiDeviceDriver::GDI_StretchDIBits(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap1,
+    const RetainPtr<CFX_DIBitmap>& pBitmap1,
     int dest_left,
     int dest_top,
     int dest_width,
     int dest_height,
     uint32_t flags) {
-  CFX_RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1;
+  RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1;
   if (!pBitmap || dest_width == 0 || dest_height == 0)
     return false;
 
@@ -845,7 +844,7 @@
   } else {
     SetStretchBltMode(m_hDC, COLORONCOLOR);
   }
-  CFX_RetainPtr<CFX_DIBitmap> pToStrechBitmap = pBitmap;
+  RetainPtr<CFX_DIBitmap> pToStrechBitmap = pBitmap;
   if (m_DeviceClass == FXDC_PRINTER &&
       ((int64_t)pBitmap->GetWidth() * pBitmap->GetHeight() >
        (int64_t)abs(dest_width) * abs(dest_height))) {
@@ -862,14 +861,14 @@
 }
 
 bool CGdiDeviceDriver::GDI_StretchBitMask(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap1,
+    const RetainPtr<CFX_DIBitmap>& pBitmap1,
     int dest_left,
     int dest_top,
     int dest_width,
     int dest_height,
     uint32_t bitmap_color,
     uint32_t flags) {
-  CFX_RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1;
+  RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1;
   if (!pBitmap || dest_width == 0 || dest_height == 0)
     return false;
 
@@ -1161,7 +1160,7 @@
 
 CGdiDisplayDriver::~CGdiDisplayDriver() {}
 
-bool CGdiDisplayDriver::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+bool CGdiDisplayDriver::GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
                                   int left,
                                   int top) {
   bool ret = false;
@@ -1201,7 +1200,7 @@
   return ret;
 }
 
-bool CGdiDisplayDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
+bool CGdiDisplayDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource,
                                   uint32_t color,
                                   const FX_RECT* pSrcRect,
                                   int left,
@@ -1242,14 +1241,14 @@
     return SetDIBits(bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL);
   }
   CFX_DIBExtractor temp(pSource);
-  CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
+  RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
   if (!pBitmap)
     return false;
   return GDI_SetDIBits(pBitmap, pSrcRect, left, top);
 }
 
 bool CGdiDisplayDriver::UseFoxitStretchEngine(
-    const CFX_RetainPtr<CFX_DIBSource>& pSource,
+    const RetainPtr<CFX_DIBSource>& pSource,
     uint32_t color,
     int dest_left,
     int dest_top,
@@ -1265,7 +1264,7 @@
     dest_top += dest_height;
 
   bitmap_clip.Offset(-dest_left, -dest_top);
-  CFX_RetainPtr<CFX_DIBitmap> pStretched =
+  RetainPtr<CFX_DIBitmap> pStretched =
       pSource->StretchTo(dest_width, dest_height, render_flags, &bitmap_clip);
   if (!pStretched)
     return true;
@@ -1275,16 +1274,15 @@
                    pClipRect->top, FXDIB_BLEND_NORMAL);
 }
 
-bool CGdiDisplayDriver::StretchDIBits(
-    const CFX_RetainPtr<CFX_DIBSource>& pSource,
-    uint32_t color,
-    int dest_left,
-    int dest_top,
-    int dest_width,
-    int dest_height,
-    const FX_RECT* pClipRect,
-    uint32_t flags,
-    int blend_type) {
+bool CGdiDisplayDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource,
+                                      uint32_t color,
+                                      int dest_left,
+                                      int dest_top,
+                                      int dest_width,
+                                      int dest_height,
+                                      const FX_RECT* pClipRect,
+                                      uint32_t flags,
+                                      int blend_type) {
   ASSERT(pSource && pClipRect);
   if (flags || dest_width > 10000 || dest_width < -10000 ||
       dest_height > 10000 || dest_height < -10000) {
@@ -1301,7 +1299,7 @@
     clip_rect.Intersect(*pClipRect);
     clip_rect.Offset(-image_rect.left, -image_rect.top);
     int clip_width = clip_rect.Width(), clip_height = clip_rect.Height();
-    CFX_RetainPtr<CFX_DIBitmap> pStretched(
+    RetainPtr<CFX_DIBitmap> pStretched(
         pSource->StretchTo(dest_width, dest_height, flags, &clip_rect));
     if (!pStretched)
       return true;
@@ -1325,7 +1323,7 @@
         (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
     if (pPlatform->m_GdiplusExt.IsAvailable() && !pSource->IsCmykImage()) {
       CFX_DIBExtractor temp(pSource);
-      CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
+      RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
       if (!pBitmap)
         return false;
       return pPlatform->m_GdiplusExt.StretchDIBits(
@@ -1336,14 +1334,14 @@
                                  dest_width, dest_height, pClipRect, flags);
   }
   CFX_DIBExtractor temp(pSource);
-  CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
+  RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
   if (!pBitmap)
     return false;
   return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width,
                            dest_height, flags);
 }
 
-bool CGdiDisplayDriver::StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+bool CGdiDisplayDriver::StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                                     int bitmap_alpha,
                                     uint32_t color,
                                     const CFX_Matrix* pMatrix,
diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp
index c00543b..6416b5a 100644
--- a/core/fxge/win32/fx_win32_dib.cpp
+++ b/core/fxge/win32/fx_win32_dib.cpp
@@ -12,7 +12,7 @@
 #include "core/fxge/win32/win32_int.h"
 
 ByteString CFX_WindowsDIB::GetBitmapInfo(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
+    const RetainPtr<CFX_DIBitmap>& pBitmap) {
   ByteString result;
   int len = sizeof(BITMAPINFOHEADER);
   if (pBitmap->GetBPP() == 1 || pBitmap->GetBPP() == 8) {
@@ -52,9 +52,9 @@
   return result;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
-                                                       LPVOID pData,
-                                                       bool bAlpha) {
+RetainPtr<CFX_DIBitmap> _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
+                                                   LPVOID pData,
+                                                   bool bAlpha) {
   int width = pbmi->bmiHeader.biWidth;
   int height = pbmi->bmiHeader.biHeight;
   BOOL bBottomUp = true;
@@ -95,12 +95,12 @@
   return pBitmap;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi,
-                                                        LPVOID pData) {
+RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi,
+                                                    LPVOID pData) {
   return _FX_WindowsDIB_LoadFromBuf(pbmi, pData, false);
 }
 
-HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+HBITMAP CFX_WindowsDIB::GetDDBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap,
                                     HDC hDC) {
   ByteString info = GetBitmapInfo(pBitmap);
   return CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT,
@@ -115,8 +115,7 @@
   h = bmp.bmHeight;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(
-    const wchar_t* filename) {
+RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(const wchar_t* filename) {
   CWin32Platform* pPlatform =
       (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
   if (pPlatform->m_GdiplusExt.IsAvailable()) {
@@ -148,12 +147,11 @@
   return pDIBitmap;
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(const char* filename) {
+RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(const char* filename) {
   return LoadFromFile(WideString::FromLocal(filename).c_str());
 }
 
-CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadDIBitmap(
-    WINDIB_Open_Args_ args) {
+RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) {
   CWin32Platform* pPlatform =
       (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
   if (pPlatform->m_GdiplusExt.IsAvailable()) {
diff --git a/core/fxge/win32/fx_win32_dwrite.cpp b/core/fxge/win32/fx_win32_dwrite.cpp
index 8b1786a..4d4f45f 100644
--- a/core/fxge/win32/fx_win32_dwrite.cpp
+++ b/core/fxge/win32/fx_win32_dwrite.cpp
@@ -103,7 +103,7 @@
 
 class CDwGdiTextRenderer {
  public:
-  CDwGdiTextRenderer(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+  CDwGdiTextRenderer(const RetainPtr<CFX_DIBitmap>& pBitmap,
                      IDWriteBitmapRenderTarget* bitmapRenderTarget,
                      IDWriteRenderingParams* renderingParams);
   ~CDwGdiTextRenderer();
@@ -118,7 +118,7 @@
                                          const COLORREF& textColor);
 
  private:
-  CFX_RetainPtr<CFX_DIBitmap> pBitmap_;
+  RetainPtr<CFX_DIBitmap> pBitmap_;
   IDWriteBitmapRenderTarget* pRenderTarget_;
   IDWriteRenderingParams* pRenderingParams_;
 };
@@ -180,9 +180,8 @@
   return nullptr;
 }
 
-bool CDWriteExt::DwCreateRenderingTarget(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
-    void** renderTarget) {
+bool CDWriteExt::DwCreateRenderingTarget(const RetainPtr<CFX_DIBitmap>& pBitmap,
+                                         void** renderTarget) {
   if (pBitmap->GetFormat() > FXDIB_Argb) {
     return false;
   }
@@ -396,7 +395,7 @@
 }
 
 CDwGdiTextRenderer::CDwGdiTextRenderer(
-    const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+    const RetainPtr<CFX_DIBitmap>& pBitmap,
     IDWriteBitmapRenderTarget* bitmapRenderTarget,
     IDWriteRenderingParams* renderingParams)
     : pBitmap_(pBitmap),
diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp
index 8161c5d..70da194 100644
--- a/core/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/fxge/win32/fx_win32_gdipext.cpp
@@ -462,10 +462,10 @@
   return solidBrush;
 }
 
-static CFX_RetainPtr<CFX_DIBitmap> StretchMonoToGray(
+static RetainPtr<CFX_DIBitmap> StretchMonoToGray(
     int dest_width,
     int dest_height,
-    const CFX_RetainPtr<CFX_DIBitmap>& pSource,
+    const RetainPtr<CFX_DIBitmap>& pSource,
     FX_RECT* pClipRect) {
   bool bFlipX = dest_width < 0;
   if (bFlipX)
@@ -519,7 +519,7 @@
 
 static void OutputImageMask(GpGraphics* pGraphics,
                             BOOL bMonoDevice,
-                            const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+                            const RetainPtr<CFX_DIBitmap>& pBitmap,
                             int dest_left,
                             int dest_top,
                             int dest_width,
@@ -563,7 +563,7 @@
       return;
 
     image_clip.Offset(-image_rect.left, -image_rect.top);
-    CFX_RetainPtr<CFX_DIBitmap> pStretched;
+    RetainPtr<CFX_DIBitmap> pStretched;
     if (src_width * src_height > 10000) {
       pStretched =
           StretchMonoToGray(dest_width, dest_height, pBitmap, &image_clip);
@@ -606,7 +606,7 @@
   CallFunc(GdipDisposeImage)(bitmap);
 }
 static void OutputImage(GpGraphics* pGraphics,
-                        const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+                        const RetainPtr<CFX_DIBitmap>& pBitmap,
                         const FX_RECT* pSrcRect,
                         int dest_left,
                         int dest_top,
@@ -617,7 +617,7 @@
       ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
   if (pBitmap->GetBPP() == 1 && (pSrcRect->left % 8)) {
     FX_RECT new_rect(0, 0, src_width, src_height);
-    CFX_RetainPtr<CFX_DIBitmap> pCloned = pBitmap->Clone(pSrcRect);
+    RetainPtr<CFX_DIBitmap> pCloned = pBitmap->Clone(pSrcRect);
     if (!pCloned)
       return;
     OutputImage(pGraphics, pCloned, &new_rect, dest_left, dest_top, dest_width,
@@ -733,7 +733,7 @@
       ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
   CallFunc(GdipDeletePrivateFontCollection)((GpFontCollection**)&pCollection);
 }
-bool CGdiplusExt::GdipCreateBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+bool CGdiplusExt::GdipCreateBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap,
                                    void** bitmap) {
   CGdiplusExt& GdiplusExt =
       ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
@@ -897,7 +897,7 @@
 }
 bool CGdiplusExt::StretchBitMask(HDC hDC,
                                  BOOL bMonoDevice,
-                                 const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+                                 const RetainPtr<CFX_DIBitmap>& pBitmap,
                                  int dest_left,
                                  int dest_top,
                                  int dest_width,
@@ -923,7 +923,7 @@
   return true;
 }
 bool CGdiplusExt::StretchDIBits(HDC hDC,
-                                const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+                                const RetainPtr<CFX_DIBitmap>& pBitmap,
                                 int dest_left,
                                 int dest_top,
                                 int dest_width,
@@ -1463,11 +1463,11 @@
 }
 
 // TODO(tsepez): Really? Really? Move to header.
-CFX_RetainPtr<CFX_DIBitmap> _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
-                                                       LPVOID pData,
-                                                       bool bAlpha);
+RetainPtr<CFX_DIBitmap> _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
+                                                   LPVOID pData,
+                                                   bool bAlpha);
 
-CFX_RetainPtr<CFX_DIBitmap> CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) {
+RetainPtr<CFX_DIBitmap> CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) {
   PREVIEW3_DIBITMAP* pInfo = ::LoadDIBitmap(args);
   if (!pInfo)
     return nullptr;
@@ -1484,7 +1484,7 @@
              dest_pitch);
     }
   }
-  CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = _FX_WindowsDIB_LoadFromBuf(
+  RetainPtr<CFX_DIBitmap> pDIBitmap = _FX_WindowsDIB_LoadFromBuf(
       pInfo->pbmi, pData, pInfo->pbmi->bmiHeader.biBitCount == 32);
   FX_Free(pData);
   FreeDIBitmap(pInfo);
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index fa2c8b7..3c08acd 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -69,7 +69,7 @@
   return CGdiDeviceDriver::GetDeviceCaps(caps_id);
 }
 
-bool CGdiPrinterDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
+bool CGdiPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource,
                                   uint32_t color,
                                   const FX_RECT* pSrcRect,
                                   int left,
@@ -89,30 +89,29 @@
     return false;
 
   CFX_DIBExtractor temp(pSource);
-  CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
+  RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
   if (!pBitmap)
     return false;
 
   return GDI_SetDIBits(pBitmap, pSrcRect, left, top);
 }
 
-bool CGdiPrinterDriver::StretchDIBits(
-    const CFX_RetainPtr<CFX_DIBSource>& pSource,
-    uint32_t color,
-    int dest_left,
-    int dest_top,
-    int dest_width,
-    int dest_height,
-    const FX_RECT* pClipRect,
-    uint32_t flags,
-    int blend_type) {
+bool CGdiPrinterDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource,
+                                      uint32_t color,
+                                      int dest_left,
+                                      int dest_top,
+                                      int dest_width,
+                                      int dest_height,
+                                      const FX_RECT* pClipRect,
+                                      uint32_t flags,
+                                      int blend_type) {
   if (pSource->IsAlphaMask()) {
     int alpha = FXARGB_A(color);
     if (pSource->GetBPP() != 1 || alpha != 255)
       return false;
 
     if (dest_width < 0 || dest_height < 0) {
-      CFX_RetainPtr<CFX_DIBitmap> pFlipped =
+      RetainPtr<CFX_DIBitmap> pFlipped =
           pSource->FlipImage(dest_width < 0, dest_height < 0);
       if (!pFlipped)
         return false;
@@ -127,7 +126,7 @@
     }
 
     CFX_DIBExtractor temp(pSource);
-    CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
+    RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
     if (!pBitmap)
       return false;
     return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width,
@@ -138,7 +137,7 @@
     return false;
 
   if (dest_width < 0 || dest_height < 0) {
-    CFX_RetainPtr<CFX_DIBitmap> pFlipped =
+    RetainPtr<CFX_DIBitmap> pFlipped =
         pSource->FlipImage(dest_width < 0, dest_height < 0);
     if (!pFlipped)
       return false;
@@ -153,14 +152,14 @@
   }
 
   CFX_DIBExtractor temp(pSource);
-  CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
+  RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
   if (!pBitmap)
     return false;
   return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width,
                            dest_height, flags);
 }
 
-bool CGdiPrinterDriver::StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
+bool CGdiPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBSource>& pSource,
                                     int bitmap_alpha,
                                     uint32_t color,
                                     const CFX_Matrix* pMatrix,
@@ -187,7 +186,7 @@
   if (fabs(pMatrix->a) >= 0.5f || fabs(pMatrix->d) >= 0.5f)
     return false;
 
-  CFX_RetainPtr<CFX_DIBitmap> pTransformed =
+  RetainPtr<CFX_DIBitmap> pTransformed =
       pSource->SwapXY(pMatrix->c > 0, pMatrix->b < 0);
   if (!pTransformed)
     return false;
@@ -440,7 +439,7 @@
   return true;
 }
 
-bool CPSPrinterDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+bool CPSPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                                  uint32_t color,
                                  const FX_RECT* pSrcRect,
                                  int left,
@@ -451,23 +450,22 @@
   return m_PSRenderer.SetDIBits(pBitmap, color, left, top);
 }
 
-bool CPSPrinterDriver::StretchDIBits(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-    uint32_t color,
-    int dest_left,
-    int dest_top,
-    int dest_width,
-    int dest_height,
-    const FX_RECT* pClipRect,
-    uint32_t flags,
-    int blend_type) {
+bool CPSPrinterDriver::StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
+                                     uint32_t color,
+                                     int dest_left,
+                                     int dest_top,
+                                     int dest_width,
+                                     int dest_height,
+                                     const FX_RECT* pClipRect,
+                                     uint32_t flags,
+                                     int blend_type) {
   if (blend_type != FXDIB_BLEND_NORMAL)
     return false;
   return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top,
                                     dest_width, dest_height, flags);
 }
 
-bool CPSPrinterDriver::StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+bool CPSPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                                    int bitmap_alpha,
                                    uint32_t color,
                                    const CFX_Matrix* pMatrix,
@@ -552,13 +550,12 @@
   return false;
 }
 
-bool CTextOnlyPrinterDriver::SetDIBits(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
-    uint32_t color,
-    const FX_RECT* pSrcRect,
-    int left,
-    int top,
-    int blend_type) {
+bool CTextOnlyPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
+                                       uint32_t color,
+                                       const FX_RECT* pSrcRect,
+                                       int left,
+                                       int top,
+                                       int blend_type) {
   return false;
 }
 
@@ -571,7 +568,7 @@
 }
 
 bool CTextOnlyPrinterDriver::StretchDIBits(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+    const RetainPtr<CFX_DIBSource>& pBitmap,
     uint32_t color,
     int dest_left,
     int dest_top,
@@ -584,7 +581,7 @@
 }
 
 bool CTextOnlyPrinterDriver::StartDIBits(
-    const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+    const RetainPtr<CFX_DIBSource>& pBitmap,
     int bitmap_alpha,
     uint32_t color,
     const CFX_Matrix* pMatrix,
diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h
index f9fcbe8..c4559f4 100644
--- a/core/fxge/win32/win32_int.h
+++ b/core/fxge/win32/win32_int.h
@@ -11,7 +11,7 @@
 
 #include <memory>
 
-#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/cfx_pathdata.h"
 #include "core/fxge/ifx_renderdevicedriver.h"
 #include "core/fxge/win32/cfx_psrenderer.h"
@@ -36,7 +36,7 @@
   bool IsAvailable() { return !!m_hModule; }
   bool StretchBitMask(HDC hDC,
                       BOOL bMonoDevice,
-                      const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+                      const RetainPtr<CFX_DIBitmap>& pBitmap,
                       int dest_left,
                       int dest_top,
                       int dest_width,
@@ -45,7 +45,7 @@
                       const FX_RECT* pClipRect,
                       int flags);
   bool StretchDIBits(HDC hDC,
-                     const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+                     const RetainPtr<CFX_DIBitmap>& pBitmap,
                      int dest_left,
                      int dest_top,
                      int dest_width,
@@ -98,8 +98,7 @@
                                      float font_size,
                                      int fontstyle);
   void GdipDeleteFont(void* pFont);
-  bool GdipCreateBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
-                        void** bitmap);
+  bool GdipCreateBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, void** bitmap);
   void GdipDisposeImage(void* bitmap);
   void GdipGetFontSize(void* pFont, float* size);
   void* GdiAddFontMemResourceEx(void* pFontdata,
@@ -107,7 +106,7 @@
                                 void* pdv,
                                 uint32_t* num_face);
   bool GdiRemoveFontMemResourceEx(void* handle);
-  CFX_RetainPtr<CFX_DIBitmap> LoadDIBitmap(WINDIB_Open_Args_ args);
+  RetainPtr<CFX_DIBitmap> LoadDIBitmap(WINDIB_Open_Args_ args);
 
   FARPROC m_Functions[100];
   FuncType_GdiAddFontMemResourceEx m_pGdiAddFontMemResourceEx;
@@ -158,17 +157,17 @@
 
   void DrawLine(float x1, float y1, float x2, float y2);
 
-  bool GDI_SetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+  bool GDI_SetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
                      const FX_RECT* pSrcRect,
                      int left,
                      int top);
-  bool GDI_StretchDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+  bool GDI_StretchDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
                          int dest_left,
                          int dest_top,
                          int dest_width,
                          int dest_height,
                          uint32_t flags);
-  bool GDI_StretchBitMask(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+  bool GDI_StretchBitMask(const RetainPtr<CFX_DIBitmap>& pBitmap,
                           int dest_left,
                           int dest_top,
                           int dest_width,
@@ -191,16 +190,16 @@
   ~CGdiDisplayDriver() override;
 
  protected:
-  bool GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+  bool GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
                  int left,
                  int top) override;
-  bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                  uint32_t color,
                  const FX_RECT* pSrcRect,
                  int left,
                  int top,
                  int blend_type) override;
-  bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                      uint32_t color,
                      int dest_left,
                      int dest_top,
@@ -209,14 +208,14 @@
                      const FX_RECT* pClipRect,
                      uint32_t flags,
                      int blend_type) override;
-  bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                    int bitmap_alpha,
                    uint32_t color,
                    const CFX_Matrix* pMatrix,
                    uint32_t render_flags,
                    std::unique_ptr<CFX_ImageRenderer>* handle,
                    int blend_type) override;
-  bool UseFoxitStretchEngine(const CFX_RetainPtr<CFX_DIBSource>& pSource,
+  bool UseFoxitStretchEngine(const RetainPtr<CFX_DIBSource>& pSource,
                              uint32_t color,
                              int dest_left,
                              int dest_top,
@@ -233,13 +232,13 @@
 
  protected:
   int GetDeviceCaps(int caps_id) const override;
-  bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                  uint32_t color,
                  const FX_RECT* pSrcRect,
                  int left,
                  int top,
                  int blend_type) override;
-  bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                      uint32_t color,
                      int dest_left,
                      int dest_top,
@@ -248,7 +247,7 @@
                      const FX_RECT* pClipRect,
                      uint32_t flags,
                      int blend_type) override;
-  bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                    int bitmap_alpha,
                    uint32_t color,
                    const CFX_Matrix* pMatrix,
@@ -292,13 +291,13 @@
                 int fill_mode,
                 int blend_type) override;
   bool GetClipBox(FX_RECT* pRect) override;
-  bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                  uint32_t color,
                  const FX_RECT* pSrcRect,
                  int left,
                  int top,
                  int blend_type) override;
-  bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                      uint32_t color,
                      int dest_left,
                      int dest_top,
@@ -307,7 +306,7 @@
                      const FX_RECT* pClipRect,
                      uint32_t flags,
                      int blend_type) override;
-  bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                    int bitmap_alpha,
                    uint32_t color,
                    const CFX_Matrix* pMatrix,
@@ -355,13 +354,13 @@
                 int fill_mode,
                 int blend_type) override;
   bool GetClipBox(FX_RECT* pRect) override;
-  bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                  uint32_t color,
                  const FX_RECT* pSrcRect,
                  int left,
                  int top,
                  int blend_type) override;
-  bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                      uint32_t color,
                      int dest_left,
                      int dest_top,
@@ -370,7 +369,7 @@
                      const FX_RECT* pClipRect,
                      uint32_t flags,
                      int blend_type) override;
-  bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+  bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
                    int bitmap_alpha,
                    uint32_t color,
                    const CFX_Matrix* pMatrix,