summaryrefslogtreecommitdiffstats
path: root/dbus/message.h
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-24 15:59:40 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-24 15:59:40 +0000
commit38715910ea552ad5198b6dba8bca3a57f46c1e9a (patch)
tree6f24b031d0261aa086892229cbd6a5cd8cb23668 /dbus/message.h
parent1d82a58776d3b5233028bdc7f59c52a21a835177 (diff)
downloadchromium_src-38715910ea552ad5198b6dba8bca3a57f46c1e9a.zip
chromium_src-38715910ea552ad5198b6dba8bca3a57f46c1e9a.tar.gz
chromium_src-38715910ea552ad5198b6dba8bca3a57f46c1e9a.tar.bz2
chromeos: Make dbus::MessageReader memory ownership explicit
Make memory returned by MessageReader::PopArrayOfBytes() const to make it clearer that ownership remains with the MessageReader. Also update PopArrayOfStrings() and PopArrayOfObjectPaths() to clear the passed-in vectors before appending to them. BUG=none TBR=isherman@chromium.org,mvanouwerkerk@chromium.org Review URL: https://codereview.chromium.org/176693003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/message.h')
-rw-r--r--dbus/message.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/dbus/message.h b/dbus/message.h
index 54ca036..db3456a 100644
--- a/dbus/message.h
+++ b/dbus/message.h
@@ -408,12 +408,14 @@ class CHROME_DBUS_EXPORT MessageReader {
// Arrays of bytes are often used for exchanging binary blobs hence it's
// worth having a specialized function.
//
- // |bytes| must be copied if the contents will be referenced after the
- // MessageReader is destroyed.
- bool PopArrayOfBytes(uint8** bytes, size_t* length);
-
- // Gets the array of strings at the current iterator position.
- // Returns true and advances the iterator on success.
+ // Ownership of the memory pointed to by |bytes| remains with the
+ // MessageReader; |bytes| must be copied if the contents will be referenced
+ // after the MessageReader is destroyed.
+ bool PopArrayOfBytes(const uint8** bytes, size_t* length);
+
+ // Gets the array of strings at the current iterator position. |strings| is
+ // cleared before being modified. Returns true and advances the iterator on
+ // success.
//
// Arrays of strings are often used to communicate with D-Bus
// services like KWallet, hence it's worth having a specialized
@@ -421,7 +423,8 @@ class CHROME_DBUS_EXPORT MessageReader {
bool PopArrayOfStrings(std::vector<std::string>* strings);
// Gets the array of object paths at the current iterator position.
- // Returns true and advances the iterator on success.
+ // |object_paths| is cleared before being modified. Returns true and advances
+ // the iterator on success.
//
// Arrays of object paths are often used to communicate with D-Bus
// services like NetworkManager, hence it's worth having a specialized