DescriptionImplement a trivial Mojo EchoService that can be connected to over DBus
Some systems might like to use Mojo IPC to talk to services that are
running outside the auspices of the Mojo shell. DBus is one potential
channel to use for bootstrapping such a connection.
In order to allow the externally-running service to accept connections
from a Mojo shell, we need to get it a ShellHandle. This change
defines a DBusServiceLoader that implements the ServiceLoader
interface. DBusServiceLoader creates a dedicated MessagePipe, passes
a handle to one end to the desired service over DBus, and then passes
the ShellHandle over that pipe.
This class assumes the following:
1) Your service is already running,
2) Your service implements the Mojo ExternalService API
(from external_service.mojom).
3) Your service exports an object that implements the org.chromium.Mojo
DBus interface:
<interface name="org.chromium.Mojo">
<method name="ConnectChannel">
<arg type="h" name="file_descriptor" direction="in" />
</method>
</interface>
This change also includes a trivial DBusEchoService that can be
"loaded" using the DBusServiceLoader, as well as a mojo example app
that connects to this service.
BUG=364903
TEST=run mojo_dbus_echo_service in one shell, and then load mojo_dbus_echo in the mojo shell. "who" should successfully echo between the two.
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=265927
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=266508
Patch Set 1 #Patch Set 2 : Dropped logging in dbus_echo_service to VLOG #
Total comments: 3
Patch Set 3 : Build DBus-related stuff only on Linux #Patch Set 4 : Rebase onto ServiceConnection/Connector CL #Patch Set 5 : Rebase onto dave's CL to move ServiceLoader ownership #
Total comments: 8
Patch Set 6 : Automatically exclude DBusServiceLoader on non-Linux #
Total comments: 12
Patch Set 7 : Fix Nits #Patch Set 8 : rebase #Patch Set 9 : Fix clang breakage #Patch Set 10 : Rebase to switch MojoChannelInit to ChannelInit #
Messages
Total messages: 32 (0 generated)
|