Rename CFX_WeakPtr::Clear() to DestroyObject()
|Clear| is too easily mistaken for "clear this pointer only."
Review-Url: https://codereview.chromium.org/2385303002
diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp
index 860912a..3721bf8 100644
--- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp
@@ -20,7 +20,7 @@
CFDF_Document::~CFDF_Document() {
if (m_bOwnFile && m_pFile)
m_pFile->Release();
- m_pByteStringPool.Clear(); // Make weak.
+ m_pByteStringPool.DeleteObject(); // Make weak.
}
CFDF_Document* CFDF_Document::CreateNewDoc() {
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
index f90fa3d..f8b4f9b 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
@@ -423,7 +423,7 @@
CPDF_Document::~CPDF_Document() {
delete m_pDocPage;
CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this);
- m_pByteStringPool.Clear(); // Make weak.
+ m_pByteStringPool.DeleteObject(); // Make weak.
}
CPDF_Object* CPDF_Document::ParseIndirectObject(uint32_t objnum) {
diff --git a/core/fxcrt/cfx_weak_ptr.h b/core/fxcrt/cfx_weak_ptr.h
index 61f15e3..9ac1475 100644
--- a/core/fxcrt/cfx_weak_ptr.h
+++ b/core/fxcrt/cfx_weak_ptr.h
@@ -35,7 +35,7 @@
bool operator!=(const CFX_WeakPtr& that) const { return !(*this == that); }
T* Get() const { return m_pHandle ? m_pHandle->Get() : nullptr; }
- void Clear() {
+ void DeleteObject() {
if (m_pHandle) {
m_pHandle->Clear();
m_pHandle.Reset();
diff --git a/core/fxcrt/cfx_weak_ptr_unittest.cpp b/core/fxcrt/cfx_weak_ptr_unittest.cpp
index 11dd8bb..47f63c3 100644
--- a/core/fxcrt/cfx_weak_ptr_unittest.cpp
+++ b/core/fxcrt/cfx_weak_ptr_unittest.cpp
@@ -121,13 +121,13 @@
EXPECT_EQ(1, thing2.delete_count());
}
-TEST(fxcrt, WeakPtrClear) {
+TEST(fxcrt, WeakPtrDeleteObject) {
PseudoDeletable thing;
{
UniquePtr unique(&thing);
WeakPtr ptr1(std::move(unique));
WeakPtr ptr2 = ptr1;
- ptr1.Clear();
+ ptr1.DeleteObject();
EXPECT_FALSE(ptr1);
EXPECT_EQ(nullptr, ptr1.Get());
EXPECT_FALSE(ptr2);
@@ -155,7 +155,7 @@
EXPECT_EQ(0, thing2.delete_count());
}
-TEST(fxcrt, WeakPtrCyclicClear) {
+TEST(fxcrt, WeakPtrCyclicDeleteObject) {
PseudoDeletable thing1;
PseudoDeletable thing2;
{
@@ -165,7 +165,7 @@
WeakPtr ptr2(std::move(unique2));
ptr1->SetNext(ptr2);
ptr2->SetNext(ptr1);
- ptr1.Clear();
+ ptr1.DeleteObject();
EXPECT_EQ(1, thing1.delete_count());
EXPECT_EQ(0, thing2.delete_count());
}