summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-10-03 13:54:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-03 13:54:27 -0700
commitabab61a1fcd776964a15c528dd2dd034fb31edf0 (patch)
tree72b991193f09b7e60218b91e44cf676807f4e76d
parentbcf46238b4533a9da91f4fa5d7248bbc85511dbd (diff)
downloadpdfium-abab61a1fcd776964a15c528dd2dd034fb31edf0.tar.xz
Rename CFX_WeakPtr::Clear() to DestroyObject()
|Clear| is too easily mistaken for "clear this pointer only." Review-Url: https://codereview.chromium.org/2385303002
-rw-r--r--core/fpdfapi/fpdf_parser/cfdf_document.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_document.cpp2
-rw-r--r--core/fxcrt/cfx_weak_ptr.h2
-rw-r--r--core/fxcrt/cfx_weak_ptr_unittest.cpp8
4 files changed, 7 insertions, 7 deletions
diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp
index 860912ab3e..3721bf885b 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()
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 f90fa3dc78..f8b4f9b87b 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(std::unique_ptr<CPDF_Parser> pParser)
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 61f15e3dda..9ac1475884 100644
--- a/core/fxcrt/cfx_weak_ptr.h
+++ b/core/fxcrt/cfx_weak_ptr.h
@@ -35,7 +35,7 @@ class CFX_WeakPtr {
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 11dd8bb3c0..47f63c35b2 100644
--- a/core/fxcrt/cfx_weak_ptr_unittest.cpp
+++ b/core/fxcrt/cfx_weak_ptr_unittest.cpp
@@ -121,13 +121,13 @@ TEST(fxcrt, WeakPtrResetNonNull) {
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 @@ TEST(fxcrt, WeakPtrCyclic) {
EXPECT_EQ(0, thing2.delete_count());
}
-TEST(fxcrt, WeakPtrCyclicClear) {
+TEST(fxcrt, WeakPtrCyclicDeleteObject) {
PseudoDeletable thing1;
PseudoDeletable thing2;
{
@@ -165,7 +165,7 @@ TEST(fxcrt, WeakPtrCyclicClear) {
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());
}