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

Unified Diff: core/fpdfapi/fpdf_parser/cpdf_object_unittest.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_parser/cpdf_document.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_stream.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
diff --git a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
index dad98cd28e5e95415371bef3ac1e01187c733505..1548b1914ab83cdfd189a7c385cda2b75b4dcea3 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
@@ -66,7 +66,7 @@ class PDFObjectsTest : public testing::Test {
m_ArrayObj->InsertAt(0, new CPDF_Number(8902));
m_ArrayObj->InsertAt(1, new CPDF_Name("address"));
// Dictionary object.
- m_DictObj = new CPDF_Dictionary;
+ m_DictObj = new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
m_DictObj->SetFor("bool", new CPDF_Boolean(false));
m_DictObj->SetFor("num", new CPDF_Number(0.23f));
// Stream object.
@@ -74,7 +74,7 @@ class PDFObjectsTest : public testing::Test {
size_t buf_len = FX_ArraySize(content);
uint8_t* buf = reinterpret_cast<uint8_t*>(malloc(buf_len));
memcpy(buf, content, buf_len);
- m_StreamDictObj = new CPDF_Dictionary;
+ m_StreamDictObj = new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
m_StreamDictObj->SetFor("key1", new CPDF_String(L" test dict"));
m_StreamDictObj->SetFor("key2", new CPDF_Number(-1));
CPDF_Stream* stream_obj = new CPDF_Stream(buf, buf_len, m_StreamDictObj);
@@ -553,7 +553,7 @@ TEST(PDFArrayTest, GetTypeAt) {
CPDF_Dictionary* vals[3];
ScopedArray arr(new CPDF_Array);
for (size_t i = 0; i < 3; ++i) {
- vals[i] = new CPDF_Dictionary;
+ vals[i] = new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
for (size_t j = 0; j < 3; ++j) {
std::string key("key");
char buf[33];
@@ -580,7 +580,7 @@ TEST(PDFArrayTest, GetTypeAt) {
CPDF_Stream* stream_vals[3];
ScopedArray arr(new CPDF_Array);
for (size_t i = 0; i < 3; ++i) {
- vals[i] = new CPDF_Dictionary;
+ vals[i] = new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
for (size_t j = 0; j < 3; ++j) {
std::string key("key");
char buf[33];
@@ -625,11 +625,13 @@ TEST(PDFArrayTest, GetTypeAt) {
arr_val->AddNumber(1);
arr_val->AddNumber(2);
arr->InsertAt(11, arr_val);
- CPDF_Dictionary* dict_val = new CPDF_Dictionary;
+ CPDF_Dictionary* dict_val =
+ new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
dict_val->SetFor("key1", new CPDF_String("Linda", false));
dict_val->SetFor("key2", new CPDF_String("Zoe", false));
arr->InsertAt(12, dict_val);
- CPDF_Dictionary* stream_dict = new CPDF_Dictionary;
+ CPDF_Dictionary* stream_dict =
+ new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
stream_dict->SetFor("key1", new CPDF_String("John", false));
stream_dict->SetFor("key2", new CPDF_String("King", false));
uint8_t data[] = "A stream for test";
@@ -768,7 +770,7 @@ TEST(PDFArrayTest, CloneDirectObject) {
TEST(PDFDictionaryTest, CloneDirectObject) {
CPDF_IndirectObjectHolder objects_holder;
- ScopedDict dict(new CPDF_Dictionary);
+ ScopedDict dict(new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>()));
dict->SetReferenceFor("foo", &objects_holder, 1234);
ASSERT_EQ(1U, dict->GetCount());
CPDF_Object* obj = dict->GetObjectFor("foo");
@@ -790,7 +792,8 @@ TEST(PDFObjectTest, CloneCheckLoop) {
// Create an object with a reference loop.
ScopedArray arr_obj(new CPDF_Array);
// Dictionary object.
- CPDF_Dictionary* dict_obj = new CPDF_Dictionary;
+ CPDF_Dictionary* dict_obj =
+ new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
dict_obj->SetFor("arr", arr_obj.get());
arr_obj->InsertAt(0, dict_obj);
@@ -808,7 +811,8 @@ TEST(PDFObjectTest, CloneCheckLoop) {
{
CPDF_IndirectObjectHolder objects_holder;
// Create an object with a reference loop.
- CPDF_Dictionary* dict_obj = new CPDF_Dictionary;
+ CPDF_Dictionary* dict_obj =
+ new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
CPDF_Array* arr_obj = new CPDF_Array;
objects_holder.AddIndirectObject(dict_obj);
EXPECT_EQ(1u, dict_obj->GetObjNum());
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_document.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_stream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698