diff options
author | Alex Deymo <deymo@google.com> | 2016-02-03 17:47:32 -0800 |
---|---|---|
committer | Alex Deymo <deymo@google.com> | 2016-02-03 20:49:21 -0800 |
commit | c7aa24adb840d04c381c5d1c4721de4c322cc4e2 (patch) | |
tree | b1448f47843b20c47237005305e06e6207a06230 | |
parent | ad918f037cc9b89c42f8a1e16017b800939e4cc5 (diff) | |
download | common-c7aa24adb840d04c381c5d1c4721de4c322cc4e2.tar.gz |
service_example: Instantiate a brillo::MessageLoop.
The brillo::BinderWatcher now requires a brillo::MessageLoop to work.
Bug: None
TEST=mmma product/google/common/service_example
Change-Id: I27175aeacc708764e366aec604f84a76cfdc337f
-rw-r--r-- | service_example/brillo_example_client.cpp | 3 | ||||
-rw-r--r-- | service_example/brillo_example_service.cpp | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/service_example/brillo_example_client.cpp b/service_example/brillo_example_client.cpp index ec63569..21804ee 100644 --- a/service_example/brillo_example_client.cpp +++ b/service_example/brillo_example_client.cpp @@ -69,15 +69,14 @@ int main() { service->RegisterCallback(cbo, 3); // Create a message loop. - // TODO(ralphnathan): Change this to brillo::BaseMessageLoop. base::MessageLoopForIO message_loop_for_io; + brillo::BaseMessageLoop message_loop{&message_loop_for_io}; // Initialize a binder watcher. brillo::BinderWatcher watcher; watcher.Init(); // Poll stdin. - brillo::BaseMessageLoop message_loop(&message_loop_for_io); base::Closure stdin_callback = base::Bind(&StdinCallback, service); message_loop.WatchFileDescriptor( STDIN_FILENO, brillo::BaseMessageLoop::kWatchRead, true, stdin_callback); diff --git a/service_example/brillo_example_service.cpp b/service_example/brillo_example_service.cpp index 4c4af15..cf98665 100644 --- a/service_example/brillo_example_service.cpp +++ b/service_example/brillo_example_service.cpp @@ -20,6 +20,7 @@ #include <binder/IServiceManager.h> #include <binder/Status.h> #include <brillo/binder_watcher.h> +#include <brillo/message_loops/base_message_loop.h> #include <brillo/syslog_logging.h> #include <utils/String16.h> @@ -68,13 +69,13 @@ int main() { "Failed to get IExampleService binder from service manager!"; // Create a message loop. - // TODO(ralphnathan): Change this to brillo::BaseMessageLoop. base::MessageLoopForIO message_loop_for_io; + brillo::BaseMessageLoop message_loop{&message_loop_for_io}; // Initialize a binder watcher. brillo::BinderWatcher watcher; watcher.Init(); // Run the message loop. - message_loop_for_io.Run(); + message_loop.Run(); } |