Merge "metricsd: Create a brillo::MessageLoop."
This commit is contained in:
commit
205cdb8868
2 changed files with 7 additions and 2 deletions
|
@ -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_;
|
||||
|
|
Loading…
Reference in a new issue