summaryrefslogtreecommitdiff
path: root/chromeos-dbus-bindings/proxy_generator.h
diff options
context:
space:
mode:
authorAlex Vakulenko <avakulenko@chromium.org>2014-11-03 14:52:09 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-06 06:32:43 +0000
commitfafef1300f94cada37c4fac0e0c7ba46aeee5ad1 (patch)
tree66f335624af7de6436aaac780bd40dce477ebbde /chromeos-dbus-bindings/proxy_generator.h
parentdd885751db1da01f14c873484e1344378614108a (diff)
downloaddbus-binding-generator-fafef1300f94cada37c4fac0e0c7ba46aeee5ad1.tar.gz
chromeos-dbus-bindings: Redesign due to underlying DBusObject change.
DBusObject method handlers have been changed to allow for async method handlers. D-Bus proxy generator is changing accordingly to reflect the underlying implementation change. Now it is possible to generate asyc-ready method handlers by adding annotations to the method elements in the source XML file. With the "org.chromium.DBus.Method.Kind" attribute on a method description element, you can now control which of the four supported method handers are to be used: - "normal" (default): the handler signature is as follows: bool Handler(ErrorPtr* error, const Type1& in1, const Type2& in2, ... Type3* out1, Type4* out2, ...); - "simple": the handler does not fail and hence does not return any error information. One of the following two signatures: RetType Handler(const Type1& in1, const Type2& in2, ...); void Handler(const Type1& in1, const Type2& in2, ..., Type3* out1, Type4* out2, ...); - "async": is a possibly asynchronous method handler: void Handler(scoped_ptr<DBusMethodResponse> response, const Type1& in1, const Type2& in2, ...); - "raw": the fully custom specialty handler that allows raw implementation of D-Bus method with no additional framework: void Handler(dbus::MethodCall* method_call, ResponseSender sender); As part of this change, it was also possible to provide implementations for methods returning more than one value. A method element can also specify that the method handler can be marked as 'const' in the C++ adapter by adding the following attribute with the value of "true": "org.chromium.DBus.Method.Const" Another significant change to the D-Bus binding generator is the support of multiple interfaces per D-Bus object. Now the XML file can list multiple <interface> tags for a class node. This makes the generator to create the abstract C++ interface adaptors that contain protorypes for all the methods, signals and properties for that interface. The final interface implementation class derives from one or more adaptor(s) and implements the actual interface methods. Finally, updated lorgnette to use the new generated adaptor for its D-Bus interfaces. BUG=chromium:419271, chromium:420925, chromium:428390 TEST=FEATURES=test emerge-link chromeos-dbus-bindings Change-Id: I02d1fc2e21a230e0f4c959c54ed7c71490945b12 Reviewed-on: https://chromium-review.googlesource.com/227281 Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Vakulenko <avakulenko@chromium.org> Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Diffstat (limited to 'chromeos-dbus-bindings/proxy_generator.h')
-rw-r--r--chromeos-dbus-bindings/proxy_generator.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/chromeos-dbus-bindings/proxy_generator.h b/chromeos-dbus-bindings/proxy_generator.h
index 66dd8ba..b8f7e7b 100644
--- a/chromeos-dbus-bindings/proxy_generator.h
+++ b/chromeos-dbus-bindings/proxy_generator.h
@@ -27,14 +27,14 @@ struct Interface;
class ProxyGenerator : public HeaderGenerator {
public:
- static bool GenerateProxy(const Interface& interface,
+ static bool GenerateProxy(const std::vector<Interface>& interfaces,
const base::FilePath& output_file);
private:
friend class ProxyGeneratorTest;
// Generates the constructor and destructor for the proxy.
- static void AddConstructor(const Interface& interface,
+ static void AddConstructor(const std::vector<Interface>& interfaces,
const std::string& class_name,
IndentedText* text);
static void AddDestructor(const std::string& class_name,
@@ -44,8 +44,8 @@ class ProxyGenerator : public HeaderGenerator {
static void AddSignalConnectedCallback(IndentedText *text);
// Generates the method signatures for signal receivers.
- static void AddMethodInterface(const Interface& interface,
- IndentedText* text);
+ static void AddSignalReceiver(const std::vector<Interface>& interfaces,
+ IndentedText* text);
// Generates a native C++ method which calls a D-Bus method on the proxy.
static void AddMethodProxy(const Interface::Method& interface,