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

Unified Diff: base/pickle.h

Issue 10667002: Make the serialization of IPC::Messages inside other IPC::Messages independent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ipc/ipc.gyp » ('j') | ipc/ipc_message.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/pickle.h
diff --git a/base/pickle.h b/base/pickle.h
index 2420f756270df665b2f164a5b4ff630779889a0f..0eea49042f18696160ee5633774632c26fd00958 100644
--- a/base/pickle.h
+++ b/base/pickle.h
@@ -168,9 +168,17 @@ class BASE_EXPORT Pickle {
bool ReadString16(PickleIterator* iter, string16* result) const {
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 {
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 {
return iter->ReadBytes(data, length);
}
@@ -214,7 +222,12 @@ class BASE_EXPORT Pickle {
bool WriteString(const std::string& value);
bool WriteWString(const std::wstring& value);
bool WriteString16(const string16& value);
+ // "Data" is a blob with a length. When you read it out you will be given the
+ // length. See also WriteBytes.
bool WriteData(const char* data, int length);
+ // "Bytes" is a blob with no length. The caller must specify the lenght both
+ // when reading and writing. It is normally used to serialize PoD types of a
+ // known size. See also WriteData.
bool WriteBytes(const void* data, int data_len);
// Same as WriteData, but allows the caller to write directly into the
« no previous file with comments | « no previous file | ipc/ipc.gyp » ('j') | ipc/ipc_message.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698