summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/pickle.h99
-rw-r--r--base/pickle_unittest.cc64
-rw-r--r--chrome/browser/extensions/api/automation_internal/automation_internal_api.cc2
-rw-r--r--chrome/browser/extensions/api/page_capture/page_capture_api.cc2
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_drag_data.cc6
-rw-r--r--components/bookmarks/browser/bookmark_node_data.cc25
-rw-r--r--components/bookmarks/browser/bookmark_node_data.h2
-rw-r--r--components/sessions/base_session_service_commands.cc12
-rw-r--r--components/sessions/session_service_commands.cc12
-rw-r--r--content/browser/loader/resource_dispatcher_host_unittest.cc2
-rw-r--r--content/browser/renderer_host/input/input_router_impl_unittest.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_unittest.cc2
-rw-r--r--content/browser/renderer_host/sandbox_ipc_linux.cc58
-rw-r--r--content/browser/renderer_host/sandbox_ipc_linux.h7
-rw-r--r--content/browser/web_contents/web_contents_view_aura.cc5
-rw-r--r--content/browser/zygote_host/zygote_host_impl_linux.cc11
-rw-r--r--content/child/resource_dispatcher.cc4
-rw-r--r--content/child/threaded_data_provider.cc2
-rw-r--r--content/common/cc_messages.cc4
-rw-r--r--content/common/child_process_sandbox_support_impl_linux.cc26
-rw-r--r--content/common/common_param_traits_unittest.cc2
-rw-r--r--content/common/content_param_traits.cc4
-rw-r--r--content/common/font_config_ipc_linux.cc11
-rw-r--r--content/common/gamepad_param_traits.cc2
-rw-r--r--content/common/media/media_param_traits.cc22
-rw-r--r--content/common/page_state_serialization.cc16
-rw-r--r--content/common/resource_messages.cc4
-rw-r--r--content/common/ssl_status_serialization.cc13
-rw-r--r--content/public/common/common_param_traits.cc4
-rw-r--r--content/public/common/common_param_traits.h4
-rw-r--r--content/zygote/zygote_linux.cc38
-rw-r--r--content/zygote/zygote_linux.h10
-rw-r--r--content/zygote/zygote_main_linux.cc4
-rw-r--r--extensions/browser/script_executor.cc2
-rw-r--r--extensions/common/user_script.cc28
-rw-r--r--extensions/renderer/user_script_set.cc6
-rw-r--r--gpu/ipc/gpu_command_buffer_traits.cc4
-rw-r--r--ipc/ipc_channel_posix.cc6
-rw-r--r--ipc/ipc_channel_unittest.cc12
-rw-r--r--ipc/ipc_fuzzing_tests.cc10
-rw-r--r--ipc/ipc_message.cc2
-rw-r--r--ipc/ipc_message_utils.cc28
-rw-r--r--ipc/ipc_message_utils.h30
-rw-r--r--ipc/ipc_sync_message.cc2
-rw-r--r--ipc/param_traits_read_macros.h2
-rw-r--r--net/cert/x509_certificate.cc3
-rw-r--r--net/cert/x509_certificate.h3
-rw-r--r--net/cert/x509_certificate_unittest.cc2
-rw-r--r--net/http/http_response_headers.cc5
-rw-r--r--net/http/http_response_headers.h2
-rw-r--r--net/http/http_response_headers_unittest.cc2
-rw-r--r--net/http/http_response_info.cc30
-rw-r--r--net/http/http_vary_data.cc4
-rw-r--r--net/http/http_vary_data.h2
-rw-r--r--net/quic/crypto/quic_server_info.cc12
-rw-r--r--ppapi/nacl_irt/ppapi_dispatcher.cc2
-rw-r--r--ppapi/proxy/ppapi_param_traits.cc4
-rw-r--r--ppapi/proxy/raw_var_data.cc36
-rw-r--r--ppapi/proxy/serialized_flash_menu.cc8
-rw-r--r--ppapi/proxy/serialized_var.cc2
-rw-r--r--remoting/host/chromoting_param_traits.cc12
-rw-r--r--sandbox/linux/syscall_broker/broker_client.cc2
-rw-r--r--sandbox/linux/syscall_broker/broker_host.cc11
-rw-r--r--skia/ext/skia_utils_base.cc20
-rw-r--r--skia/ext/skia_utils_base.h10
-rw-r--r--storage/browser/fileapi/file_system_usage_cache.cc8
-rw-r--r--storage/browser/fileapi/sandbox_directory_database.cc8
-rw-r--r--storage/browser/fileapi/sandbox_prioritized_origin_database.cc2
-rw-r--r--ui/base/clipboard/clipboard_test_template.h6
-rw-r--r--ui/base/clipboard/custom_data_helper.cc19
-rw-r--r--ui/base/dragdrop/os_exchange_data_unittest.cc4
-rw-r--r--ui/gfx/ipc/gfx_param_traits.cc20
72 files changed, 483 insertions, 369 deletions
diff --git a/base/pickle.h b/base/pickle.h
index f2a198e..11cf484 100644
--- a/base/pickle.h
+++ b/base/pickle.h
@@ -26,7 +26,7 @@ class BASE_EXPORT PickleIterator {
// Methods for reading the payload of the Pickle. To read from the start of
// the Pickle, create a PickleIterator from a Pickle. If successful, these
// methods return true. Otherwise, false is returned to indicate that the
- // result could not be extracted. It is not possible to read from the iterator
+ // result could not be extracted. It is not possible to read from iterator
// after that.
bool ReadBool(bool* result) WARN_UNUSED_RESULT;
bool ReadInt(int* result) WARN_UNUSED_RESULT;
@@ -41,21 +41,10 @@ class BASE_EXPORT PickleIterator {
bool ReadString(std::string* result) WARN_UNUSED_RESULT;
bool ReadWString(std::wstring* result) WARN_UNUSED_RESULT;
bool ReadString16(base::string16* result) WARN_UNUSED_RESULT;
-
- // A pointer to the data will be placed in |*data|, and the length will be
- // placed in |*length|. The pointer placed into |*data| points into the
- // message's buffer so it will be scoped to the lifetime of the message (or
- // until the message data is mutated). Do not keep the pointer around!
bool ReadData(const char** data, int* length) WARN_UNUSED_RESULT;
-
- // A pointer to the data will be placed in |*data|. The caller specifies the
- // number of bytes to read, and ReadBytes will validate this length. The
- // pointer placed into |*data| points into the message's buffer so it will be
- // scoped to the lifetime of the message (or until the message data is
- // mutated). Do not keep the pointer around!
bool ReadBytes(const char** data, int length) WARN_UNUSED_RESULT;
- // A safer version of ReadInt() that checks for the result not being negative.
+ // Safer version of ReadInt() checks for the result not being negative.
// Use it for reading the object sizes.
bool ReadLength(int* result) WARN_UNUSED_RESULT {
return ReadInt(result) && *result >= 0;
@@ -68,7 +57,7 @@ class BASE_EXPORT PickleIterator {
}
private:
- // Aligns 'i' by rounding it up to the next multiple of 'alignment'.
+ // Aligns 'i' by rounding it up to the next multiple of 'alignment'
static size_t AlignInt(size_t i, int alignment) {
return i + (alignment - (i % alignment)) % alignment;
}
@@ -153,11 +142,91 @@ class BASE_EXPORT Pickle {
// Returns the data for this Pickle.
const void* data() const { return header_; }
+ // For compatibility, these older style read methods pass through to the
+ // PickleIterator methods.
+ // TODO(jbates) Remove these methods.
+ bool ReadBool(PickleIterator* iter,
+ bool* result) const WARN_UNUSED_RESULT {
+ return iter->ReadBool(result);
+ }
+ bool ReadInt(PickleIterator* iter,
+ int* result) const WARN_UNUSED_RESULT {
+ return iter->ReadInt(result);
+ }
+ bool ReadLong(PickleIterator* iter,
+ long* result) const WARN_UNUSED_RESULT {
+ return iter->ReadLong(result);
+ }
+ bool ReadUInt16(PickleIterator* iter,
+ uint16* result) const WARN_UNUSED_RESULT {
+ return iter->ReadUInt16(result);
+ }
+ bool ReadUInt32(PickleIterator* iter,
+ uint32* result) const WARN_UNUSED_RESULT {
+ return iter->ReadUInt32(result);
+ }
+ bool ReadInt64(PickleIterator* iter,
+ int64* result) const WARN_UNUSED_RESULT {
+ return iter->ReadInt64(result);
+ }
+ bool ReadUInt64(PickleIterator* iter,
+ uint64* result) const WARN_UNUSED_RESULT {
+ return iter->ReadUInt64(result);
+ }
+ bool ReadSizeT(PickleIterator* iter,
+ size_t* result) const WARN_UNUSED_RESULT {
+ return iter->ReadSizeT(result);
+ }
+ bool ReadFloat(PickleIterator* iter,
+ float* result) const WARN_UNUSED_RESULT {
+ return iter->ReadFloat(result);
+ }
+ bool ReadDouble(PickleIterator* iter,
+ double* result) const WARN_UNUSED_RESULT {
+ return iter->ReadDouble(result);
+ }
+ bool ReadString(PickleIterator* iter,
+ std::string* result) const WARN_UNUSED_RESULT {
+ return iter->ReadString(result);
+ }
+ bool ReadWString(PickleIterator* iter,
+ std::wstring* result) const WARN_UNUSED_RESULT {
+ return iter->ReadWString(result);
+ }
+ bool ReadString16(PickleIterator* iter,
+ base::string16* result) const WARN_UNUSED_RESULT {
+ return iter->ReadString16(result);
+ }
+ // A pointer to the data will be placed in *data, and the length will be
+ // placed in *length. This buffer will be into the message's buffer so will
+ // be scoped to the lifetime of the message (or until the message data is
+ // mutated).
+ bool ReadData(PickleIterator* iter,
+ const char** data,
+ int* length) const WARN_UNUSED_RESULT {
+ return iter->ReadData(data, length);
+ }
+ // A pointer to the data will be placed in *data. The caller specifies the
+ // number of bytes to read, and ReadBytes will validate this length. The
+ // returned buffer will be into the message's buffer so will be scoped to the
+ // lifetime of the message (or until the message data is mutated).
+ bool ReadBytes(PickleIterator* iter,
+ const char** data,
+ int length) const WARN_UNUSED_RESULT {
+ return iter->ReadBytes(data, length);
+ }
+
+ // Safer version of ReadInt() checks for the result not being negative.
+ // Use it for reading the object sizes.
+ bool ReadLength(PickleIterator* iter,
+ int* result) const WARN_UNUSED_RESULT {
+ return iter->ReadLength(result);
+ }
+
// Methods for adding to the payload of the Pickle. These values are
// appended to the end of the Pickle's payload. When reading values from a
// Pickle, it is important to read them in the order in which they were added
// to the Pickle.
-
bool WriteBool(bool value) {
return WriteInt(value ? 1 : 0);
}
diff --git a/base/pickle_unittest.cc b/base/pickle_unittest.cc
index 1fa1f32..20a8d67 100644
--- a/base/pickle_unittest.cc
+++ b/base/pickle_unittest.cc
@@ -38,67 +38,67 @@ void VerifyResult(const Pickle& pickle) {
PickleIterator iter(pickle);
bool outbool;
- EXPECT_TRUE(iter.ReadBool(&outbool));
+ EXPECT_TRUE(pickle.ReadBool(&iter, &outbool));
EXPECT_FALSE(outbool);
- EXPECT_TRUE(iter.ReadBool(&outbool));
+ EXPECT_TRUE(pickle.ReadBool(&iter, &outbool));
EXPECT_TRUE(outbool);
int outint;
- EXPECT_TRUE(iter.ReadInt(&outint));
+ EXPECT_TRUE(pickle.ReadInt(&iter, &outint));
EXPECT_EQ(testint, outint);
long outlong;
- EXPECT_TRUE(iter.ReadLong(&outlong));
+ EXPECT_TRUE(pickle.ReadLong(&iter, &outlong));
EXPECT_EQ(testlong, outlong);
uint16 outuint16;
- EXPECT_TRUE(iter.ReadUInt16(&outuint16));
+ EXPECT_TRUE(pickle.ReadUInt16(&iter, &outuint16));
EXPECT_EQ(testuint16, outuint16);
uint32 outuint32;
- EXPECT_TRUE(iter.ReadUInt32(&outuint32));
+ EXPECT_TRUE(pickle.ReadUInt32(&iter, &outuint32));
EXPECT_EQ(testuint32, outuint32);
int64 outint64;
- EXPECT_TRUE(iter.ReadInt64(&outint64));
+ EXPECT_TRUE(pickle.ReadInt64(&iter, &outint64));
EXPECT_EQ(testint64, outint64);
uint64 outuint64;
- EXPECT_TRUE(iter.ReadUInt64(&outuint64));
+ EXPECT_TRUE(pickle.ReadUInt64(&iter, &outuint64));
EXPECT_EQ(testuint64, outuint64);
size_t outsizet;
- EXPECT_TRUE(iter.ReadSizeT(&outsizet));
+ EXPECT_TRUE(pickle.ReadSizeT(&iter, &outsizet));
EXPECT_EQ(testsizet, outsizet);
float outfloat;
- EXPECT_TRUE(iter.ReadFloat(&outfloat));
+ EXPECT_TRUE(pickle.ReadFloat(&iter, &outfloat));
EXPECT_EQ(testfloat, outfloat);
double outdouble;
- EXPECT_TRUE(iter.ReadDouble(&outdouble));
+ EXPECT_TRUE(pickle.ReadDouble(&iter, &outdouble));
EXPECT_EQ(testdouble, outdouble);
std::string outstring;
- EXPECT_TRUE(iter.ReadString(&outstring));
+ EXPECT_TRUE(pickle.ReadString(&iter, &outstring));
EXPECT_EQ(teststring, outstring);
std::wstring outwstring;
- EXPECT_TRUE(iter.ReadWString(&outwstring));
+ EXPECT_TRUE(pickle.ReadWString(&iter, &outwstring));
EXPECT_EQ(testwstring, outwstring);
base::string16 outstring16;
- EXPECT_TRUE(iter.ReadString16(&outstring16));
+ EXPECT_TRUE(pickle.ReadString16(&iter, &outstring16));
EXPECT_EQ(teststring16, outstring16);
const char* outdata;
int outdatalen;
- EXPECT_TRUE(iter.ReadData(&outdata, &outdatalen));
+ EXPECT_TRUE(pickle.ReadData(&iter, &outdata, &outdatalen));
EXPECT_EQ(testdatalen, outdatalen);
EXPECT_EQ(memcmp(testdata, outdata, outdatalen), 0);
// reads past the end should fail
- EXPECT_FALSE(iter.ReadInt(&outint));
+ EXPECT_FALSE(pickle.ReadInt(&iter, &outint));
}
} // namespace
@@ -148,9 +148,9 @@ TEST(PickleTest, SizeTFrom64Bit) {
if (sizeof(size_t) < sizeof(uint64)) {
// ReadSizeT() should return false when the original written value can't be
// represented as a size_t.
- EXPECT_FALSE(iter.ReadSizeT(&outsizet));
+ EXPECT_FALSE(pickle.ReadSizeT(&iter, &outsizet));
} else {
- EXPECT_TRUE(iter.ReadSizeT(&outsizet));
+ EXPECT_TRUE(pickle.ReadSizeT(&iter, &outsizet));
EXPECT_EQ(testuint64, outsizet);
}
}
@@ -164,7 +164,7 @@ TEST(PickleTest, SmallBuffer) {
PickleIterator iter(pickle);
int data;
- EXPECT_FALSE(iter.ReadInt(&data));
+ EXPECT_FALSE(pickle.ReadInt(&iter, &data));
}
// Tests that we can handle improper headers.
@@ -175,7 +175,7 @@ TEST(PickleTest, BigSize) {
PickleIterator iter(pickle);
int data;
- EXPECT_FALSE(iter.ReadInt(&data));
+ EXPECT_FALSE(pickle.ReadInt(&iter, &data));
}
TEST(PickleTest, UnalignedSize) {
@@ -185,7 +185,7 @@ TEST(PickleTest, UnalignedSize) {
PickleIterator iter(pickle);
int data;
- EXPECT_FALSE(iter.ReadInt(&data));
+ EXPECT_FALSE(pickle.ReadInt(&iter, &data));
}
TEST(PickleTest, ZeroLenStr) {
@@ -194,7 +194,7 @@ TEST(PickleTest, ZeroLenStr) {
PickleIterator iter(pickle);
std::string outstr;
- EXPECT_TRUE(iter.ReadString(&outstr));
+ EXPECT_TRUE(pickle.ReadString(&iter, &outstr));
EXPECT_EQ("", outstr);
}
@@ -204,7 +204,7 @@ TEST(PickleTest, ZeroLenWStr) {
PickleIterator iter(pickle);
std::string outstr;
- EXPECT_TRUE(iter.ReadString(&outstr));
+ EXPECT_TRUE(pickle.ReadString(&iter, &outstr));
EXPECT_EQ("", outstr);
}
@@ -214,7 +214,7 @@ TEST(PickleTest, BadLenStr) {
PickleIterator iter(pickle);
std::string outstr;
- EXPECT_FALSE(iter.ReadString(&outstr));
+ EXPECT_FALSE(pickle.ReadString(&iter, &outstr));
}
TEST(PickleTest, BadLenWStr) {
@@ -223,7 +223,7 @@ TEST(PickleTest, BadLenWStr) {
PickleIterator iter(pickle);
std::wstring woutstr;
- EXPECT_FALSE(iter.ReadWString(&woutstr));
+ EXPECT_FALSE(pickle.ReadWString(&iter, &woutstr));
}
TEST(PickleTest, FindNext) {
@@ -351,7 +351,7 @@ TEST(PickleTest, HeaderPadding) {
PickleIterator iter(pickle);
int result;
- ASSERT_TRUE(iter.ReadInt(&result));
+ ASSERT_TRUE(pickle.ReadInt(&iter, &result));
EXPECT_EQ(static_cast<uint32>(result), kMagic);
}
@@ -375,14 +375,14 @@ TEST(PickleTest, EvilLengths) {
// to out-of-bounds reading.
PickleIterator iter(source);
string16 str16;
- EXPECT_FALSE(iter.ReadString16(&str16));
+ EXPECT_FALSE(source.ReadString16(&iter, &str16));
// And check we didn't break ReadString16.
str16 = (wchar_t) 'A';
Pickle str16_pickle;
EXPECT_TRUE(str16_pickle.WriteString16(str16));
iter = PickleIterator(str16_pickle);
- EXPECT_TRUE(iter.ReadString16(&str16));
+ EXPECT_TRUE(str16_pickle.ReadString16(&iter, &str16));
EXPECT_EQ(1U, str16.length());
// Check we don't fail in a length check with invalid String16 size.
@@ -390,14 +390,14 @@ TEST(PickleTest, EvilLengths) {
Pickle bad_len;
EXPECT_TRUE(bad_len.WriteInt(1 << 31));
iter = PickleIterator(bad_len);
- EXPECT_FALSE(iter.ReadString16(&str16));
+ EXPECT_FALSE(bad_len.ReadString16(&iter, &str16));
// Check we don't fail in a length check with large WStrings.
Pickle big_len;
EXPECT_TRUE(big_len.WriteInt(1 << 30));
iter = PickleIterator(big_len);
std::wstring wstr;
- EXPECT_FALSE(iter.ReadWString(&wstr));
+ EXPECT_FALSE(big_len.ReadWString(&iter, &wstr));
}
// Check we can write zero bytes of data and 'data' can be NULL.
@@ -408,7 +408,7 @@ TEST(PickleTest, ZeroLength) {
PickleIterator iter(pickle);
const char* outdata;
int outdatalen;
- EXPECT_TRUE(iter.ReadData(&outdata, &outdatalen));
+ EXPECT_TRUE(pickle.ReadData(&iter, &outdata, &outdatalen));
EXPECT_EQ(0, outdatalen);
// We can't assert that outdata is NULL.
}
@@ -421,7 +421,7 @@ TEST(PickleTest, ReadBytes) {
PickleIterator iter(pickle);
const char* outdata_char = NULL;
- EXPECT_TRUE(iter.ReadBytes(&outdata_char, sizeof(data)));
+ EXPECT_TRUE(pickle.ReadBytes(&iter, &outdata_char, sizeof(data)));
int outdata;
memcpy(&outdata, outdata_char, sizeof(outdata));
diff --git a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
index 296ce46..c07b50a 100644
--- a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
+++ b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
@@ -83,7 +83,7 @@ class QuerySelectorHandler : public content::WebContentsObserver {
// There may be several requests in flight; check this response matches.
int message_request_id = 0;
PickleIterator iter(message);
- if (!iter.ReadInt(&message_request_id))
+ if (!message.ReadInt(&iter, &message_request_id))
return false;
if (message_request_id != request_id_)
diff --git a/chrome/browser/extensions/api/page_capture/page_capture_api.cc b/chrome/browser/extensions/api/page_capture/page_capture_api.cc
index 68c81f6..429e8c0 100644
--- a/chrome/browser/extensions/api/page_capture/page_capture_api.cc
+++ b/chrome/browser/extensions/api/page_capture/page_capture_api.cc
@@ -74,7 +74,7 @@ bool PageCaptureSaveAsMHTMLFunction::OnMessageReceived(
int message_request_id;
PickleIterator iter(message);
- if (!iter.ReadInt(&message_request_id)) {
+ if (!message.ReadInt(&iter, &message_request_id)) {
NOTREACHED() << "malformed extension message";
return true;
}
diff --git a/chrome/browser/ui/views/extensions/browser_action_drag_data.cc b/chrome/browser/ui/views/extensions/browser_action_drag_data.cc
index b4ae1fe..b54c036 100644
--- a/chrome/browser/ui/views/extensions/browser_action_drag_data.cc
+++ b/chrome/browser/ui/views/extensions/browser_action_drag_data.cc
@@ -92,15 +92,15 @@ bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) {
PickleIterator data_iterator(*pickle);
const char* tmp;
- if (!data_iterator.ReadBytes(&tmp, sizeof(profile_)))
+ if (!pickle->ReadBytes(&data_iterator, &tmp, sizeof(profile_)))
return false;
memcpy(&profile_, tmp, sizeof(profile_));
- if (!data_iterator.ReadString(&id_))
+ if (!pickle->ReadString(&data_iterator, &id_))
return false;
uint64 index;
- if (!data_iterator.ReadUInt64(&index))
+ if (!pickle->ReadUInt64(&data_iterator, &index))
return false;
index_ = static_cast<size_t>(index);
diff --git a/components/bookmarks/browser/bookmark_node_data.cc b/components/bookmarks/browser/bookmark_node_data.cc
index 5f134ee..2d6e064 100644
--- a/components/bookmarks/browser/bookmark_node_data.cc
+++ b/components/bookmarks/browser/bookmark_node_data.cc
@@ -57,12 +57,13 @@ void BookmarkNodeData::Element::WriteToPickle(Pickle* pickle) const {
}
}
-bool BookmarkNodeData::Element::ReadFromPickle(PickleIterator* iterator) {
+bool BookmarkNodeData::Element::ReadFromPickle(Pickle* pickle,
+ PickleIterator* iterator) {
std::string url_spec;
- if (!iterator->ReadBool(&is_url) ||
- !iterator->ReadString(&url_spec) ||
- !iterator->ReadString16(&title) ||
- !iterator->ReadInt64(&id_)) {
+ if (!pickle->ReadBool(iterator, &is_url) ||
+ !pickle->ReadString(iterator, &url_spec) ||
+ !pickle->ReadString16(iterator, &title) ||
+ !pickle->ReadInt64(iterator, &id_)) {
return false;
}
url = GURL(url_spec);
@@ -70,13 +71,13 @@ bool BookmarkNodeData::Element::ReadFromPickle(PickleIterator* iterator) {
date_folder_modified = base::Time();
meta_info_map.clear();
size_t meta_field_count;
- if (!iterator->ReadSizeT(&meta_field_count))
+ if (!pickle->ReadSizeT(iterator, &meta_field_count))
return false;
for (size_t i = 0; i < meta_field_count; ++i) {
std::string key;
std::string value;
- if (!iterator->ReadString(&key) ||
- !iterator->ReadString(&value)) {
+ if (!pickle->ReadString(iterator, &key) ||
+ !pickle->ReadString(iterator, &value)) {
return false;
}
meta_info_map[key] = value;
@@ -84,12 +85,12 @@ bool BookmarkNodeData::Element::ReadFromPickle(PickleIterator* iterator) {
children.clear();
if (!is_url) {
size_t children_count;
- if (!iterator->ReadSizeT(&children_count))
+ if (!pickle->ReadSizeT(iterator, &children_count))
return false;
children.reserve(children_count);
for (size_t i = 0; i < children_count; ++i) {
children.push_back(Element());
- if (!children.back().ReadFromPickle(iterator))
+ if (!children.back().ReadFromPickle(pickle, iterator))
return false;
}
}
@@ -244,11 +245,11 @@ bool BookmarkNodeData::ReadFromPickle(Pickle* pickle) {
PickleIterator data_iterator(*pickle);
size_t element_count;
if (profile_path_.ReadFromPickle(&data_iterator) &&
- data_iterator.ReadSizeT(&element_count)) {
+ pickle->ReadSizeT(&data_iterator, &element_count)) {
std::vector<Element> tmp_elements;
tmp_elements.resize(element_count);
for (size_t i = 0; i < element_count; ++i) {
- if (!tmp_elements[i].ReadFromPickle(&data_iterator)) {
+ if (!tmp_elements[i].ReadFromPickle(pickle, &data_iterator)) {
return false;
}
}
diff --git a/components/bookmarks/browser/bookmark_node_data.h b/components/bookmarks/browser/bookmark_node_data.h
index 47e85f6..c44594e1 100644
--- a/components/bookmarks/browser/bookmark_node_data.h
+++ b/components/bookmarks/browser/bookmark_node_data.h
@@ -77,7 +77,7 @@ struct BookmarkNodeData {
// For reading/writing this Element.
void WriteToPickle(Pickle* pickle) const;
- bool ReadFromPickle(PickleIterator* iterator);
+ bool ReadFromPickle(Pickle* pickle, PickleIterator* iterator);
// ID of the node.
int64 id_;
diff --git a/components/sessions/base_session_service_commands.cc b/components/sessions/base_session_service_commands.cc
index 09eab43..c0ae0a3 100644
--- a/components/sessions/base_session_service_commands.cc
+++ b/components/sessions/base_session_service_commands.cc
@@ -109,7 +109,8 @@ bool RestoreUpdateTabNavigationCommand(
if (!pickle.get())
return false;
PickleIterator iterator(*pickle);
- return iterator.ReadInt(tab_id) && navigation->ReadFromPickle(&iterator);
+ return pickle->ReadInt(&iterator, tab_id) &&
+ navigation->ReadFromPickle(&iterator);
}
bool RestoreSetTabExtensionAppIDCommand(const SessionCommand& command,
@@ -120,7 +121,8 @@ bool RestoreSetTabExtensionAppIDCommand(const SessionCommand& command,
return false;
PickleIterator iterator(*pickle);
- return iterator.ReadInt(tab_id) && iterator.ReadString(extension_app_id);
+ return pickle->ReadInt(&iterator, tab_id) &&
+ pickle->ReadString(&iterator, extension_app_id);
}
bool RestoreSetTabUserAgentOverrideCommand(const SessionCommand& command,
@@ -131,7 +133,8 @@ bool RestoreSetTabUserAgentOverrideCommand(const SessionCommand& command,
return false;
PickleIterator iterator(*pickle);
- return iterator.ReadInt(tab_id) && iterator.ReadString(user_agent_override);
+ return pickle->ReadInt(&iterator, tab_id) &&
+ pickle->ReadString(&iterator, user_agent_override);
}
bool RestoreSetWindowAppNameCommand(const SessionCommand& command,
@@ -142,7 +145,8 @@ bool RestoreSetWindowAppNameCommand(const SessionCommand& command,
return false;
PickleIterator iterator(*pickle);
- return iterator.ReadInt(window_id) && iterator.ReadString(app_name);
+ return pickle->ReadInt(&iterator, window_id) &&
+ pickle->ReadString(&iterator, app_name);
}
} // namespace sessions
diff --git a/components/sessions/session_service_commands.cc b/components/sessions/session_service_commands.cc
index 3b5f8a1..00be34b 100644
--- a/components/sessions/session_service_commands.cc
+++ b/components/sessions/session_service_commands.cc
@@ -534,8 +534,8 @@ bool CreateTabsAndWindows(const ScopedVector<SessionCommand>& data,
SessionID::id_type command_tab_id;
std::string session_storage_persistent_id;
PickleIterator iter(*command_pickle.get());
- if (!iter.ReadInt(&command_tab_id) ||
- !iter.ReadString(&session_storage_persistent_id))
+ if (!command_pickle->ReadInt(&iter, &command_tab_id) ||
+ !command_pickle->ReadString(&iter, &session_storage_persistent_id))
return true;
// Associate the session storage back.
GetTab(command_tab_id, tabs)->session_storage_persistent_id =
@@ -775,8 +775,8 @@ bool ReplacePendingCommand(BaseSessionService* base_session_service,
PickleIterator iterator(*command_pickle);
SessionID::id_type command_tab_id;
int command_nav_index;
- if (!iterator.ReadInt(&command_tab_id) ||
- !iterator.ReadInt(&command_nav_index)) {
+ if (!command_pickle->ReadInt(&iterator, &command_tab_id) ||
+ !command_pickle->ReadInt(&iterator, &command_nav_index)) {
return false;
}
SessionID::id_type existing_tab_id;
@@ -787,8 +787,8 @@ bool ReplacePendingCommand(BaseSessionService* base_session_service,
// the pickle references deleted memory.
scoped_ptr<Pickle> existing_pickle(existing_command->PayloadAsPickle());
iterator = PickleIterator(*existing_pickle);
- if (!iterator.ReadInt(&existing_tab_id) ||
- !iterator.ReadInt(&existing_nav_index)) {
+ if (!existing_pickle->ReadInt(&iterator, &existing_tab_id) ||
+ !existing_pickle->ReadInt(&iterator, &existing_nav_index)) {
return false;
}
}
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc
index a9b4bc7..0e1c63d 100644
--- a/content/browser/loader/resource_dispatcher_host_unittest.cc
+++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -94,7 +94,7 @@ void ReleaseHandlesInMessage(const IPC::Message& message) {
if (message.type() == ResourceMsg_SetDataBuffer::ID) {
PickleIterator iter(message);
int request_id;
- CHECK(iter.ReadInt(&request_id));
+ CHECK(message.ReadInt(&iter, &request_id));
base::SharedMemoryHandle shm_handle;
if (IPC::ParamTraits<base::SharedMemoryHandle>::Read(&message,
&iter,
diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc
index 3fa0b93..c8816ff 100644
--- a/content/browser/renderer_host/input/input_router_impl_unittest.cc
+++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -49,7 +49,7 @@ const WebInputEvent* GetInputEventFromMessage(const IPC::Message& message) {
PickleIterator iter(message);
const char* data;
int data_length;
- if (!iter.ReadData(&data, &data_length))
+ if (!message.ReadData(&iter, &data, &data_length))
return NULL;
return reinterpret_cast<const WebInputEvent*>(data);
}
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index 4e35409..1dfe920 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -591,7 +591,7 @@ class RenderWidgetHostTest : public testing::Test {
PickleIterator iter(message);
const char* data;
int data_length;
- if (!iter.ReadData(&data, &data_length))
+ if (!message.ReadData(&iter, &data, &data_length))
return NULL;
return reinterpret_cast<const WebInputEvent*>(data);
}
diff --git a/content/browser/renderer_host/sandbox_ipc_linux.cc b/content/browser/renderer_host/sandbox_ipc_linux.cc
index 1437321..b2e024e 100644
--- a/content/browser/renderer_host/sandbox_ipc_linux.cc
+++ b/content/browser/renderer_host/sandbox_ipc_linux.cc
@@ -144,23 +144,23 @@ void SandboxIPCHandler::HandleRequestFromRenderer(int fd) {
PickleIterator iter(pickle);
int kind;
- if (!iter.ReadInt(&kind))
+ if (!pickle.ReadInt(&iter, &kind))
return;
if (kind == FontConfigIPC::METHOD_MATCH) {
- HandleFontMatchRequest(fd, iter, fds.get());
+ HandleFontMatchRequest(fd, pickle, iter, fds.get());
} else if (kind == FontConfigIPC::METHOD_OPEN) {
- HandleFontOpenRequest(fd, iter, fds.get());
+ HandleFontOpenRequest(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_GET_FALLBACK_FONT_FOR_CHAR) {
- HandleGetFallbackFontForChar(fd, iter, fds.get());
+ HandleGetFallbackFontForChar(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_LOCALTIME) {
- HandleLocaltime(fd, iter, fds.get());
+ HandleLocaltime(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_GET_STYLE_FOR_STRIKE) {
- HandleGetStyleForStrike(fd, iter, fds.get());
+ HandleGetStyleForStrike(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT) {
- HandleMakeSharedMemorySegment(fd, iter, fds.get());
+ HandleMakeSharedMemorySegment(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_MATCH_WITH_FALLBACK) {
- HandleMatchWithFallback(fd, iter, fds.get());
+ HandleMatchWithFallback(fd, pickle, iter, fds.get());
}
}
@@ -176,11 +176,13 @@ int SandboxIPCHandler::FindOrAddPath(const SkString& path) {
void SandboxIPCHandler::HandleFontMatchRequest(
int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds) {
uint32_t requested_style;
std::string family;
- if (!iter.ReadString(&family) || !iter.ReadUInt32(&requested_style))
+ if (!pickle.ReadString(&iter, &family) ||
+ !pickle.ReadUInt32(&iter, &requested_style))
return;
SkFontConfigInterface::FontIdentity result_identity;
@@ -214,10 +216,11 @@ void SandboxIPCHandler::HandleFontMatchRequest(
void SandboxIPCHandler::HandleFontOpenRequest(
int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds) {
uint32_t index;
- if (!iter.ReadUInt32(&index))
+ if (!pickle.ReadUInt32(&iter, &index))
return;
if (index >= static_cast<uint32_t>(paths_.count()))
return;
@@ -242,6 +245,7 @@ void SandboxIPCHandler::HandleFontOpenRequest(
void SandboxIPCHandler::HandleGetFallbackFontForChar(
int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds) {
// The other side of this call is
@@ -249,11 +253,11 @@ void SandboxIPCHandler::HandleGetFallbackFontForChar(
EnsureWebKitInitialized();
WebUChar32 c;
- if (!iter.ReadInt(&c))
+ if (!pickle.ReadInt(&iter, &c))
return;
std::string preferred_locale;
- if (!iter.ReadString(&preferred_locale))
+ if (!pickle.ReadString(&iter, &preferred_locale))
return;
blink::WebFallbackFont fallbackFont;
@@ -282,16 +286,17 @@ void SandboxIPCHandler::HandleGetFallbackFontForChar(
void SandboxIPCHandler::HandleGetStyleForStrike(
int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds) {
std::string family;
bool bold, italic;
uint16 pixel_size;
- if (!iter.ReadString(&family) ||
- !iter.ReadBool(&bold) ||
- !iter.ReadBool(&italic) ||
- !iter.ReadUInt16(&pixel_size)) {
+ if (!pickle.ReadString(&iter, &family) ||
+ !pickle.ReadBool(&iter, &bold) ||
+ !pickle.ReadBool(&iter, &italic) ||
+ !pickle.ReadUInt16(&iter, &pixel_size)) {
return;
}
@@ -320,13 +325,16 @@ void SandboxIPCHandler::HandleGetStyleForStrike(
void SandboxIPCHandler::HandleLocaltime(
int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds) {
// The other side of this call is in zygote_main_linux.cc
std::string time_string;
- if (!iter.ReadString(&time_string) || time_string.size() != sizeof(time_t))
+ if (!pickle.ReadString(&iter, &time_string) ||
+ time_string.size() != sizeof(time_t)) {
return;
+ }
time_t time;
memcpy(&time, time_string.data(), sizeof(time));
@@ -350,14 +358,15 @@ void SandboxIPCHandler::HandleLocaltime(
void SandboxIPCHandler::HandleMakeSharedMemorySegment(
int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds) {
base::SharedMemoryCreateOptions options;
uint32_t size;
- if (!iter.ReadUInt32(&size))
+ if (!pickle.ReadUInt32(&iter, &size))
return;
options.size = size;
- if (!iter.ReadBool(&options.executable))
+ if (!pickle.ReadBool(&iter, &options.executable))
return;
int shm_fd = -1;
base::SharedMemory shm;
@@ -369,17 +378,18 @@ void SandboxIPCHandler::HandleMakeSharedMemorySegment(
void SandboxIPCHandler::HandleMatchWithFallback(
int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds) {
std::string face;
bool is_bold, is_italic;
uint32 charset, fallback_family;
- if (!iter.ReadString(&face) || face.empty() ||
- !iter.ReadBool(&is_bold) ||
- !iter.ReadBool(&is_italic) ||
- !iter.ReadUInt32(&charset) ||
- !iter.ReadUInt32(&fallback_family)) {
+ if (!pickle.ReadString(&iter, &face) || face.empty() ||
+ !pickle.ReadBool(&iter, &is_bold) ||
+ !pickle.ReadBool(&iter, &is_italic) ||
+ !pickle.ReadUInt32(&iter, &charset) ||
+ !pickle.ReadUInt32(&iter, &fallback_family)) {
return;
}
diff --git a/content/browser/renderer_host/sandbox_ipc_linux.h b/content/browser/renderer_host/sandbox_ipc_linux.h
index f8cc075..e6ac19bb 100644
--- a/content/browser/renderer_host/sandbox_ipc_linux.h
+++ b/content/browser/renderer_host/sandbox_ipc_linux.h
@@ -36,30 +36,37 @@ class SandboxIPCHandler : public base::DelegateSimpleThread::Delegate {
void HandleRequestFromRenderer(int fd);
void HandleFontMatchRequest(int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds);
void HandleFontOpenRequest(int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds);
void HandleGetFallbackFontForChar(int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds);
void HandleGetStyleForStrike(int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds);
void HandleLocaltime(int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds);
void HandleMakeSharedMemorySegment(int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds);
void HandleMatchWithFallback(int fd,
+ const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds);
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index 5b976ba..acfa2d33 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -322,14 +322,15 @@ bool ReadFileSystemFilesFromPickle(
PickleIterator iter(pickle);
size_t num_files = 0;
- if (!iter.ReadSizeT(&num_files))
+ if (!pickle.ReadSizeT(&iter, &num_files))
return false;
file_system_files->resize(num_files);
for (size_t i = 0; i < num_files; ++i) {
std::string url_string;
int64 size = 0;
- if (!iter.ReadString(&url_string) || !iter.ReadInt64(&size))
+ if (!pickle.ReadString(&iter, &url_string) ||
+ !pickle.ReadInt64(&iter, &size))
return false;
GURL url(url_string);
diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc
index f7774e55..c2f1c90 100644
--- a/content/browser/zygote_host/zygote_host_impl_linux.cc
+++ b/content/browser/zygote_host/zygote_host_impl_linux.cc
@@ -369,7 +369,7 @@ pid_t ZygoteHostImpl::ForkRequest(const std::vector<std::string>& argv,
Pickle reply_pickle(buf, len);
PickleIterator iter(reply_pickle);
- if (len <= 0 || !iter.ReadInt(&pid))
+ if (len <= 0 || !reply_pickle.ReadInt(&iter, &pid))
return base::kNullProcessHandle;
// If there is a nonempty UMA name string, then there is a UMA
@@ -377,10 +377,10 @@ pid_t ZygoteHostImpl::ForkRequest(const std::vector<std::string>& argv,
std::string uma_name;
int uma_sample;
int uma_boundary_value;
- if (iter.ReadString(&uma_name) &&
+ if (reply_pickle.ReadString(&iter, &uma_name) &&
!uma_name.empty() &&
- iter.ReadInt(&uma_sample) &&
- iter.ReadInt(&uma_boundary_value)) {
+ reply_pickle.ReadInt(&iter, &uma_sample) &&
+ reply_pickle.ReadInt(&iter, &uma_boundary_value)) {
// We cannot use the UMA_HISTOGRAM_ENUMERATION macro here,
// because that's only for when the name is the same every time.
// Here we're using whatever name we got from the other side.
@@ -532,7 +532,8 @@ base::TerminationStatus ZygoteHostImpl::GetTerminationStatus(
Pickle read_pickle(buf, len);
int tmp_status, tmp_exit_code;
PickleIterator iter(read_pickle);
- if (!iter.ReadInt(&tmp_status) || !iter.ReadInt(&tmp_exit_code)) {
+ if (!read_pickle.ReadInt(&iter, &tmp_status) ||
+ !read_pickle.ReadInt(&iter, &tmp_exit_code)) {
LOG(WARNING)
<< "Error parsing GetTerminationStatus response from zygote.";
} else {
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
index 7cbc7fa..e5fb19a 100644
--- a/content/child/resource_dispatcher.cc
+++ b/content/child/resource_dispatcher.cc
@@ -311,7 +311,7 @@ bool ResourceDispatcher::OnMessageReceived(const IPC::Message& message) {
int request_id;
PickleIterator iter(message);
- if (!iter.ReadInt(&request_id)) {
+ if (!message.ReadInt(&iter, &request_id)) {
NOTREACHED() << "malformed resource message";
return true;
}
@@ -874,7 +874,7 @@ void ResourceDispatcher::ReleaseResourcesInDataMessage(
const IPC::Message& message) {
PickleIterator iter(message);
int request_id;
- if (!iter.ReadInt(&request_id)) {
+ if (!message.ReadInt(&iter, &request_id)) {
NOTREACHED() << "malformed resource message";
return;
}
diff --git a/content/child/threaded_data_provider.cc b/content/child/threaded_data_provider.cc
index ccfe891..5d93a19 100644
--- a/content/child/threaded_data_provider.cc
+++ b/content/child/threaded_data_provider.cc
@@ -87,7 +87,7 @@ bool DataProviderMessageFilter::OnMessageReceived(
int request_id;
PickleIterator iter(message);
- if (!iter.ReadInt(&request_id)) {
+ if (!message.ReadInt(&iter, &request_id)) {
NOTREACHED() << "malformed resource message";
return true;
}
diff --git a/content/common/cc_messages.cc b/content/common/cc_messages.cc
index 29294db..426cee2 100644
--- a/content/common/cc_messages.cc
+++ b/content/common/cc_messages.cc
@@ -228,7 +228,7 @@ bool ParamTraits<skia::RefPtr<SkImageFilter> >::Read(
const Message* m, PickleIterator* iter, param_type* r) {
const char* data = 0;
int length = 0;
- if (!iter->ReadData(&data, &length))
+ if (!m->ReadData(iter, &data, &length))
return false;
if (length > 0) {
SkFlattenable* flattenable = SkValidatingDeserializeFlattenable(
@@ -262,7 +262,7 @@ void ParamTraits<gfx::Transform>::Write(
bool ParamTraits<gfx::Transform>::Read(
const Message* m, PickleIterator* iter, param_type* r) {
const char* column_major_data;
- if (!iter->ReadBytes(&column_major_data, sizeof(SkMScalar) * 16))
+ if (!m->ReadBytes(iter, &column_major_data, sizeof(SkMScalar) * 16))
return false;
r->matrix().setColMajor(
reinterpret_cast<const SkMScalar*>(column_major_data));
diff --git a/content/common/child_process_sandbox_support_impl_linux.cc b/content/common/child_process_sandbox_support_impl_linux.cc
index 3ee77a8..4240f15 100644
--- a/content/common/child_process_sandbox_support_impl_linux.cc
+++ b/content/common/child_process_sandbox_support_impl_linux.cc
@@ -45,12 +45,12 @@ void GetFallbackFontForCharacter(int32_t character,
if (n != -1) {
Pickle reply(reinterpret_cast<char*>(buf), n);
PickleIterator pickle_iter(reply);
- if (pickle_iter.ReadString(&family_name) &&
- pickle_iter.ReadString(&filename) &&
- pickle_iter.ReadInt(&fontconfigInterfaceId) &&
- pickle_iter.ReadInt(&ttcIndex) &&
- pickle_iter.ReadBool(&isBold) &&
- pickle_iter.ReadBool(&isItalic)) {
+ if (reply.ReadString(&pickle_iter, &family_name) &&
+ reply.ReadString(&pickle_iter, &filename) &&
+ reply.ReadInt(&pickle_iter, &fontconfigInterfaceId) &&
+ reply.ReadInt(&pickle_iter, &ttcIndex) &&
+ reply.ReadBool(&pickle_iter, &isBold) &&
+ reply.ReadBool(&pickle_iter, &isItalic)) {
fallbackFont->name = family_name;
fallbackFont->filename = filename;
fallbackFont->fontconfigInterfaceId = fontconfigInterfaceId;
@@ -94,13 +94,13 @@ void GetRenderStyleForStrike(const char* family,
PickleIterator pickle_iter(reply);
int use_bitmaps, use_autohint, use_hinting, hint_style, use_antialias;
int use_subpixel_rendering, use_subpixel_positioning;
- if (pickle_iter.ReadInt(&use_bitmaps) &&
- pickle_iter.ReadInt(&use_autohint) &&
- pickle_iter.ReadInt(&use_hinting) &&
- pickle_iter.ReadInt(&hint_style) &&
- pickle_iter.ReadInt(&use_antialias) &&
- pickle_iter.ReadInt(&use_subpixel_rendering) &&
- pickle_iter.ReadInt(&use_subpixel_positioning)) {
+ if (reply.ReadInt(&pickle_iter, &use_bitmaps) &&
+ reply.ReadInt(&pickle_iter, &use_autohint) &&
+ reply.ReadInt(&pickle_iter, &use_hinting) &&
+ reply.ReadInt(&pickle_iter, &hint_style) &&
+ reply.ReadInt(&pickle_iter, &use_antialias) &&
+ reply.ReadInt(&pickle_iter, &use_subpixel_rendering) &&
+ reply.ReadInt(&pickle_iter, &use_subpixel_positioning)) {
out->useBitmaps = use_bitmaps;
out->useAutoHint = use_autohint;
out->useHinting = use_hinting;
diff --git a/content/common/common_param_traits_unittest.cc b/content/common/common_param_traits_unittest.cc
index 25827e8..c1f763a 100644
--- a/content/common/common_param_traits_unittest.cc
+++ b/content/common/common_param_traits_unittest.cc
@@ -109,7 +109,7 @@ TEST(IPCMessageTest, Bitmap) {
const char* fixed_data;
int fixed_data_size;
iter = PickleIterator(msg);
- EXPECT_TRUE(iter.ReadData(&fixed_data, &fixed_data_size));
+ EXPECT_TRUE(msg.ReadData(&iter, &fixed_data, &fixed_data_size));
bad_msg.WriteData(fixed_data, fixed_data_size);
// Add some bogus pixel data.
const size_t bogus_pixels_size = bitmap.getSize() * 2;
diff --git a/content/common/content_param_traits.cc b/content/common/content_param_traits.cc
index 21e188b..0f1ba05 100644
--- a/content/common/content_param_traits.cc
+++ b/content/common/content_param_traits.cc
@@ -20,7 +20,7 @@ bool ParamTraits<gfx::Range>::Read(const Message* m,
PickleIterator* iter,
gfx::Range* r) {
size_t start, end;
- if (!iter->ReadSizeT(&start) || !iter->ReadSizeT(&end))
+ if (!m->ReadSizeT(iter, &start) || !m->ReadSizeT(iter, &end))
return false;
r->set_start(start);
r->set_end(end);
@@ -40,7 +40,7 @@ bool ParamTraits<WebInputEventPointer>::Read(const Message* m,
param_type* r) {
const char* data;
int data_length;
- if (!iter->ReadData(&data, &data_length)) {
+ if (!m->ReadData(iter, &data, &data_length)) {
NOTREACHED();
return false;
}
diff --git a/content/common/font_config_ipc_linux.cc b/content/common/font_config_ipc_linux.cc
index c64aebf..fcb06eb 100644
--- a/content/common/font_config_ipc_linux.cc
+++ b/content/common/font_config_ipc_linux.cc
@@ -70,7 +70,7 @@ bool FontConfigIPC::matchFamilyName(const char familyName[],
Pickle reply(reinterpret_cast<char*>(reply_buf), r);
PickleIterator iter(reply);
bool result;
- if (!iter.ReadBool(&result))
+ if (!reply.ReadBool(&iter, &result))
return false;
if (!result)
return false;
@@ -78,9 +78,9 @@ bool FontConfigIPC::matchFamilyName(const char familyName[],
SkString reply_family;
FontIdentity reply_identity;
uint32_t reply_style;
- if (!skia::ReadSkString(&iter, &reply_family) ||
- !skia::ReadSkFontIdentity(&iter, &reply_identity) ||
- !iter.ReadUInt32(&reply_style)) {
+ if (!skia::ReadSkString(reply, &iter, &reply_family) ||
+ !skia::ReadSkFontIdentity(reply, &iter, &reply_identity) ||
+ !reply.ReadUInt32(&iter, &reply_style)) {
return false;
}
@@ -112,7 +112,8 @@ SkStream* FontConfigIPC::openStream(const FontIdentity& identity) {
Pickle reply(reinterpret_cast<char*>(reply_buf), r);
bool result;
PickleIterator iter(reply);
- if (!iter.ReadBool(&result) || !result) {
+ if (!reply.ReadBool(&iter, &result) ||
+ !result) {
if (result_fd)
CloseFD(result_fd);
return NULL;
diff --git a/content/common/gamepad_param_traits.cc b/content/common/gamepad_param_traits.cc
index cc60d7c..356d875 100644
--- a/content/common/gamepad_param_traits.cc
+++ b/content/common/gamepad_param_traits.cc
@@ -42,7 +42,7 @@ bool ParamTraits<WebGamepad>::Read(
WebGamepad* p) {
int length;
const char* data;
- if (!iter->ReadData(&data, &length) || length != sizeof(WebGamepad))
+ if (!m->ReadData(iter, &data, &length) || length != sizeof(WebGamepad))
return false;
memcpy(p, data, sizeof(WebGamepad));
diff --git a/content/common/media/media_param_traits.cc b/content/common/media/media_param_traits.cc
index 43d505e..405e89d 100644
--- a/content/common/media/media_param_traits.cc
+++ b/content/common/media/media_param_traits.cc
@@ -33,13 +33,13 @@ bool ParamTraits<AudioParameters>::Read(const Message* m,
int format, channel_layout, sample_rate, bits_per_sample,
frames_per_buffer, channels, effects;
- if (!iter->ReadInt(&format) ||
- !iter->ReadInt(&channel_layout) ||
- !iter->ReadInt(&sample_rate) ||
- !iter->ReadInt(&bits_per_sample) ||
- !iter->ReadInt(&frames_per_buffer) ||
- !iter->ReadInt(&channels) ||
- !iter->ReadInt(&effects))
+ if (!m->ReadInt(iter, &format) ||
+ !m->ReadInt(iter, &channel_layout) ||
+ !m->ReadInt(iter, &sample_rate) ||
+ !m->ReadInt(iter, &bits_per_sample) ||
+ !m->ReadInt(iter, &frames_per_buffer) ||
+ !m->ReadInt(iter, &channels) ||
+ !m->ReadInt(iter, &effects))
return false;
AudioParameters params(static_cast<AudioParameters::Format>(format),
@@ -69,10 +69,10 @@ bool ParamTraits<VideoCaptureFormat>::Read(const Message* m,
PickleIterator* iter,
VideoCaptureFormat* r) {
int frame_size_width, frame_size_height, pixel_format;
- if (!iter->ReadInt(&frame_size_width) ||
- !iter->ReadInt(&frame_size_height) ||
- !iter->ReadFloat(&r->frame_rate) ||
- !iter->ReadInt(&pixel_format))
+ if (!m->ReadInt(iter, &frame_size_width) ||
+ !m->ReadInt(iter, &frame_size_height) ||
+ !m->ReadFloat(iter, &r->frame_rate) ||
+ !m->ReadInt(iter, &pixel_format))
return false;
r->frame_size.SetSize(frame_size_width, frame_size_height);
diff --git a/content/common/page_state_serialization.cc b/content/common/page_state_serialization.cc
index 4d9ea3b..d99830a 100644
--- a/content/common/page_state_serialization.cc
+++ b/content/common/page_state_serialization.cc
@@ -211,7 +211,7 @@ void WriteData(const void* data, int length, SerializeObject* obj) {
void ReadData(SerializeObject* obj, const void** data, int* length) {
const char* tmp;
- if (obj->iter.ReadData(&tmp, length)) {
+ if (obj->pickle.ReadData(&obj->iter, &tmp, length)) {
*data = tmp;
} else {
obj->parse_error = true;
@@ -226,7 +226,7 @@ void WriteInteger(int data, SerializeObject* obj) {
int ReadInteger(SerializeObject* obj) {
int tmp;
- if (obj->iter.ReadInt(&tmp))
+ if (obj->pickle.ReadInt(&obj->iter, &tmp))
return tmp;
obj->parse_error = true;
return 0;
@@ -238,7 +238,7 @@ void WriteInteger64(int64 data, SerializeObject* obj) {
int64 ReadInteger64(SerializeObject* obj) {
int64 tmp = 0;
- if (obj->iter.ReadInt64(&tmp))
+ if (obj->pickle.ReadInt64(&obj->iter, &tmp))
return tmp;
obj->parse_error = true;
return 0;
@@ -268,7 +268,7 @@ void WriteBoolean(bool data, SerializeObject* obj) {
bool ReadBoolean(SerializeObject* obj) {
bool tmp;
- if (obj->iter.ReadBool(&tmp))
+ if (obj->pickle.ReadBool(&obj->iter, &tmp))
return tmp;
obj->parse_error = true;
return false;
@@ -280,7 +280,7 @@ void WriteGURL(const GURL& url, SerializeObject* obj) {
GURL ReadGURL(SerializeObject* obj) {
std::string spec;
- if (obj->iter.ReadString(&spec))
+ if (obj->pickle.ReadString(&obj->iter, &spec))
return GURL(spec);
obj->parse_error = true;
return GURL();
@@ -292,7 +292,7 @@ void WriteStdString(const std::string& s, SerializeObject* obj) {
std::string ReadStdString(SerializeObject* obj) {
std::string s;
- if (obj->iter.ReadString(&s))
+ if (obj->pickle.ReadString(&obj->iter, &s))
return s;
obj->parse_error = true;
return std::string();
@@ -319,7 +319,7 @@ void WriteString(const base::NullableString16& str, SerializeObject* obj) {
// read, NULL is returned.
const base::char16* ReadStringNoCopy(SerializeObject* obj, int* num_chars) {
int length_in_bytes;
- if (!obj->iter.ReadInt(&length_in_bytes)) {
+ if (!obj->pickle.ReadInt(&obj->iter, &length_in_bytes)) {
obj->parse_error = true;
return NULL;
}
@@ -328,7 +328,7 @@ const base::char16* ReadStringNoCopy(SerializeObject* obj, int* num_chars) {
return NULL;
const char* data;
- if (!obj->iter.ReadBytes(&data, length_in_bytes)) {
+ if (!obj->pickle.ReadBytes(&obj->iter, &data, length_in_bytes)) {
obj->parse_error = true;
return NULL;
}
diff --git a/content/common/resource_messages.cc b/content/common/resource_messages.cc
index 6fcda2ab..1e7632d 100644
--- a/content/common/resource_messages.cc
+++ b/content/common/resource_messages.cc
@@ -24,7 +24,7 @@ bool ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Read(
if (!ReadParam(m, iter, &has_object))
return false;
if (has_object)
- *r = new net::HttpResponseHeaders(iter);
+ *r = new net::HttpResponseHeaders(*m, iter);
return true;
}
@@ -74,7 +74,7 @@ bool ParamTraits<storage::DataElement>::Read(const Message* m,
case storage::DataElement::TYPE_BYTES: {
const char* data;
int len;
- if (!iter->ReadData(&data, &len))
+ if (!m->ReadData(iter, &data, &len))
return false;
r->SetToBytes(data, len);
break;
diff --git a/content/common/ssl_status_serialization.cc b/content/common/ssl_status_serialization.cc
index 0e2e4d2..d10b1b8 100644
--- a/content/common/ssl_status_serialization.cc
+++ b/content/common/ssl_status_serialization.cc
@@ -54,17 +54,18 @@ bool DeserializeSecurityInfo(
Pickle pickle(state.data(), static_cast<int>(state.size()));
PickleIterator iter(pickle);
int num_scts_to_read;
- if (!iter.ReadInt(cert_id) ||
- !iter.ReadUInt32(cert_status) ||
- !iter.ReadInt(security_bits) ||
- !iter.ReadInt(ssl_connection_status) ||
- !iter.ReadInt(&num_scts_to_read))
+ if (!pickle.ReadInt(&iter, cert_id) ||
+ !pickle.ReadUInt32(&iter, cert_status) ||
+ !pickle.ReadInt(&iter, security_bits) ||
+ !pickle.ReadInt(&iter, ssl_connection_status) ||
+ !pickle.ReadInt(&iter, &num_scts_to_read))
return false;
for (; num_scts_to_read > 0; --num_scts_to_read) {
int id;
uint16 status;
- if (!iter.ReadInt(&id) || !iter.ReadUInt16(&status))
+ if (!pickle.ReadInt(&iter, &id) ||
+ !pickle.ReadUInt16(&iter, &status))
return false;
signed_certificate_timestamp_ids->push_back(
SignedCertificateTimestampIDAndStatus(
diff --git a/content/public/common/common_param_traits.cc b/content/public/common/common_param_traits.cc
index a0b5bd3..dcdb7cf 100644
--- a/content/public/common/common_param_traits.cc
+++ b/content/public/common/common_param_traits.cc
@@ -35,7 +35,7 @@ void ParamTraits<GURL>::Write(Message* m, const GURL& p) {
bool ParamTraits<GURL>::Read(const Message* m, PickleIterator* iter, GURL* p) {
std::string s;
- if (!iter->ReadString(&s) || s.length() > content::GetMaxURLChars()) {
+ if (!m->ReadString(iter, &s) || s.length() > content::GetMaxURLChars()) {
*p = GURL();
return false;
}
@@ -60,7 +60,7 @@ bool ParamTraits<url::Origin>::Read(const Message* m,
PickleIterator* iter,
url::Origin* p) {
std::string s;
- if (!iter->ReadString(&s)) {
+ if (!m->ReadString(iter, &s)) {
*p = url::Origin();
return false;
}
diff --git a/content/public/common/common_param_traits.h b/content/public/common/common_param_traits.h
index 52d7a2f..657ef64 100644
--- a/content/public/common/common_param_traits.h
+++ b/content/public/common/common_param_traits.h
@@ -89,11 +89,11 @@ struct ParamTraits<gfx::NativeWindow> {
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
#if defined(OS_WIN)
- return iter->ReadUInt32(reinterpret_cast<uint32*>(r));
+ return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r));
#else
const char *data;
int data_size = 0;
- bool result = iter->ReadData(&data, &data_size);
+ bool result = m->ReadData(iter, &data, &data_size);
if (result && data_size == sizeof(gfx::NativeWindow)) {
memcpy(r, data, sizeof(gfx::NativeWindow));
} else {
diff --git a/content/zygote/zygote_linux.cc b/content/zygote/zygote_linux.cc
index e9b940e..c108ad7 100644
--- a/content/zygote/zygote_linux.cc
+++ b/content/zygote/zygote_linux.cc
@@ -185,24 +185,24 @@ bool Zygote::HandleRequestFromBrowser(int fd) {
PickleIterator iter(pickle);
int kind;
- if (iter.ReadInt(&kind)) {
+ if (pickle.ReadInt(&iter, &kind)) {
switch (kind) {
case kZygoteCommandFork:
// This function call can return multiple times, once per fork().
- return HandleForkRequest(fd, iter, fds.Pass());
+ return HandleForkRequest(fd, pickle, iter, fds.Pass());
case kZygoteCommandReap:
if (!fds.empty())
break;
- HandleReapRequest(fd, iter);
+ HandleReapRequest(fd, pickle, iter);
return false;
case kZygoteCommandGetTerminationStatus:
if (!fds.empty())
break;
- HandleGetTerminationStatus(fd, iter);
+ HandleGetTerminationStatus(fd, pickle, iter);
return false;
case kZygoteCommandGetSandboxStatus:
- HandleGetSandboxStatus(fd, iter);
+ HandleGetSandboxStatus(fd, pickle, iter);
return false;
case kZygoteCommandForkRealPID:
// This shouldn't happen in practice, but some failure paths in
@@ -223,10 +223,11 @@ bool Zygote::HandleRequestFromBrowser(int fd) {
// TODO(jln): remove callers to this broken API. See crbug.com/274855.
void Zygote::HandleReapRequest(int fd,
+ const Pickle& pickle,
PickleIterator iter) {
base::ProcessId child;
- if (!iter.ReadInt(&child)) {
+ if (!pickle.ReadInt(&iter, &child)) {
LOG(WARNING) << "Error parsing reap request from browser";
return;
}
@@ -306,11 +307,13 @@ bool Zygote::GetTerminationStatus(base::ProcessHandle real_pid,
}
void Zygote::HandleGetTerminationStatus(int fd,
+ const Pickle& pickle,
PickleIterator iter) {
bool known_dead;
base::ProcessHandle child_requested;
- if (!iter.ReadBool(&known_dead) || !iter.ReadInt(&child_requested)) {
+ if (!pickle.ReadBool(&iter, &known_dead) ||
+ !pickle.ReadInt(&iter, &child_requested)) {
LOG(WARNING) << "Error parsing GetTerminationStatus request "
<< "from browser";
return;
@@ -425,9 +428,9 @@ int Zygote::ForkWithRealPid(const std::string& process_type,
PickleIterator iter(pickle);
int kind;
- CHECK(iter.ReadInt(&kind));
+ CHECK(pickle.ReadInt(&iter, &kind));
CHECK(kind == kZygoteCommandForkRealPID);
- CHECK(iter.ReadInt(&real_pid));
+ CHECK(pickle.ReadInt(&iter, &real_pid));
}
// Fork failed.
@@ -463,7 +466,8 @@ int Zygote::ForkWithRealPid(const std::string& process_type,
return real_pid;
}
-base::ProcessId Zygote::ReadArgsAndFork(PickleIterator iter,
+base::ProcessId Zygote::ReadArgsAndFork(const Pickle& pickle,
+ PickleIterator iter,
ScopedVector<base::ScopedFD> fds,
std::string* uma_name,
int* uma_sample,
@@ -477,21 +481,21 @@ base::ProcessId Zygote::ReadArgsAndFork(PickleIterator iter,
const std::string channel_id_prefix = std::string("--")
+ switches::kProcessChannelID + std::string("=");
- if (!iter.ReadString(&process_type))
+ if (!pickle.ReadString(&iter, &process_type))
return -1;
- if (!iter.ReadInt(&argc))
+ if (!pickle.ReadInt(&iter, &argc))
return -1;
for (int i = 0; i < argc; ++i) {
std::string arg;
- if (!iter.ReadString(&arg))
+ if (!pickle.ReadString(&iter, &arg))
return -1;
args.push_back(arg);
if (arg.compare(0, channel_id_prefix.length(), channel_id_prefix) == 0)
channel_id = arg.substr(channel_id_prefix.length());
}
- if (!iter.ReadInt(&numfds))
+ if (!pickle.ReadInt(&iter, &numfds))
return -1;
if (numfds != static_cast<int>(fds.size()))
return -1;
@@ -504,7 +508,7 @@ base::ProcessId Zygote::ReadArgsAndFork(PickleIterator iter,
// Remaining FDs are for the global descriptor mapping.
for (int i = 1; i < numfds; ++i) {
base::GlobalDescriptors::Key key;
- if (!iter.ReadUInt32(&key))
+ if (!pickle.ReadUInt32(&iter, &key))
return -1;
mapping.push_back(std::make_pair(key, fds[i]->get()));
}
@@ -549,13 +553,14 @@ base::ProcessId Zygote::ReadArgsAndFork(PickleIterator iter,
}
bool Zygote::HandleForkRequest(int fd,
+ const Pickle& pickle,
PickleIterator iter,
ScopedVector<base::ScopedFD> fds) {
std::string uma_name;
int uma_sample;
int uma_boundary_value;
base::ProcessId child_pid = ReadArgsAndFork(
- iter, fds.Pass(), &uma_name, &uma_sample, &uma_boundary_value);
+ pickle, iter, fds.Pass(), &uma_name, &uma_sample, &uma_boundary_value);
if (child_pid == 0)
return true;
// If there's no UMA report for this particular fork, then check if any
@@ -579,6 +584,7 @@ bool Zygote::HandleForkRequest(int fd,
}
bool Zygote::HandleGetSandboxStatus(int fd,
+ const Pickle& pickle,
PickleIterator iter) {
if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) !=
sizeof(sandbox_flags_)) {
diff --git a/content/zygote/zygote_linux.h b/content/zygote/zygote_linux.h
index 41773fa..f93ea03 100644
--- a/content/zygote/zygote_linux.h
+++ b/content/zygote/zygote_linux.h
@@ -61,7 +61,7 @@ class Zygote {
// new process and thus need to unwind back into ChromeMain.
bool HandleRequestFromBrowser(int fd);
- void HandleReapRequest(int fd, PickleIterator iter);
+ void HandleReapRequest(int fd, const Pickle& pickle, PickleIterator iter);
// Get the termination status of |real_pid|. |real_pid| is the PID as it
// appears outside of the sandbox.
@@ -72,6 +72,7 @@ class Zygote {
int* exit_code);
void HandleGetTerminationStatus(int fd,
+ const Pickle& pickle,
PickleIterator iter);
// This is equivalent to fork(), except that, when using the SUID sandbox, it
@@ -90,10 +91,11 @@ class Zygote {
int* uma_sample,
int* uma_boundary_value);
- // Unpacks process type and arguments from |iter| and forks a new process.
+ // Unpacks process type and arguments from |pickle| and forks a new process.
// Returns -1 on error, otherwise returns twice, returning 0 to the child
// process and the child process ID to the parent process, like fork().
- base::ProcessId ReadArgsAndFork(PickleIterator iter,
+ base::ProcessId ReadArgsAndFork(const Pickle& pickle,
+ PickleIterator iter,
ScopedVector<base::ScopedFD> fds,
std::string* uma_name,
int* uma_sample,
@@ -104,10 +106,12 @@ class Zygote {
// otherwise writes the child_pid back to the browser via |fd|. Writes a
// child_pid of -1 on error.
bool HandleForkRequest(int fd,
+ const Pickle& pickle,
PickleIterator iter,
ScopedVector<base::ScopedFD> fds);
bool HandleGetSandboxStatus(int fd,
+ const Pickle& pickle,
PickleIterator iter);
// The Zygote needs to keep some information about each process. Most
diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc
index 514891e..e78369b 100644
--- a/content/zygote/zygote_main_linux.cc
+++ b/content/zygote/zygote_main_linux.cc
@@ -134,8 +134,8 @@ static void ProxyLocaltimeCallToBrowser(time_t input, struct tm* output,
Pickle reply(reinterpret_cast<char*>(reply_buf), r);
PickleIterator iter(reply);
std::string result, timezone;
- if (!iter.ReadString(&result) ||
- !iter.ReadString(&timezone) ||
+ if (!reply.ReadString(&iter, &result) ||
+ !reply.ReadString(&iter, &timezone) ||
result.size() != sizeof(struct tm)) {
memset(output, 0, sizeof(struct tm));
return;
diff --git a/extensions/browser/script_executor.cc b/extensions/browser/script_executor.cc
index ac3e671..70b837e 100644
--- a/extensions/browser/script_executor.cc
+++ b/extensions/browser/script_executor.cc
@@ -55,7 +55,7 @@ class Handler : public content::WebContentsObserver {
int message_request_id;
PickleIterator iter(message);
- CHECK(iter.ReadInt(&message_request_id));
+ CHECK(message.ReadInt(&iter, &message_request_id));
if (message_request_id != request_id_)
return false;
diff --git a/extensions/common/user_script.cc b/extensions/common/user_script.cc
index 4410290..ec0e553 100644
--- a/extensions/common/user_script.cc
+++ b/extensions/common/user_script.cc
@@ -131,7 +131,7 @@ void UserScript::File::Pickle(::Pickle* pickle) const {
void UserScript::File::Unpickle(const ::Pickle& pickle, PickleIterator* iter) {
// Read the url from the pickle.
std::string url;
- CHECK(iter->ReadString(&url));
+ CHECK(pickle.ReadString(iter, &url));
set_url(GURL(url));
}
@@ -184,16 +184,16 @@ void UserScript::PickleScripts(::Pickle* pickle,
void UserScript::Unpickle(const ::Pickle& pickle, PickleIterator* iter) {
// Read the run location.
int run_location = 0;
- CHECK(iter->ReadInt(&run_location));
+ CHECK(pickle.ReadInt(iter, &run_location));
CHECK(run_location >= 0 && run_location < RUN_LOCATION_LAST);
run_location_ = static_cast<RunLocation>(run_location);
- CHECK(iter->ReadString(&extension_id_));
- CHECK(iter->ReadInt(&user_script_id_));
- CHECK(iter->ReadBool(&emulate_greasemonkey_));
- CHECK(iter->ReadBool(&match_all_frames_));
- CHECK(iter->ReadBool(&match_about_blank_));
- CHECK(iter->ReadBool(&incognito_enabled_));
+ CHECK(pickle.ReadString(iter, &extension_id_));
+ CHECK(pickle.ReadInt(iter, &user_script_id_));
+ CHECK(pickle.ReadBool(iter, &emulate_greasemonkey_));
+ CHECK(pickle.ReadBool(iter, &match_all_frames_));
+ CHECK(pickle.ReadBool(iter, &match_about_blank_));
+ CHECK(pickle.ReadBool(iter, &incognito_enabled_));
UnpickleGlobs(pickle, iter, &globs_);
UnpickleGlobs(pickle, iter, &exclude_globs_);
@@ -206,11 +206,11 @@ void UserScript::Unpickle(const ::Pickle& pickle, PickleIterator* iter) {
void UserScript::UnpickleGlobs(const ::Pickle& pickle, PickleIterator* iter,
std::vector<std::string>* globs) {
size_t num_globs = 0;
- CHECK(iter->ReadSizeT(&num_globs));
+ CHECK(pickle.ReadSizeT(iter, &num_globs));
globs->clear();
for (size_t i = 0; i < num_globs; ++i) {
std::string glob;
- CHECK(iter->ReadString(&glob));
+ CHECK(pickle.ReadString(iter, &glob));
globs->push_back(glob);
}
}
@@ -219,15 +219,15 @@ void UserScript::UnpickleURLPatternSet(const ::Pickle& pickle,
PickleIterator* iter,
URLPatternSet* pattern_list) {
size_t num_patterns = 0;
- CHECK(iter->ReadSizeT(&num_patterns));
+ CHECK(pickle.ReadSizeT(iter, &num_patterns));
pattern_list->ClearPatterns();
for (size_t i = 0; i < num_patterns; ++i) {
int valid_schemes;
- CHECK(iter->ReadInt(&valid_schemes));
+ CHECK(pickle.ReadInt(iter, &valid_schemes));
std::string pattern_str;
- CHECK(iter->ReadString(&pattern_str));
+ CHECK(pickle.ReadString(iter, &pattern_str));
URLPattern pattern(kValidUserScriptSchemes);
URLPattern::ParseResult result = pattern.Parse(pattern_str);
@@ -242,7 +242,7 @@ void UserScript::UnpickleURLPatternSet(const ::Pickle& pickle,
void UserScript::UnpickleScripts(const ::Pickle& pickle, PickleIterator* iter,
FileList* scripts) {
size_t num_files = 0;
- CHECK(iter->ReadSizeT(&num_files));
+ CHECK(pickle.ReadSizeT(iter, &num_files));
scripts->clear();
for (size_t i = 0; i < num_files; ++i) {
File file;
diff --git a/extensions/renderer/user_script_set.cc b/extensions/renderer/user_script_set.cc
index e95843d..96d542e 100644
--- a/extensions/renderer/user_script_set.cc
+++ b/extensions/renderer/user_script_set.cc
@@ -110,7 +110,7 @@ bool UserScriptSet::UpdateUserScripts(
size_t num_scripts = 0;
Pickle pickle(reinterpret_cast<char*>(shared_memory_->memory()), pickle_size);
PickleIterator iter(pickle);
- CHECK(iter.ReadSizeT(&num_scripts));
+ CHECK(pickle.ReadSizeT(&iter, &num_scripts));
scripts_.clear();
scripts_.reserve(num_scripts);
@@ -124,14 +124,14 @@ bool UserScriptSet::UpdateUserScripts(
for (size_t j = 0; j < script->js_scripts().size(); ++j) {
const char* body = NULL;
int body_length = 0;
- CHECK(iter.ReadData(&body, &body_length));
+ CHECK(pickle.ReadData(&iter, &body, &body_length));
script->js_scripts()[j].set_external_content(
base::StringPiece(body, body_length));
}
for (size_t j = 0; j < script->css_scripts().size(); ++j) {
const char* body = NULL;
int body_length = 0;
- CHECK(iter.ReadData(&body, &body_length));
+ CHECK(pickle.ReadData(&iter, &body, &body_length));
script->css_scripts()[j].set_external_content(
base::StringPiece(body, body_length));
}
diff --git a/gpu/ipc/gpu_command_buffer_traits.cc b/gpu/ipc/gpu_command_buffer_traits.cc
index 1de3b41..ade1e1d 100644
--- a/gpu/ipc/gpu_command_buffer_traits.cc
+++ b/gpu/ipc/gpu_command_buffer_traits.cc
@@ -63,7 +63,7 @@ bool ParamTraits<gpu::Mailbox>::Read(const Message* m,
PickleIterator* iter,
param_type* p) {
const char* bytes = NULL;
- if (!iter->ReadBytes(&bytes, sizeof(p->name)))
+ if (!m->ReadBytes(iter, &bytes, sizeof(p->name)))
return false;
DCHECK(bytes);
memcpy(p->name, bytes, sizeof(p->name));
@@ -106,7 +106,7 @@ bool ParamTraits<gpu::ValueState>::Read(const Message* m,
param_type* p) {
int length;
const char* data = NULL;
- if (!iter->ReadData(&data, &length) || length != sizeof(gpu::ValueState))
+ if (!m->ReadData(iter, &data, &length) || length != sizeof(gpu::ValueState))
return false;
DCHECK(data);
memcpy(p, data, sizeof(gpu::ValueState));
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 1ff3543..0852993 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -1005,7 +1005,7 @@ void ChannelPosix::HandleInternalMessage(const Message& msg) {
case Channel::HELLO_MESSAGE_TYPE:
int pid;
- if (!iter.ReadInt(&pid))
+ if (!msg.ReadInt(&iter, &pid))
NOTREACHED();
#if defined(IPC_USES_READWRITE)
@@ -1028,9 +1028,9 @@ void ChannelPosix::HandleInternalMessage(const Message& msg) {
#if defined(OS_MACOSX)
case Channel::CLOSE_FD_MESSAGE_TYPE:
int fd, hops;
- if (!iter.ReadInt(&hops))
+ if (!msg.ReadInt(&iter, &hops))
NOTREACHED();
- if (!iter.ReadInt(&fd))
+ if (!msg.ReadInt(&iter, &fd))
NOTREACHED();
if (hops == 0) {
if (fds_to_close_.erase(fd) > 0) {
diff --git a/ipc/ipc_channel_unittest.cc b/ipc/ipc_channel_unittest.cc
index 383ddb0..dd31e9e 100644
--- a/ipc/ipc_channel_unittest.cc
+++ b/ipc/ipc_channel_unittest.cc
@@ -39,19 +39,19 @@ TEST_F(IPCChannelTest, BasicMessageTest) {
std::string vs;
std::wstring vw;
- EXPECT_TRUE(iter.ReadInt(&vi));
+ EXPECT_TRUE(m.ReadInt(&iter, &vi));
EXPECT_EQ(v1, vi);
- EXPECT_TRUE(iter.ReadString(&vs));
+ EXPECT_TRUE(m.ReadString(&iter, &vs));
EXPECT_EQ(v2, vs);
- EXPECT_TRUE(iter.ReadWString(&vw));
+ EXPECT_TRUE(m.ReadWString(&iter, &vw));
EXPECT_EQ(v3, vw);
// should fail
- EXPECT_FALSE(iter.ReadInt(&vi));
- EXPECT_FALSE(iter.ReadString(&vs));
- EXPECT_FALSE(iter.ReadWString(&vw));
+ EXPECT_FALSE(m.ReadInt(&iter, &vi));
+ EXPECT_FALSE(m.ReadString(&iter, &vs));
+ EXPECT_FALSE(m.ReadWString(&iter, &vw));
}
TEST_F(IPCChannelTest, ChannelTest) {
diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc
index de5aed8..f9475a1 100644
--- a/ipc/ipc_fuzzing_tests.cc
+++ b/ipc/ipc_fuzzing_tests.cc
@@ -44,7 +44,7 @@ TEST(IPCMessageIntegrity, ReadBeyondBufferStr) {
PickleIterator iter(m);
std::string vs;
- EXPECT_FALSE(iter.ReadString(&vs));
+ EXPECT_FALSE(m.ReadString(&iter, &vs));
}
TEST(IPCMessageIntegrity, ReadBeyondBufferWStr) {
@@ -57,7 +57,7 @@ TEST(IPCMessageIntegrity, ReadBeyondBufferWStr) {
PickleIterator iter(m);
std::wstring vs;
- EXPECT_FALSE(iter.ReadWString(&vs));
+ EXPECT_FALSE(m.ReadWString(&iter, &vs));
}
TEST(IPCMessageIntegrity, ReadBytesBadIterator) {
@@ -68,7 +68,7 @@ TEST(IPCMessageIntegrity, ReadBytesBadIterator) {
PickleIterator iter(m);
const char* data = NULL;
- EXPECT_TRUE(iter.ReadBytes(&data, sizeof(int)));
+ EXPECT_TRUE(m.ReadBytes(&iter, &data, sizeof(int)));
}
TEST(IPCMessageIntegrity, ReadVectorNegativeSize) {
@@ -211,9 +211,9 @@ class FuzzerClientListener : public SimpleListener {
int msg_value1 = 0;
int msg_value2 = 0;
PickleIterator iter(*last_msg_);
- if (!iter.ReadInt(&msg_value1))
+ if (!last_msg_->ReadInt(&iter, &msg_value1))
return false;
- if (!iter.ReadInt(&msg_value2))
+ if (!last_msg_->ReadInt(&iter, &msg_value2))
return false;
if ((msg_value2 + 1) != msg_value1)
return false;
diff --git a/ipc/ipc_message.cc b/ipc/ipc_message.cc
index a6219fe..82b136ac 100644
--- a/ipc/ipc_message.cc
+++ b/ipc/ipc_message.cc
@@ -139,7 +139,7 @@ bool Message::WriteBorrowingFile(const base::PlatformFile& descriptor) {
bool Message::ReadFile(PickleIterator* iter, base::ScopedFD* descriptor) const {
int descriptor_index;
- if (!iter->ReadInt(&descriptor_index))
+ if (!ReadInt(iter, &descriptor_index))
return false;
FileDescriptorSet* file_descriptor_set = file_descriptor_set_.get();
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc
index b6e292f..be8795b 100644
--- a/ipc/ipc_message_utils.cc
+++ b/ipc/ipc_message_utils.cc
@@ -208,7 +208,7 @@ bool ReadValue(const Message* m, PickleIterator* iter, base::Value** value,
case base::Value::TYPE_BINARY: {
const char* data;
int length;
- if (!iter->ReadData(&data, &length))
+ if (!m->ReadData(iter, &data, &length))
return false;
*value = base::BinaryValue::CreateWithCopiedBuffer(data, length);
break;
@@ -260,7 +260,7 @@ void ParamTraits<unsigned char>::Write(Message* m, const param_type& p) {
bool ParamTraits<unsigned char>::Read(const Message* m, PickleIterator* iter,
param_type* r) {
const char* data;
- if (!iter->ReadBytes(&data, sizeof(param_type)))
+ if (!m->ReadBytes(iter, &data, sizeof(param_type)))
return false;
memcpy(r, data, sizeof(param_type));
return true;
@@ -277,7 +277,7 @@ void ParamTraits<unsigned short>::Write(Message* m, const param_type& p) {
bool ParamTraits<unsigned short>::Read(const Message* m, PickleIterator* iter,
param_type* r) {
const char* data;
- if (!iter->ReadBytes(&data, sizeof(param_type)))
+ if (!m->ReadBytes(iter, &data, sizeof(param_type)))
return false;
memcpy(r, data, sizeof(param_type));
return true;
@@ -322,7 +322,7 @@ void ParamTraits<double>::Write(Message* m, const param_type& p) {
bool ParamTraits<double>::Read(const Message* m, PickleIterator* iter,
param_type* r) {
const char *data;
- if (!iter->ReadBytes(&data, sizeof(*r))) {
+ if (!m->ReadBytes(iter, &data, sizeof(*r))) {
NOTREACHED();
return false;
}
@@ -362,7 +362,7 @@ bool ParamTraits<std::vector<char> >::Read(const Message* m,
param_type* r) {
const char *data;
int data_size = 0;
- if (!iter->ReadData(&data, &data_size) || data_size < 0)
+ if (!m->ReadData(iter, &data, &data_size) || data_size < 0)
return false;
r->resize(data_size);
if (data_size)
@@ -389,7 +389,7 @@ bool ParamTraits<std::vector<unsigned char> >::Read(const Message* m,
param_type* r) {
const char *data;
int data_size = 0;
- if (!iter->ReadData(&data, &data_size) || data_size < 0)
+ if (!m->ReadData(iter, &data, &data_size) || data_size < 0)
return false;
r->resize(data_size);
if (data_size)
@@ -416,7 +416,7 @@ bool ParamTraits<std::vector<bool> >::Read(const Message* m,
param_type* r) {
int size;
// ReadLength() checks for < 0 itself.
- if (!iter->ReadLength(&size))
+ if (!m->ReadLength(iter, &size))
return false;
r->resize(size);
for (int i = 0; i < size; i++) {
@@ -749,14 +749,14 @@ void ParamTraits<Message>::Write(Message* m, const Message& p) {
bool ParamTraits<Message>::Read(const Message* m, PickleIterator* iter,
Message* r) {
uint32 routing_id, type, flags;
- if (!iter->ReadUInt32(&routing_id) ||
- !iter->ReadUInt32(&type) ||
- !iter->ReadUInt32(&flags))
+ if (!m->ReadUInt32(iter, &routing_id) ||
+ !m->ReadUInt32(iter, &type) ||
+ !m->ReadUInt32(iter, &flags))
return false;
int payload_size;
const char* payload;
- if (!iter->ReadData(&payload, &payload_size))
+ if (!m->ReadData(iter, &payload, &payload_size))
return false;
r->SetHeaderValues(static_cast<int32>(routing_id), type, flags);
@@ -777,7 +777,7 @@ void ParamTraits<HANDLE>::Write(Message* m, const param_type& p) {
bool ParamTraits<HANDLE>::Read(const Message* m, PickleIterator* iter,
param_type* r) {
int32 temp;
- if (!iter->ReadInt(&temp))
+ if (!m->ReadInt(iter, &temp))
return false;
*r = LongToHandle(temp);
return true;
@@ -795,7 +795,7 @@ bool ParamTraits<LOGFONT>::Read(const Message* m, PickleIterator* iter,
param_type* r) {
const char *data;
int data_size = 0;
- if (iter->ReadData(&data, &data_size) && data_size == sizeof(LOGFONT)) {
+ if (m->ReadData(iter, &data, &data_size) && data_size == sizeof(LOGFONT)) {
const LOGFONT *font = reinterpret_cast<LOGFONT*>(const_cast<char*>(data));
if (_tcsnlen(font->lfFaceName, LF_FACESIZE) < LF_FACESIZE) {
memcpy(r, data, sizeof(LOGFONT));
@@ -819,7 +819,7 @@ bool ParamTraits<MSG>::Read(const Message* m, PickleIterator* iter,
param_type* r) {
const char *data;
int data_size = 0;
- bool result = iter->ReadData(&data, &data_size);
+ bool result = m->ReadData(iter, &data, &data_size);
if (result && data_size == sizeof(MSG)) {
memcpy(r, data, sizeof(MSG));
} else {
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index d4c6268..d18ab61 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -117,7 +117,7 @@ struct ParamTraits<bool> {
m->WriteBool(p);
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
- return iter->ReadBool(r);
+ return m->ReadBool(iter, r);
}
IPC_EXPORT static void Log(const param_type& p, std::string* l);
};
@@ -145,7 +145,7 @@ struct ParamTraits<int> {
m->WriteInt(p);
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
- return iter->ReadInt(r);
+ return m->ReadInt(iter, r);
}
IPC_EXPORT static void Log(const param_type& p, std::string* l);
};
@@ -157,7 +157,7 @@ struct ParamTraits<unsigned int> {
m->WriteInt(p);
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
- return iter->ReadInt(reinterpret_cast<int*>(r));
+ return m->ReadInt(iter, reinterpret_cast<int*>(r));
}
IPC_EXPORT static void Log(const param_type& p, std::string* l);
};
@@ -169,7 +169,7 @@ struct ParamTraits<long> {
m->WriteLongUsingDangerousNonPortableLessPersistableForm(p);
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
- return iter->ReadLong(r);
+ return m->ReadLong(iter, r);
}
IPC_EXPORT static void Log(const param_type& p, std::string* l);
};
@@ -181,7 +181,7 @@ struct ParamTraits<unsigned long> {
m->WriteLongUsingDangerousNonPortableLessPersistableForm(p);
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
- return iter->ReadLong(reinterpret_cast<long*>(r));
+ return m->ReadLong(iter, reinterpret_cast<long*>(r));
}
IPC_EXPORT static void Log(const param_type& p, std::string* l);
};
@@ -194,7 +194,7 @@ struct ParamTraits<long long> {
}
static bool Read(const Message* m, PickleIterator* iter,
param_type* r) {
- return iter->ReadInt64(reinterpret_cast<int64*>(r));
+ return m->ReadInt64(iter, reinterpret_cast<int64*>(r));
}
IPC_EXPORT static void Log(const param_type& p, std::string* l);
};
@@ -207,7 +207,7 @@ struct ParamTraits<unsigned long long> {
}
static bool Read(const Message* m, PickleIterator* iter,
param_type* r) {
- return iter->ReadInt64(reinterpret_cast<int64*>(r));
+ return m->ReadInt64(iter, reinterpret_cast<int64*>(r));
}
IPC_EXPORT static void Log(const param_type& p, std::string* l);
};
@@ -222,7 +222,7 @@ struct IPC_EXPORT ParamTraits<float> {
m->WriteFloat(p);
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
- return iter->ReadFloat(r);
+ return m->ReadFloat(iter, r);
}
static void Log(const param_type& p, std::string* l);
};
@@ -245,7 +245,7 @@ struct ParamTraits<std::string> {
}
static bool Read(const Message* m, PickleIterator* iter,
param_type* r) {
- return iter->ReadString(r);
+ return m->ReadString(iter, r);
}
IPC_EXPORT static void Log(const param_type& p, std::string* l);
};
@@ -258,7 +258,7 @@ struct ParamTraits<std::wstring> {
}
static bool Read(const Message* m, PickleIterator* iter,
param_type* r) {
- return iter->ReadWString(r);
+ return m->ReadWString(iter, r);
}
IPC_EXPORT static void Log(const param_type& p, std::string* l);
};
@@ -274,7 +274,7 @@ struct ParamTraits<base::string16> {
}
static bool Read(const Message* m, PickleIterator* iter,
param_type* r) {
- return iter->ReadString16(r);
+ return m->ReadString16(iter, r);
}
IPC_EXPORT static void Log(const param_type& p, std::string* l);
};
@@ -316,7 +316,7 @@ struct ParamTraits<std::vector<P> > {
param_type* r) {
int size;
// ReadLength() checks for < 0 itself.
- if (!iter->ReadLength(&size))
+ if (!m->ReadLength(iter, &size))
return false;
// Resizing beforehand is not safe, see BUG 1006367 for details.
if (INT_MAX / sizeof(P) <= static_cast<size_t>(size))
@@ -349,7 +349,7 @@ struct ParamTraits<std::set<P> > {
static bool Read(const Message* m, PickleIterator* iter,
param_type* r) {
int size;
- if (!iter->ReadLength(&size))
+ if (!m->ReadLength(iter, &size))
return false;
for (int i = 0; i < size; ++i) {
P item;
@@ -651,7 +651,7 @@ struct ParamTraits<ScopedVector<P> > {
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
int size = 0;
- if (!iter->ReadLength(&size))
+ if (!m->ReadLength(iter, &size))
return false;
if (INT_MAX/sizeof(P) <= static_cast<size_t>(size))
return false;
@@ -690,7 +690,7 @@ struct ParamTraits<base::SmallMap<NormalMap, kArraySize, EqualKey, MapInit> > {
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
int size;
- if (!iter->ReadLength(&size))
+ if (!m->ReadLength(iter, &size))
return false;
for (int i = 0; i < size; ++i) {
K key;
diff --git a/ipc/ipc_sync_message.cc b/ipc/ipc_sync_message.cc
index fd6dc47..9e3acf8 100644
--- a/ipc/ipc_sync_message.cc
+++ b/ipc/ipc_sync_message.cc
@@ -113,7 +113,7 @@ bool SyncMessage::ReadSyncHeader(const Message& msg, SyncHeader* header) {
DCHECK(msg.is_sync() || msg.is_reply());
PickleIterator iter(msg);
- bool result = iter.ReadInt(&header->message_id);
+ bool result = msg.ReadInt(&iter, &header->message_id);
if (!result) {
NOTREACHED();
return false;
diff --git a/ipc/param_traits_read_macros.h b/ipc/param_traits_read_macros.h
index 683a1de..1656d14 100644
--- a/ipc/param_traits_read_macros.h
+++ b/ipc/param_traits_read_macros.h
@@ -35,7 +35,7 @@
bool ParamTraits<enum_name>:: \
Read(const Message* m, PickleIterator* iter, param_type* p) { \
int value; \
- if (!iter->ReadInt(&value)) \
+ if (!m->ReadInt(iter, &value)) \
return false; \
if (!(validation_expression)) \
return false; \
diff --git a/net/cert/x509_certificate.cc b/net/cert/x509_certificate.cc
index 274ce93..02e0234 100644
--- a/net/cert/x509_certificate.cc
+++ b/net/cert/x509_certificate.cc
@@ -306,7 +306,8 @@ X509Certificate* X509Certificate::CreateFromBytes(const char* data,
}
// static
-X509Certificate* X509Certificate::CreateFromPickle(PickleIterator* pickle_iter,
+X509Certificate* X509Certificate::CreateFromPickle(const Pickle& pickle,
+ PickleIterator* pickle_iter,
PickleType type) {
if (type == PICKLETYPE_CERTIFICATE_CHAIN_V3) {
int chain_length = 0;
diff --git a/net/cert/x509_certificate.h b/net/cert/x509_certificate.h
index c1a4f6d..5c64a44 100644
--- a/net/cert/x509_certificate.h
+++ b/net/cert/x509_certificate.h
@@ -179,7 +179,8 @@ class NET_EXPORT X509Certificate
// Returns NULL on failure.
//
// The returned pointer must be stored in a scoped_refptr<X509Certificate>.
- static X509Certificate* CreateFromPickle(PickleIterator* pickle_iter,
+ static X509Certificate* CreateFromPickle(const Pickle& pickle,
+ PickleIterator* pickle_iter,
PickleType type);
// Parses all of the certificates possible from |data|. |format| is a
diff --git a/net/cert/x509_certificate_unittest.cc b/net/cert/x509_certificate_unittest.cc
index f77c46c..f5e49f8 100644
--- a/net/cert/x509_certificate_unittest.cc
+++ b/net/cert/x509_certificate_unittest.cc
@@ -619,7 +619,7 @@ TEST(X509CertificateTest, Pickle) {
PickleIterator iter(pickle);
scoped_refptr<X509Certificate> cert_from_pickle =
X509Certificate::CreateFromPickle(
- &iter, X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN_V3);
+ pickle, &iter, X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN_V3);
ASSERT_NE(static_cast<X509Certificate*>(NULL), cert_from_pickle.get());
EXPECT_TRUE(X509Certificate::IsSameOSCert(
cert->os_cert_handle(), cert_from_pickle->os_cert_handle()));
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index c3fd958..91673f4 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -156,10 +156,11 @@ HttpResponseHeaders::HttpResponseHeaders(const std::string& raw_input)
HttpUtil::GetStatusCodesForHistogram());
}
-HttpResponseHeaders::HttpResponseHeaders(PickleIterator* iter)
+HttpResponseHeaders::HttpResponseHeaders(const Pickle& pickle,
+ PickleIterator* iter)
: response_code_(-1) {
std::string raw_input;
- if (iter->ReadString(&raw_input))
+ if (pickle.ReadString(iter, &raw_input))
Parse(raw_input);
}
diff --git a/net/http/http_response_headers.h b/net/http/http_response_headers.h
index 5b98895..a093df5 100644
--- a/net/http/http_response_headers.h
+++ b/net/http/http_response_headers.h
@@ -72,7 +72,7 @@ class NET_EXPORT HttpResponseHeaders
// Initializes from the representation stored in the given pickle. The data
// for this object is found relative to the given pickle_iter, which should
// be passed to the pickle's various Read* methods.
- explicit HttpResponseHeaders(PickleIterator* pickle_iter);
+ HttpResponseHeaders(const Pickle& pickle, PickleIterator* pickle_iter);
// Appends a representation of this object to the given pickle.
// The options argument can be a combination of PersistOptions.
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc
index 3557423..7e4a6cf 100644
--- a/net/http/http_response_headers_unittest.cc
+++ b/net/http/http_response_headers_unittest.cc
@@ -346,7 +346,7 @@ TEST_P(PersistenceTest, Persist) {
PickleIterator iter(pickle);
scoped_refptr<net::HttpResponseHeaders> parsed2(
- new net::HttpResponseHeaders(&iter));
+ new net::HttpResponseHeaders(pickle, &iter));
std::string h2;
parsed2->GetNormalizedHeaders(&h2);
diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc
index 630a59e..c3a4827 100644
--- a/net/http/http_response_info.cc
+++ b/net/http/http_response_info.cc
@@ -160,7 +160,7 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
// Read flags and verify version
int flags;
- if (!iter.ReadInt(&flags))
+ if (!pickle.ReadInt(&iter, &flags))
return false;
int version = flags & RESPONSE_INFO_VERSION_MASK;
if (version < RESPONSE_INFO_MINIMUM_VERSION ||
@@ -171,57 +171,57 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
// Read request-time
int64 time_val;
- if (!iter.ReadInt64(&time_val))
+ if (!pickle.ReadInt64(&iter, &time_val))
return false;
request_time = Time::FromInternalValue(time_val);
was_cached = true; // Set status to show cache resurrection.
// Read response-time
- if (!iter.ReadInt64(&time_val))
+ if (!pickle.ReadInt64(&iter, &time_val))
return false;
response_time = Time::FromInternalValue(time_val);
// Read response-headers
- headers = new HttpResponseHeaders(&iter);
+ headers = new HttpResponseHeaders(pickle, &iter);
if (headers->response_code() == -1)
return false;
// Read ssl-info
if (flags & RESPONSE_INFO_HAS_CERT) {
X509Certificate::PickleType type = GetPickleTypeForVersion(version);
- ssl_info.cert = X509Certificate::CreateFromPickle(&iter, type);
+ ssl_info.cert = X509Certificate::CreateFromPickle(pickle, &iter, type);
if (!ssl_info.cert.get())
return false;
}
if (flags & RESPONSE_INFO_HAS_CERT_STATUS) {
CertStatus cert_status;
- if (!iter.ReadUInt32(&cert_status))
+ if (!pickle.ReadUInt32(&iter, &cert_status))
return false;
ssl_info.cert_status = cert_status;
}
if (flags & RESPONSE_INFO_HAS_SECURITY_BITS) {
int security_bits;
- if (!iter.ReadInt(&security_bits))
+ if (!pickle.ReadInt(&iter, &security_bits))
return false;
ssl_info.security_bits = security_bits;
}
if (flags & RESPONSE_INFO_HAS_SSL_CONNECTION_STATUS) {
int connection_status;
- if (!iter.ReadInt(&connection_status))
+ if (!pickle.ReadInt(&iter, &connection_status))
return false;
ssl_info.connection_status = connection_status;
}
if (flags & RESPONSE_INFO_HAS_SIGNED_CERTIFICATE_TIMESTAMPS) {
int num_scts;
- if (!iter.ReadInt(&num_scts))
+ if (!pickle.ReadInt(&iter, &num_scts))
return false;
for (int i = 0; i < num_scts; ++i) {
scoped_refptr<ct::SignedCertificateTimestamp> sct(
ct::SignedCertificateTimestamp::CreateFromPickle(&iter));
uint16 status;
- if (!sct.get() || !iter.ReadUInt16(&status))
+ if (!sct.get() || !pickle.ReadUInt16(&iter, &status))
return false;
ssl_info.signed_certificate_timestamps.push_back(
SignedCertificateTimestampAndStatus(
@@ -231,16 +231,16 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
// Read vary-data
if (flags & RESPONSE_INFO_HAS_VARY_DATA) {
- if (!vary_data.InitFromPickle(&iter))
+ if (!vary_data.InitFromPickle(pickle, &iter))
return false;
}
// Read socket_address.
std::string socket_address_host;
- if (iter.ReadString(&socket_address_host)) {
+ if (pickle.ReadString(&iter, &socket_address_host)) {
// If the host was written, we always expect the port to follow.
uint16 socket_address_port;
- if (!iter.ReadUInt16(&socket_address_port))
+ if (!pickle.ReadUInt16(&iter, &socket_address_port))
return false;
socket_address = HostPortPair(socket_address_host, socket_address_port);
} else if (version > 1) {
@@ -251,14 +251,14 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
// Read protocol-version.
if (flags & RESPONSE_INFO_HAS_NPN_NEGOTIATED_PROTOCOL) {
- if (!iter.ReadString(&npn_negotiated_protocol))
+ if (!pickle.ReadString(&iter, &npn_negotiated_protocol))
return false;
}
// Read connection info.
if (flags & RESPONSE_INFO_HAS_CONNECTION_INFO) {
int value;
- if (!iter.ReadInt(&value))
+ if (!pickle.ReadInt(&iter, &value))
return false;
if (value > static_cast<int>(CONNECTION_INFO_UNKNOWN) &&
diff --git a/net/http/http_vary_data.cc b/net/http/http_vary_data.cc
index f2f853c..f102058 100644
--- a/net/http/http_vary_data.cc
+++ b/net/http/http_vary_data.cc
@@ -64,10 +64,10 @@ bool HttpVaryData::Init(const HttpRequestInfo& request_info,
return is_valid_ = true;
}
-bool HttpVaryData::InitFromPickle(PickleIterator* iter) {
+bool HttpVaryData::InitFromPickle(const Pickle& pickle, PickleIterator* iter) {
is_valid_ = false;
const char* data;
- if (iter->ReadBytes(&data, sizeof(request_digest_))) {
+ if (pickle.ReadBytes(iter, &data, sizeof(request_digest_))) {
memcpy(&request_digest_, data, sizeof(request_digest_));
return is_valid_ = true;
}
diff --git a/net/http/http_vary_data.h b/net/http/http_vary_data.h
index bc60c1f..ec97956 100644
--- a/net/http/http_vary_data.h
+++ b/net/http/http_vary_data.h
@@ -52,7 +52,7 @@ class NET_EXPORT_PRIVATE HttpVaryData {
// is_valid() will return true. Otherwise, false is returned to indicate
// that this object is marked as invalid.
//
- bool InitFromPickle(PickleIterator* pickle_iter);
+ bool InitFromPickle(const Pickle& pickle, PickleIterator* pickle_iter);
// Call this method to persist the vary data. Illegal to call this on an
// invalid object.
diff --git a/net/quic/crypto/quic_server_info.cc b/net/quic/crypto/quic_server_info.cc
index c86d1f6..519d7b5 100644
--- a/net/quic/crypto/quic_server_info.cc
+++ b/net/quic/crypto/quic_server_info.cc
@@ -67,7 +67,7 @@ bool QuicServerInfo::ParseInner(const string& data) {
PickleIterator iter(p);
int version = -1;
- if (!iter.ReadInt(&version)) {
+ if (!p.ReadInt(&iter, &version)) {
DVLOG(1) << "Missing version";
return false;
}
@@ -77,29 +77,29 @@ bool QuicServerInfo::ParseInner(const string& data) {
return false;
}
- if (!iter.ReadString(&state->server_config)) {
+ if (!p.ReadString(&iter, &state->server_config)) {
DVLOG(1) << "Malformed server_config";
return false;
}
- if (!iter.ReadString(&state->source_address_token)) {
+ if (!p.ReadString(&iter, &state->source_address_token)) {
DVLOG(1) << "Malformed source_address_token";
return false;
}
- if (!iter.ReadString(&state->server_config_sig)) {
+ if (!p.ReadString(&iter, &state->server_config_sig)) {
DVLOG(1) << "Malformed server_config_sig";
return false;
}
// Read certs.
uint32 num_certs;
- if (!iter.ReadUInt32(&num_certs)) {
+ if (!p.ReadUInt32(&iter, &num_certs)) {
DVLOG(1) << "Malformed num_certs";
return false;
}
for (uint32 i = 0; i < num_certs; i++) {
string cert;
- if (!iter.ReadString(&cert)) {
+ if (!p.ReadString(&iter, &cert)) {
DVLOG(1) << "Malformed cert";
return false;
}
diff --git a/ppapi/nacl_irt/ppapi_dispatcher.cc b/ppapi/nacl_irt/ppapi_dispatcher.cc
index 059be41..50447bb 100644
--- a/ppapi/nacl_irt/ppapi_dispatcher.cc
+++ b/ppapi/nacl_irt/ppapi_dispatcher.cc
@@ -213,7 +213,7 @@ void PpapiDispatcher::OnPluginDispatcherMessageReceived(
// The first parameter should be a plugin dispatcher ID.
PickleIterator iter(msg);
uint32 id = 0;
- if (!iter.ReadUInt32(&id)) {
+ if (!msg.ReadUInt32(&iter, &id)) {
NOTREACHED();
return;
}
diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc
index 94ec2e6..1623395 100644
--- a/ppapi/proxy/ppapi_param_traits.cc
+++ b/ppapi/proxy/ppapi_param_traits.cc
@@ -43,7 +43,7 @@ bool ReadVectorWithoutCopy(const Message* m,
// This part is just a copy of the the default ParamTraits vector Read().
int size;
// ReadLength() checks for < 0 itself.
- if (!iter->ReadLength(&size))
+ if (!m->ReadLength(iter, &size))
return false;
// Resizing beforehand is not safe, see BUG 1006367 for details.
if (INT_MAX / sizeof(T) <= static_cast<size_t>(size))
@@ -118,7 +118,7 @@ bool ParamTraits<PP_NetAddress_Private>::Read(const Message* m,
p->size = size;
const char* data;
- if (!iter->ReadBytes(&data, size))
+ if (!m->ReadBytes(iter, &data, size))
return false;
memcpy(p->data, data, size);
return true;
diff --git a/ppapi/proxy/raw_var_data.cc b/ppapi/proxy/raw_var_data.cc
index ac925c9..97a6d94 100644
--- a/ppapi/proxy/raw_var_data.cc
+++ b/ppapi/proxy/raw_var_data.cc
@@ -188,11 +188,11 @@ scoped_ptr<RawVarDataGraph> RawVarDataGraph::Read(const IPC::Message* m,
PickleIterator* iter) {
scoped_ptr<RawVarDataGraph> result(new RawVarDataGraph);
uint32_t size = 0;
- if (!iter->ReadUInt32(&size))
+ if (!m->ReadUInt32(iter, &size))
return scoped_ptr<RawVarDataGraph>();
for (uint32_t i = 0; i < size; ++i) {
int32_t type;
- if (!iter->ReadInt(&type))
+ if (!m->ReadInt(iter, &type))
return scoped_ptr<RawVarDataGraph>();
PP_VarType var_type = static_cast<PP_VarType>(type);
result->data_.push_back(RawVarData::Create(var_type));
@@ -323,13 +323,13 @@ bool BasicRawVarData::Read(PP_VarType type,
break;
case PP_VARTYPE_BOOL: {
bool bool_value;
- if (!iter->ReadBool(&bool_value))
+ if (!m->ReadBool(iter, &bool_value))
return false;
result.value.as_bool = PP_FromBool(bool_value);
break;
}
case PP_VARTYPE_INT32:
- if (!iter->ReadInt(&result.value.as_int))
+ if (!m->ReadInt(iter, &result.value.as_int))
return false;
break;
case PP_VARTYPE_DOUBLE:
@@ -337,7 +337,7 @@ bool BasicRawVarData::Read(PP_VarType type,
return false;
break;
case PP_VARTYPE_OBJECT:
- if (!iter->ReadInt64(&result.value.as_id))
+ if (!m->ReadInt64(iter, &result.value.as_id))
return false;
break;
default:
@@ -385,7 +385,7 @@ void StringRawVarData::Write(IPC::Message* m,
bool StringRawVarData::Read(PP_VarType type,
const IPC::Message* m,
PickleIterator* iter) {
- if (!iter->ReadString(&data_))
+ if (!m->ReadString(iter, &data_))
return false;
return true;
}
@@ -503,12 +503,12 @@ bool ArrayBufferRawVarData::Read(PP_VarType type,
const IPC::Message* m,
PickleIterator* iter) {
int shmem_type;
- if (!iter->ReadInt(&shmem_type))
+ if (!m->ReadInt(iter, &shmem_type))
return false;
type_ = static_cast<ShmemType>(shmem_type);
switch (type_) {
case ARRAY_BUFFER_SHMEM_HOST:
- if (!iter->ReadInt(&host_shm_handle_id_))
+ if (!m->ReadInt(iter, &host_shm_handle_id_))
return false;
break;
case ARRAY_BUFFER_SHMEM_PLUGIN:
@@ -518,7 +518,7 @@ bool ArrayBufferRawVarData::Read(PP_VarType type,
}
break;
case ARRAY_BUFFER_NO_SHMEM:
- if (!iter->ReadString(&data_))
+ if (!m->ReadString(iter, &data_))
return false;
break;
default:
@@ -584,11 +584,11 @@ bool ArrayRawVarData::Read(PP_VarType type,
const IPC::Message* m,
PickleIterator* iter) {
uint32_t size;
- if (!iter->ReadUInt32(&size))
+ if (!m->ReadUInt32(iter, &size))
return false;
for (uint32_t i = 0; i < size; ++i) {
uint32_t index;
- if (!iter->ReadUInt32(&index))
+ if (!m->ReadUInt32(iter, &index))
return false;
children_.push_back(index);
}
@@ -650,14 +650,14 @@ bool DictionaryRawVarData::Read(PP_VarType type,
const IPC::Message* m,
PickleIterator* iter) {
uint32_t size;
- if (!iter->ReadUInt32(&size))
+ if (!m->ReadUInt32(iter, &size))
return false;
for (uint32_t i = 0; i < size; ++i) {
std::string key;
uint32_t value;
- if (!iter->ReadString(&key))
+ if (!m->ReadString(iter, &key))
return false;
- if (!iter->ReadUInt32(&value))
+ if (!m->ReadUInt32(iter, &value))
return false;
children_.push_back(make_pair(key, value));
}
@@ -727,15 +727,15 @@ bool ResourceRawVarData::Read(PP_VarType type,
const IPC::Message* m,
PickleIterator* iter) {
int value;
- if (!iter->ReadInt(&value))
+ if (!m->ReadInt(iter, &value))
return false;
pp_resource_ = static_cast<PP_Resource>(value);
- if (!iter->ReadInt(&pending_renderer_host_id_))
+ if (!m->ReadInt(iter, &pending_renderer_host_id_))
return false;
- if (!iter->ReadInt(&pending_browser_host_id_))
+ if (!m->ReadInt(iter, &pending_browser_host_id_))
return false;
bool has_creation_message;
- if (!iter->ReadBool(&has_creation_message))
+ if (!m->ReadBool(iter, &has_creation_message))
return false;
if (has_creation_message) {
creation_message_.reset(new IPC::Message());
diff --git a/ppapi/proxy/serialized_flash_menu.cc b/ppapi/proxy/serialized_flash_menu.cc
index 9f39916..bbd698c 100644
--- a/ppapi/proxy/serialized_flash_menu.cc
+++ b/ppapi/proxy/serialized_flash_menu.cc
@@ -81,18 +81,18 @@ bool ReadMenuItem(int depth,
PickleIterator* iter,
PP_Flash_MenuItem* menu_item) {
uint32_t type;
- if (!iter->ReadUInt32(&type))
+ if (!m->ReadUInt32(iter, &type))
return false;
if (type > PP_FLASH_MENUITEM_TYPE_SUBMENU)
return false;
menu_item->type = static_cast<PP_Flash_MenuItem_Type>(type);
std::string name;
- if (!iter->ReadString(&name))
+ if (!m->ReadString(iter, &name))
return false;
menu_item->name = new char[name.size() + 1];
std::copy(name.begin(), name.end(), menu_item->name);
menu_item->name[name.size()] = 0;
- if (!iter->ReadInt(&menu_item->id))
+ if (!m->ReadInt(iter, &menu_item->id))
return false;
if (!IPC::ParamTraits<PP_Bool>::Read(m, iter, &menu_item->enabled))
return false;
@@ -116,7 +116,7 @@ PP_Flash_Menu* ReadMenu(int depth,
PP_Flash_Menu* menu = new PP_Flash_Menu;
menu->items = NULL;
- if (!iter->ReadUInt32(&menu->count)) {
+ if (!m->ReadUInt32(iter, &menu->count)) {
FreeMenu(menu);
return NULL;
}
diff --git a/ppapi/proxy/serialized_var.cc b/ppapi/proxy/serialized_var.cc
index eb7ba4e..d00a7d3 100644
--- a/ppapi/proxy/serialized_var.cc
+++ b/ppapi/proxy/serialized_var.cc
@@ -149,7 +149,7 @@ bool SerializedVar::Inner::ReadFromMessage(const IPC::Message* m,
#endif
// When reading, the dispatcher should be set when we get a Deserialize
// call (which will supply a dispatcher).
- if (!iter->ReadBool(&is_valid_var_))
+ if (!m->ReadBool(iter, &is_valid_var_))
return false;
if (is_valid_var_) {
raw_var_data_ = RawVarDataGraph::Read(m, iter);
diff --git a/remoting/host/chromoting_param_traits.cc b/remoting/host/chromoting_param_traits.cc
index 9434cce..8050dc1 100644
--- a/remoting/host/chromoting_param_traits.cc
+++ b/remoting/host/chromoting_param_traits.cc
@@ -21,7 +21,7 @@ bool ParamTraits<webrtc::DesktopVector>::Read(const Message* m,
PickleIterator* iter,
webrtc::DesktopVector* r) {
int x, y;
- if (!iter->ReadInt(&x) || !iter->ReadInt(&y))
+ if (!m->ReadInt(iter, &x) || !m->ReadInt(iter, &y))
return false;
*r = webrtc::DesktopVector(x, y);
return true;
@@ -46,7 +46,7 @@ bool ParamTraits<webrtc::DesktopSize>::Read(const Message* m,
PickleIterator* iter,
webrtc::DesktopSize* r) {
int width, height;
- if (!iter->ReadInt(&width) || !iter->ReadInt(&height))
+ if (!m->ReadInt(iter, &width) || !m->ReadInt(iter, &height))
return false;
*r = webrtc::DesktopSize(width, height);
return true;
@@ -73,8 +73,8 @@ bool ParamTraits<webrtc::DesktopRect>::Read(const Message* m,
PickleIterator* iter,
webrtc::DesktopRect* r) {
int left, right, top, bottom;
- if (!iter->ReadInt(&left) || !iter->ReadInt(&top) ||
- !iter->ReadInt(&right) || !iter->ReadInt(&bottom)) {
+ if (!m->ReadInt(iter, &left) || !m->ReadInt(iter, &top) ||
+ !m->ReadInt(iter, &right) || !m->ReadInt(iter, &bottom)) {
return false;
}
*r = webrtc::DesktopRect::MakeLTRB(left, top, right, bottom);
@@ -126,8 +126,10 @@ bool ParamTraits<webrtc::MouseCursor>::Read(
const char* data;
int data_length;
- if (!iter->ReadData(&data, &data_length) || data_length != expected_length)
+ if (!m->ReadData(iter, &data, &data_length) ||
+ data_length != expected_length) {
return false;
+ }
webrtc::DesktopVector hotspot;
if (!ParamTraits<webrtc::DesktopVector>::Read(m, iter, &hotspot))
diff --git a/sandbox/linux/syscall_broker/broker_client.cc b/sandbox/linux/syscall_broker/broker_client.cc
index 8d04197..b82ecb3 100644
--- a/sandbox/linux/syscall_broker/broker_client.cc
+++ b/sandbox/linux/syscall_broker/broker_client.cc
@@ -92,7 +92,7 @@ int BrokerClient::PathAndFlagsSyscall(IPCCommand syscall_type,
int return_value = -1;
// Now deserialize the return value and eventually return the file
// descriptor.
- if (iter.ReadInt(&return_value)) {
+ if (read_pickle.ReadInt(&iter, &return_value)) {
switch (syscall_type) {
case COMMAND_ACCESS:
// We should never have a fd to return.
diff --git a/sandbox/linux/syscall_broker/broker_host.cc b/sandbox/linux/syscall_broker/broker_host.cc
index ca55f21..7ebc785 100644
--- a/sandbox/linux/syscall_broker/broker_host.cc
+++ b/sandbox/linux/syscall_broker/broker_host.cc
@@ -110,18 +110,21 @@ void AccessFileForIPC(const BrokerPolicy& policy,
}
}
-// Handle a |command_type| request contained in |iter| and send the reply
+// Handle a |command_type| request contained in |read_pickle| and send the reply
// on |reply_ipc|.
// Currently COMMAND_OPEN and COMMAND_ACCESS are supported.
bool HandleRemoteCommand(const BrokerPolicy& policy,
IPCCommand command_type,
int reply_ipc,
+ const Pickle& read_pickle,
PickleIterator iter) {
// Currently all commands have two arguments: filename and flags.
std::string requested_filename;
int flags = 0;
- if (!iter.ReadString(&requested_filename) || !iter.ReadInt(&flags))
+ if (!read_pickle.ReadString(&iter, &requested_filename) ||
+ !read_pickle.ReadInt(&iter, &flags)) {
return false;
+ }
Pickle write_pickle;
std::vector<int> opened_files;
@@ -197,7 +200,7 @@ BrokerHost::RequestStatus BrokerHost::HandleRequest() const {
Pickle pickle(buf, msg_len);
PickleIterator iter(pickle);
int command_type;
- if (iter.ReadInt(&command_type)) {
+ if (pickle.ReadInt(&iter, &command_type)) {
bool command_handled = false;
// Go through all the possible IPC messages.
switch (command_type) {
@@ -206,7 +209,7 @@ BrokerHost::RequestStatus BrokerHost::HandleRequest() const {
// We reply on the file descriptor sent to us via the IPC channel.
command_handled = HandleRemoteCommand(
broker_policy_, static_cast<IPCCommand>(command_type),
- temporary_ipc.get(), iter);
+ temporary_ipc.get(), pickle, iter);
break;
default:
NOTREACHED();
diff --git a/skia/ext/skia_utils_base.cc b/skia/ext/skia_utils_base.cc
index 56ca993..07c06bb 100644
--- a/skia/ext/skia_utils_base.cc
+++ b/skia/ext/skia_utils_base.cc
@@ -6,11 +6,11 @@
namespace skia {
-bool ReadSkString(PickleIterator* iter, SkString* str) {
- int reply_length;
+bool ReadSkString(const Pickle& pickle, PickleIterator* iter, SkString* str) {
+ int reply_length;
const char* reply_text;
- if (!iter->ReadData(&reply_text, &reply_length))
+ if (!pickle.ReadData(iter, &reply_text, &reply_length))
return false;
if (str)
@@ -18,16 +18,16 @@ bool ReadSkString(PickleIterator* iter, SkString* str) {
return true;
}
-bool ReadSkFontIdentity(PickleIterator* iter,
+bool ReadSkFontIdentity(const Pickle& pickle, PickleIterator* iter,
SkFontConfigInterface::FontIdentity* identity) {
- uint32_t reply_id;
- uint32_t reply_ttcIndex;
- int reply_length;
+ uint32_t reply_id;
+ uint32_t reply_ttcIndex;
+ int reply_length;
const char* reply_text;
- if (!iter->ReadUInt32(&reply_id) ||
- !iter->ReadUInt32(&reply_ttcIndex) ||
- !iter->ReadData(&reply_text, &reply_length))
+ if (!pickle.ReadUInt32(iter, &reply_id) ||
+ !pickle.ReadUInt32(iter, &reply_ttcIndex) ||
+ !pickle.ReadData(iter, &reply_text, &reply_length))
return false;
if (identity) {
diff --git a/skia/ext/skia_utils_base.h b/skia/ext/skia_utils_base.h
index 01cf8ed..cfddd31 100644
--- a/skia/ext/skia_utils_base.h
+++ b/skia/ext/skia_utils_base.h
@@ -12,20 +12,20 @@ namespace skia {
// Return true if the pickle/iterator contains a string. If so, and if str
// is not null, copy that string into str.
-SK_API bool ReadSkString(PickleIterator* iter, SkString* str);
+SK_API bool ReadSkString(const Pickle& pickle, PickleIterator* iter,
+ SkString* str);
// Return true if the pickle/iterator contains a FontIdentity. If so, and if
// identity is not null, copy it into identity.
-SK_API bool ReadSkFontIdentity(PickleIterator* iter,
+SK_API bool ReadSkFontIdentity(const Pickle& pickle, PickleIterator* iter,
SkFontConfigInterface::FontIdentity* identity);
// Return true if str can be written into the request pickle.
SK_API bool WriteSkString(Pickle* pickle, const SkString& str);
// Return true if identity can be written into the request pickle.
-SK_API bool WriteSkFontIdentity(
- Pickle* pickle,
- const SkFontConfigInterface::FontIdentity& identity);
+SK_API bool WriteSkFontIdentity(Pickle* pickle,
+ const SkFontConfigInterface::FontIdentity& identity);
} // namespace skia
diff --git a/storage/browser/fileapi/file_system_usage_cache.cc b/storage/browser/fileapi/file_system_usage_cache.cc
index b8938af..0cfbfd8 100644
--- a/storage/browser/fileapi/file_system_usage_cache.cc
+++ b/storage/browser/fileapi/file_system_usage_cache.cc
@@ -185,10 +185,10 @@ bool FileSystemUsageCache::Read(const base::FilePath& usage_file_path,
uint32 dirty = 0;
int64 usage = 0;
- if (!iter.ReadBytes(&header, kUsageFileHeaderSize) ||
- !iter.ReadBool(is_valid) ||
- !iter.ReadUInt32(&dirty) ||
- !iter.ReadInt64(&usage))
+ if (!read_pickle.ReadBytes(&iter, &header, kUsageFileHeaderSize) ||
+ !read_pickle.ReadBool(&iter, is_valid) ||
+ !read_pickle.ReadUInt32(&iter, &dirty) ||
+ !read_pickle.ReadInt64(&iter, &usage))
return false;
if (header[0] != kUsageFileHeader[0] ||
diff --git a/storage/browser/fileapi/sandbox_directory_database.cc b/storage/browser/fileapi/sandbox_directory_database.cc
index 8343fea..97a0bc8 100644
--- a/storage/browser/fileapi/sandbox_directory_database.cc
+++ b/storage/browser/fileapi/sandbox_directory_database.cc
@@ -52,10 +52,10 @@ bool FileInfoFromPickle(const Pickle& pickle,
std::string name;
int64 internal_time;
- if (iter.ReadInt64(&info->parent_id) &&
- iter.ReadString(&data_path) &&
- iter.ReadString(&name) &&
- iter.ReadInt64(&internal_time)) {
+ if (pickle.ReadInt64(&iter, &info->parent_id) &&
+ pickle.ReadString(&iter, &data_path) &&
+ pickle.ReadString(&iter, &name) &&
+ pickle.ReadInt64(&iter, &internal_time)) {
info->data_path = storage::StringToFilePath(data_path);
info->name = storage::StringToFilePath(name).value();
info->modification_time = base::Time::FromInternalValue(internal_time);
diff --git a/storage/browser/fileapi/sandbox_prioritized_origin_database.cc b/storage/browser/fileapi/sandbox_prioritized_origin_database.cc
index 9a64edf..c55ad42 100644
--- a/storage/browser/fileapi/sandbox_prioritized_origin_database.cc
+++ b/storage/browser/fileapi/sandbox_prioritized_origin_database.cc
@@ -44,7 +44,7 @@ bool ReadPrimaryOriginFile(const base::FilePath& path,
return false;
Pickle pickle(buffer.data(), buffer.size());
PickleIterator iter(pickle);
- return iter.ReadString(origin) && !origin->empty();
+ return pickle.ReadString(&iter, origin) && !origin->empty();
}
} // namespace
diff --git a/ui/base/clipboard/clipboard_test_template.h b/ui/base/clipboard/clipboard_test_template.h
index 2c5827f..b5df843 100644
--- a/ui/base/clipboard/clipboard_test_template.h
+++ b/ui/base/clipboard/clipboard_test_template.h
@@ -415,7 +415,7 @@ TYPED_TEST(ClipboardTest, DataTest) {
Pickle read_pickle(output.data(), output.size());
PickleIterator iter(read_pickle);
std::string unpickled_string;
- ASSERT_TRUE(iter.ReadString(&unpickled_string));
+ ASSERT_TRUE(read_pickle.ReadString(&iter, &unpickled_string));
EXPECT_EQ(payload, unpickled_string);
}
@@ -450,7 +450,7 @@ TYPED_TEST(ClipboardTest, MultipleDataTest) {
Pickle read_pickle2(output2.data(), output2.size());
PickleIterator iter2(read_pickle2);
std::string unpickled_string2;
- ASSERT_TRUE(iter2.ReadString(&unpickled_string2));
+ ASSERT_TRUE(read_pickle2.ReadString(&iter2, &unpickled_string2));
EXPECT_EQ(payload2, unpickled_string2);
{
@@ -471,7 +471,7 @@ TYPED_TEST(ClipboardTest, MultipleDataTest) {
Pickle read_pickle1(output1.data(), output1.size());
PickleIterator iter1(read_pickle1);
std::string unpickled_string1;
- ASSERT_TRUE(iter1.ReadString(&unpickled_string1));
+ ASSERT_TRUE(read_pickle1.ReadString(&iter1, &unpickled_string1));
EXPECT_EQ(payload1, unpickled_string1);
}
diff --git a/ui/base/clipboard/custom_data_helper.cc b/ui/base/clipboard/custom_data_helper.cc
index b715446..323a92e 100644
--- a/ui/base/clipboard/custom_data_helper.cc
+++ b/ui/base/clipboard/custom_data_helper.cc
@@ -30,7 +30,7 @@ bool SkippablePickle::SkipString16(PickleIterator* iter) {
DCHECK(iter);
int len;
- if (!iter->ReadLength(&len))
+ if (!ReadLength(iter, &len))
return false;
return iter->SkipBytes(len * sizeof(base::char16));
}
@@ -44,7 +44,7 @@ void ReadCustomDataTypes(const void* data,
PickleIterator iter(pickle);
size_t size = 0;
- if (!iter.ReadSizeT(&size))
+ if (!pickle.ReadSizeT(&iter, &size))
return;
// Keep track of the original elements in the types vector. On failure, we
@@ -54,7 +54,8 @@ void ReadCustomDataTypes(const void* data,
for (size_t i = 0; i < size; ++i) {
types->push_back(base::string16());
- if (!iter.ReadString16(&types->back()) || !pickle.SkipString16(&iter)) {
+ if (!pickle.ReadString16(&iter, &types->back()) ||
+ !pickle.SkipString16(&iter)) {
types->resize(original_size);
return;
}
@@ -69,15 +70,15 @@ void ReadCustomDataForType(const void* data,
PickleIterator iter(pickle);
size_t size = 0;
- if (!iter.ReadSizeT(&size))
+ if (!pickle.ReadSizeT(&iter, &size))
return;
for (size_t i = 0; i < size; ++i) {
base::string16 deserialized_type;
- if (!iter.ReadString16(&deserialized_type))
+ if (!pickle.ReadString16(&iter, &deserialized_type))
return;
if (deserialized_type == type) {
- ignore_result(iter.ReadString16(result));
+ ignore_result(pickle.ReadString16(&iter, result));
return;
}
if (!pickle.SkipString16(&iter))
@@ -92,19 +93,19 @@ void ReadCustomDataIntoMap(const void* data,
PickleIterator iter(pickle);
size_t size = 0;
- if (!iter.ReadSizeT(&size))
+ if (!pickle.ReadSizeT(&iter, &size))
return;
for (size_t i = 0; i < size; ++i) {
base::string16 type;
- if (!iter.ReadString16(&type)) {
+ if (!pickle.ReadString16(&iter, &type)) {
// Data is corrupt, return an empty map.
result->clear();
return;
}
std::pair<std::map<base::string16, base::string16>::iterator, bool>
insert_result = result->insert(std::make_pair(type, base::string16()));
- if (!iter.ReadString16(&insert_result.first->second)) {
+ if (!pickle.ReadString16(&iter, &insert_result.first->second)) {
// Data is corrupt, return an empty map.
result->clear();
return;
diff --git a/ui/base/dragdrop/os_exchange_data_unittest.cc b/ui/base/dragdrop/os_exchange_data_unittest.cc
index 9e2130c..417b6a6 100644
--- a/ui/base/dragdrop/os_exchange_data_unittest.cc
+++ b/ui/base/dragdrop/os_exchange_data_unittest.cc
@@ -160,9 +160,9 @@ TEST_F(OSExchangeDataTest, TestPickledData) {
EXPECT_TRUE(copy.GetPickledData(kTestFormat, &restored_pickle));
PickleIterator iterator(restored_pickle);
int value;
- EXPECT_TRUE(iterator.ReadInt(&value));
+ EXPECT_TRUE(restored_pickle.ReadInt(&iterator, &value));
EXPECT_EQ(1, value);
- EXPECT_TRUE(iterator.ReadInt(&value));
+ EXPECT_TRUE(restored_pickle.ReadInt(&iterator, &value));
EXPECT_EQ(2, value);
}
diff --git a/ui/gfx/ipc/gfx_param_traits.cc b/ui/gfx/ipc/gfx_param_traits.cc
index a4a004c..caf1a23 100644
--- a/ui/gfx/ipc/gfx_param_traits.cc
+++ b/ui/gfx/ipc/gfx_param_traits.cc
@@ -59,8 +59,8 @@ void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) {
bool ParamTraits<gfx::Point>::Read(const Message* m, PickleIterator* iter,
gfx::Point* r) {
int x, y;
- if (!iter->ReadInt(&x) ||
- !iter->ReadInt(&y))
+ if (!m->ReadInt(iter, &x) ||
+ !m->ReadInt(iter, &y))
return false;
r->set_x(x);
r->set_y(y);
@@ -103,7 +103,7 @@ bool ParamTraits<gfx::Size>::Read(const Message* m,
PickleIterator* iter,
gfx::Size* r) {
const char* char_values;
- if (!iter->ReadBytes(&char_values, sizeof(int) * 2))
+ if (!m->ReadBytes(iter, &char_values, sizeof(int) * 2))
return false;
const int* values = reinterpret_cast<const int*>(char_values);
if (values[0] < 0 || values[1] < 0)
@@ -126,7 +126,7 @@ bool ParamTraits<gfx::SizeF>::Read(const Message* m,
PickleIterator* iter,
gfx::SizeF* r) {
const char* char_values;
- if (!iter->ReadBytes(&char_values, sizeof(float) * 2))
+ if (!m->ReadBytes(iter, &char_values, sizeof(float) * 2))
return false;
const float* values = reinterpret_cast<const float*>(char_values);
r->set_width(values[0]);
@@ -147,7 +147,7 @@ bool ParamTraits<gfx::Vector2d>::Read(const Message* m,
PickleIterator* iter,
gfx::Vector2d* r) {
const char* char_values;
- if (!iter->ReadBytes(&char_values, sizeof(int) * 2))
+ if (!m->ReadBytes(iter, &char_values, sizeof(int) * 2))
return false;
const int* values = reinterpret_cast<const int*>(char_values);
r->set_x(values[0]);
@@ -168,7 +168,7 @@ bool ParamTraits<gfx::Vector2dF>::Read(const Message* m,
PickleIterator* iter,
gfx::Vector2dF* r) {
const char* char_values;
- if (!iter->ReadBytes(&char_values, sizeof(float) * 2))
+ if (!m->ReadBytes(iter, &char_values, sizeof(float) * 2))
return false;
const float* values = reinterpret_cast<const float*>(char_values);
r->set_x(values[0]);
@@ -189,7 +189,7 @@ bool ParamTraits<gfx::Rect>::Read(const Message* m,
PickleIterator* iter,
gfx::Rect* r) {
const char* char_values;
- if (!iter->ReadBytes(&char_values, sizeof(int) * 4))
+ if (!m->ReadBytes(iter, &char_values, sizeof(int) * 4))
return false;
const int* values = reinterpret_cast<const int*>(char_values);
if (values[2] < 0 || values[3] < 0)
@@ -212,7 +212,7 @@ bool ParamTraits<gfx::RectF>::Read(const Message* m,
PickleIterator* iter,
gfx::RectF* r) {
const char* char_values;
- if (!iter->ReadBytes(&char_values, sizeof(float) * 4))
+ if (!m->ReadBytes(iter, &char_values, sizeof(float) * 4))
return false;
const float* values = reinterpret_cast<const float*>(char_values);
r->SetRect(values[0], values[1], values[2], values[3]);
@@ -241,7 +241,7 @@ bool ParamTraits<SkBitmap>::Read(const Message* m,
SkBitmap* r) {
const char* fixed_data;
int fixed_data_size = 0;
- if (!iter->ReadData(&fixed_data, &fixed_data_size) ||
+ if (!m->ReadData(iter, &fixed_data, &fixed_data_size) ||
(fixed_data_size <= 0)) {
NOTREACHED();
return false;
@@ -251,7 +251,7 @@ bool ParamTraits<SkBitmap>::Read(const Message* m,
const char* variable_data;
int variable_data_size = 0;
- if (!iter->ReadData(&variable_data, &variable_data_size) ||
+ if (!m->ReadData(iter, &variable_data, &variable_data_size) ||
(variable_data_size < 0)) {
NOTREACHED();
return false;