summaryrefslogtreecommitdiffstats
path: root/base/pickle.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-29 00:05:04 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-29 00:05:04 +0000
commit34d4861069f6528aac208a3268f8c4946d301a16 (patch)
tree0efd4735b9912a93b220f9e312d7ca14cf281360 /base/pickle.h
parentb9ef2965a07ca50fd94f1ab1d22ffcfdf62a2b6d (diff)
downloadchromium_src-34d4861069f6528aac208a3268f8c4946d301a16.zip
chromium_src-34d4861069f6528aac208a3268f8c4946d301a16.tar.gz
chromium_src-34d4861069f6528aac208a3268f8c4946d301a16.tar.bz2
Make the serialization of IPC::Messages inside other IPC::Messages independent
of the platform. This is necessary for sending nested messages between nacl (which the IPC system thinks is posix and so has extra header goo) and a Windows client app (which doesn't have this stuff). BUG= Review URL: https://chromiumcodereview.appspot.com/10667002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144840 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/pickle.h')
-rw-r--r--base/pickle.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/base/pickle.h b/base/pickle.h
index 2420f75..0eea490 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