diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-07-11 19:29:22 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-11 19:29:22 +0000 |
commit | 75625a8a8a84fffcfe09a09b57d77c99b5261f7d (patch) | |
tree | 08e8e5febc156a5b7974ccd2c666b8c376482c09 | |
parent | 8ac090c4a57bc27044adc7abe8143ce45388b021 (diff) | |
download | pdfium-75625a8a8a84fffcfe09a09b57d77c99b5261f7d.tar.xz |
Cleanup CPDF_ContentMark.
Bug: pdfium:1118
Change-Id: I457a52196ee177a09d33d9e025a094888be3fb60
Reviewed-on: https://pdfium-review.googlesource.com/37610
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmark.cpp | 11 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmarkitem.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmarkitem.h | 3 |
3 files changed, 7 insertions, 10 deletions
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp index 08b38f20c2..8b4609586d 100644 --- a/core/fpdfapi/page/cpdf_contentmark.cpp +++ b/core/fpdfapi/page/cpdf_contentmark.cpp @@ -65,7 +65,7 @@ void CPDF_ContentMark::AddMarkWithPropertiesDict(ByteString name, void CPDF_ContentMark::EnsureMarkDataExists() { if (!m_pMarkData) - m_pMarkData.Reset(new MarkData()); + m_pMarkData = pdfium::MakeRetain<MarkData>(); } void CPDF_ContentMark::DeleteLastMark() { @@ -107,15 +107,13 @@ int CPDF_ContentMark::MarkData::GetMarkedContentID() const { } void CPDF_ContentMark::MarkData::AddMark(ByteString name) { - auto pItem = pdfium::MakeRetain<CPDF_ContentMarkItem>(); - pItem->SetName(std::move(name)); + auto pItem = pdfium::MakeRetain<CPDF_ContentMarkItem>(std::move(name)); m_Marks.push_back(pItem); } void CPDF_ContentMark::MarkData::AddMarkWithDirectDict(ByteString name, CPDF_Dictionary* pDict) { - auto pItem = pdfium::MakeRetain<CPDF_ContentMarkItem>(); - pItem->SetName(std::move(name)); + auto pItem = pdfium::MakeRetain<CPDF_ContentMarkItem>(std::move(name)); pItem->SetDirectDict(ToDictionary(pDict->Clone())); m_Marks.push_back(pItem); } @@ -123,8 +121,7 @@ void CPDF_ContentMark::MarkData::AddMarkWithDirectDict(ByteString name, void CPDF_ContentMark::MarkData::AddMarkWithPropertiesDict( ByteString name, CPDF_Dictionary* pDict) { - auto pItem = pdfium::MakeRetain<CPDF_ContentMarkItem>(); - pItem->SetName(std::move(name)); + auto pItem = pdfium::MakeRetain<CPDF_ContentMarkItem>(std::move(name)); pItem->SetPropertiesDict(pDict); m_Marks.push_back(pItem); } diff --git a/core/fpdfapi/page/cpdf_contentmarkitem.cpp b/core/fpdfapi/page/cpdf_contentmarkitem.cpp index dd9f7e884c..2e715926d3 100644 --- a/core/fpdfapi/page/cpdf_contentmarkitem.cpp +++ b/core/fpdfapi/page/cpdf_contentmarkitem.cpp @@ -10,7 +10,8 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" -CPDF_ContentMarkItem::CPDF_ContentMarkItem() {} +CPDF_ContentMarkItem::CPDF_ContentMarkItem(ByteString name) + : m_MarkName(std::move(name)) {} CPDF_ContentMarkItem::~CPDF_ContentMarkItem() {} diff --git a/core/fpdfapi/page/cpdf_contentmarkitem.h b/core/fpdfapi/page/cpdf_contentmarkitem.h index 343db9d1a6..6d2310e261 100644 --- a/core/fpdfapi/page/cpdf_contentmarkitem.h +++ b/core/fpdfapi/page/cpdf_contentmarkitem.h @@ -21,7 +21,7 @@ class CPDF_ContentMarkItem : public Retainable { public: enum ParamType { None, PropertiesDict, DirectDict }; - CPDF_ContentMarkItem(); + explicit CPDF_ContentMarkItem(ByteString name); ~CPDF_ContentMarkItem() override; ByteString GetName() const { return m_MarkName; } @@ -30,7 +30,6 @@ class CPDF_ContentMarkItem : public Retainable { CPDF_Dictionary* GetParam(); bool HasMCID() const; - void SetName(const ByteString& name) { m_MarkName = name; } void SetDirectDict(std::unique_ptr<CPDF_Dictionary> pDict); void SetPropertiesDict(CPDF_Dictionary* pDict); |