libchromeos: Strongly type return values of async D-Bus calls

Async method handlers currently take just a generic DBusMethodResponse
object as a parameter and it is up to the handler's implementation to
return the correct number of values of correct types.

When using D-Bus binding code generator, the number and types of both
input and output parameters of a method are well known. However with
the current implementation, async method handler take just a response
object and lose the type information of the return values and rely
on the implementation to provide both the correct number of return
values and their types.

This change adds the ability to have strongly-typed response object
in method handlers that explicitly describes the number of return
values and their types.

Now, the async method handler signature is changed from:

  bool Handler(scoped_ptr<DBusMethodResponse> response,
               InTypes... inputs);

to:

  bool Handler(scoped_ptr<DBusMethodResponse<OutTypes...>> response,
               InTypes... inputs);

Attempt to call response->Return() with wrong number of parameters or
mismatched types will be caught at compile time.

BUG=None
TEST=FEATURES=test emerge-link libchromeos buffet peerd lorgnette

Change-Id: Ie90eaacfc091484262a09f273a7aef6aaec713c9
Reviewed-on: https://chromium-review.googlesource.com/229332
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2 files changed
tree: 8f918c07e9633756c874fbec8c4735496a0bf24c
  1. buffet/