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

Unified Diff: dbus/message.h

Issue 9315006: Adding support for sending/receiving proto bufs to dbus library. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Made changes requested by satorux Created 8 years, 11 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 | dbus/message.cc » ('j') | dbus/message.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/message.h
diff --git a/dbus/message.h b/dbus/message.h
index ceeb0edbf7a74f3417165f420c04539b5a8989a0..b6155941ed7c237265a2c737475da8ae172f0ae6 100644
--- a/dbus/message.h
+++ b/dbus/message.h
@@ -11,6 +11,7 @@
#include <dbus/dbus.h>
#include "base/basictypes.h"
+#include "third_party/protobuf/src/google/protobuf/message_lite.h"
satorux1 2012/01/31 21:42:31 I think you can remove the include from .h file, b
rharrison 2012/02/01 19:03:20 Done.
namespace dbus {
@@ -294,6 +295,14 @@ class MessageWriter {
// specialized function.
void AppendArrayOfObjectPaths(const std::vector<std::string>& object_paths);
+ // Appends the protocol buffer. The buffer is serialized into an array of
satorux1 2012/01/31 21:42:31 Appends the protocol buffer as an array of bytes.
rharrison 2012/02/01 19:03:20 Done.
+ // bytes before communication, since protocol buffers are not a native dbus
+ // type. On the receiving size the array of bytes needs to be read and
+ // deserialized into a protocol buffer of the correct type. There are methods
+ // in MessageReader to assist in this.
+ // Return true on succes and fail when serialization is not successful.
+ bool AppendProtocolBuffer(const google::protobuf::MessageLite& protobuf);
satorux1 2012/01/31 21:42:31 AppendProtoAsArrayOfBytes() would make it clear th
rharrison 2012/02/01 19:03:20 Done.
+
// Appends the byte wrapped in a variant data container. Variants are
// widely used in D-Bus services so it's worth having a specialized
// function. For instance, The third parameter of
@@ -392,6 +401,14 @@ class MessageReader {
// function.
bool PopArrayOfObjectPaths(std::vector<std::string>* object_paths);
+ // Gets the array of bytes at the current iterator position. It then parses
+ // this binary blob into the protocol buffer supplied.
+ // Returns true and advances the iterator on success. On failure returns false
+ // and emits an error message on the source of the failure. The two most
+ // common errors come from the iterator not currently being at a byte array or
+ // the wrong type of protocol buffer is passed in and the parse fails.
+ bool PopProtocolBuffer(google::protobuf::MessageLite* protobuf);
satorux1 2012/01/31 21:42:31 PopArrayOfBytesAsProto() ?
rharrison 2012/02/01 19:03:20 Done.
+
// Gets the byte from the variant data container at the current iterator
// position.
// Returns true and advances the iterator on success.
« no previous file with comments | « no previous file | dbus/message.cc » ('j') | dbus/message.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698