Skip to content
Snippets Groups Projects
Commit 205cdb88 authored by Alex Deymo's avatar Alex Deymo Committed by Gerrit Code Review
Browse files

Merge "metricsd: Create a brillo::MessageLoop."

parents 42a53e0c f1bf9e5f
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@
#include <binder/IServiceManager.h>
#include <brillo/binder_watcher.h>
#include <brillo/message_loops/base_message_loop.h>
#include <utils/Errors.h>
#include "uploader/bn_metricsd_impl.h"
......@@ -40,15 +41,17 @@ void MetricsdServiceRunner::Run() {
CHECK(status == android::OK) << "Metricsd service registration failed";
message_loop_for_io_.reset(new base::MessageLoopForIO);
message_loop_.reset(new brillo::BaseMessageLoop(message_loop_for_io_.get()));
brillo::BinderWatcher watcher;
brillo::BinderWatcher watcher(message_loop_.get());
CHECK(watcher.Init()) << "failed to initialize the binder file descriptor "
<< "watcher";
message_loop_for_io_->Run();
message_loop_->Run();
// Delete the message loop here as it needs to be deconstructed in the thread
// it is attached to.
message_loop_.reset();
message_loop_for_io_.reset();
}
......
......@@ -21,6 +21,7 @@
#include <thread>
#include <base/message_loop/message_loop.h>
#include <brillo/message_loops/message_loop.h>
#include "uploader/crash_counters.h"
......@@ -39,6 +40,7 @@ class MetricsdServiceRunner {
void Run();
std::unique_ptr<base::MessageLoopForIO> message_loop_for_io_;
std::unique_ptr<brillo::MessageLoop> message_loop_;
std::unique_ptr<std::thread> thread_;
std::shared_ptr<CrashCounters> counters_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment