Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(906)

Unified Diff: core/fpdfapi/parser/cpdf_name.cpp

Issue 2509123002: Make CPDF_Object subclass constructors intern strings (Closed)
Patch Set: Nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_name.h ('k') | core/fpdfapi/parser/cpdf_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_name.cpp
diff --git a/core/fpdfapi/parser/cpdf_name.cpp b/core/fpdfapi/parser/cpdf_name.cpp
index bb464251177eeaaa12b9cc594b43d69c7cade01e..5be64d39d5875c82a13b08eef0f18b3a2e25be7e 100644
--- a/core/fpdfapi/parser/cpdf_name.cpp
+++ b/core/fpdfapi/parser/cpdf_name.cpp
@@ -9,7 +9,12 @@
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "third_party/base/ptr_util.h"
-CPDF_Name::CPDF_Name(const CFX_ByteString& str) : m_Name(str) {}
+CPDF_Name::CPDF_Name(CFX_WeakPtr<CFX_ByteStringPool> pPool,
+ const CFX_ByteString& str)
+ : m_Name(str) {
+ if (pPool)
+ m_Name = pPool->Intern(m_Name);
+}
CPDF_Name::~CPDF_Name() {}
@@ -18,7 +23,7 @@ CPDF_Object::Type CPDF_Name::GetType() const {
}
std::unique_ptr<CPDF_Object> CPDF_Name::Clone() const {
- return pdfium::MakeUnique<CPDF_Name>(m_Name);
+ return pdfium::MakeUnique<CPDF_Name>(nullptr, m_Name);
}
CFX_ByteString CPDF_Name::GetString() const {
« no previous file with comments | « core/fpdfapi/parser/cpdf_name.h ('k') | core/fpdfapi/parser/cpdf_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698