chromeos-dbus-bindings: passing multiple input files on command line

When generating D-Bus proxies for objects under D-Bus Object Manager
control, it is important to group all the proxies and tie them to
a single instance of Object Manager proxy that knows about the
subordinate interfaces and their properties.

In order to do this, multiple source XML files will be grouped into
one proxy header file, complete with all the proxy interfaces, signal
handlers as well as a single Object Manager proxy class that manages
all those proxies (this part will be done in a separate CL).

In order to supply more than one source XML file to the generator
executable, remove --input switch and let the files be passed directly.

GYP files that import proxies from other projects will need to do so
for more than one source target, so they can use a single GYP rule
as was defined in generate-dbus-bindings.gypi. However, that rule
is totally acceptable for generating adaptors, so, renamed the
generate-dbus-bindings.gypi into generate-dbus-adaptors.gypi to
be more specific and simplified it a bit.

Also made generated object proxies to allow explicit releasing of the
underlying dbus::ObjectProxy from the dbus::Bus. This is cannot be done
in the constructor since dbus::Bus::RemoveObjectProxy is an asynchronous
call and requires a message loop to be executed. For clients such as
buffet_client that doesn't have a message loop, removing the proxy
in the destructor causes a crash. For clients like Shill who need to
keep the bus clean, they can call ReleaseObjectProxy() before destroying
the proxy object.

BUG=chromium:431737
TEST=FEATURES=test emerge-link chromeos-dbus-bindings lorgnette apmanager

Change-Id: I6737c155c528f46d480d51aaf8420a1dad00f83e
Reviewed-on: https://chromium-review.googlesource.com/231155
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/chromeos-dbus-bindings/proxy_generator.h b/chromeos-dbus-bindings/proxy_generator.h
index b8f7e7b..591648d 100644
--- a/chromeos-dbus-bindings/proxy_generator.h
+++ b/chromeos-dbus-bindings/proxy_generator.h
@@ -27,24 +27,32 @@
 
 class ProxyGenerator : public HeaderGenerator {
  public:
-  static bool GenerateProxy(const std::vector<Interface>& interfaces,
-                            const base::FilePath& output_file);
+  static bool GenerateProxies(const std::vector<Interface>& interfaces,
+                              const base::FilePath& output_file);
 
  private:
   friend class ProxyGeneratorTest;
 
+  // Generates one interface proxy.
+  static void GenerateInterfaceProxy(const Interface& interface,
+                                     IndentedText* text);
+
   // Generates the constructor and destructor for the proxy.
-  static void AddConstructor(const std::vector<Interface>& interfaces,
+  static void AddConstructor(const Interface& interface,
                              const std::string& class_name,
                              IndentedText* text);
   static void AddDestructor(const std::string& class_name,
                             IndentedText* text);
 
   // Generates a callback for signal receiver registration completion.
-  static void AddSignalConnectedCallback(IndentedText *text);
+  static void AddSignalConnectedCallback(IndentedText* text);
+
+  // Generates ReleaseObjectProxy() method to release ownership
+  // of the object proxy.
+  static void AddReleaseObjectProxy(IndentedText* text);
 
   // Generates the method signatures for signal receivers.
-  static void AddSignalReceiver(const std::vector<Interface>& interfaces,
+  static void AddSignalReceiver(const Interface& interface,
                                 IndentedText* text);
 
   // Generates a native C++ method which calls a D-Bus method on the proxy.