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

Unified Diff: core/fpdfapi/fpdf_page/fpdf_page_parser.cpp

Issue 2345063002: Use string pools in some dictionaries (Closed)
Patch Set: windows compile Created 4 years, 3 months 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/fpdf_page/fpdf_page_doc.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 46ab067b3ec6e7ee1d06df565ba232b2b3500c2e..881f9eed25f07e64840fec4f3f900ae75caf6480 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -281,7 +281,8 @@ void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) {
ContentParam& param = m_ParamBuf[GetNextParamPos()];
if (len > 32) {
param.m_Type = ContentParam::OBJECT;
- param.m_pObject = new CPDF_Name(PDF_NameDecode(bsName));
+ param.m_pObject = new CPDF_Name(
+ m_pDocument->GetByteStringPool()->Intern(PDF_NameDecode(bsName)));
} else {
param.m_Type = ContentParam::NAME;
if (bsName.Find('#') == -1) {
@@ -343,8 +344,8 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) {
return pNumber;
}
if (param.m_Type == ContentParam::NAME) {
- CPDF_Name* pName = new CPDF_Name(
- CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len));
+ CPDF_Name* pName = new CPDF_Name(m_pDocument->GetByteStringPool()->Intern(
+ CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len)));
param.m_Type = ContentParam::OBJECT;
param.m_pObject = pName;
return pName;
@@ -589,7 +590,8 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() {
void CPDF_StreamContentParser::Handle_BeginImage() {
FX_FILESIZE savePos = m_pSyntax->GetPos();
- CPDF_Dictionary* pDict = new CPDF_Dictionary;
+ CPDF_Dictionary* pDict =
+ new CPDF_Dictionary(m_pDocument->GetByteStringPool());
while (1) {
CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement();
if (type == CPDF_StreamParser::Keyword) {
@@ -1499,7 +1501,7 @@ uint32_t CPDF_StreamContentParser::Parse(const uint8_t* pData,
return dwSize;
}
uint32_t InitObjCount = m_pObjectHolder->GetPageObjectList()->size();
- CPDF_StreamParser syntax(pData, dwSize);
+ CPDF_StreamParser syntax(pData, dwSize, m_pDocument->GetByteStringPool());
CPDF_StreamParserAutoClearer auto_clearer(&m_pSyntax, &syntax);
while (1) {
uint32_t cost = m_pObjectHolder->GetPageObjectList()->size() - InitObjCount;
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_doc.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698