summaryrefslogtreecommitdiffstats
path: root/metricsd/metrics_collector.cc
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2016-01-04 14:11:25 -0800
committerTodd Poynor <toddpoynor@google.com>2016-01-05 15:48:04 -0800
commitb77ae4506f7bc9a9ee913427f52dc4acfd012737 (patch)
tree41aa2ad9fe64d3bc17c85c285abd85ef3988c278 /metricsd/metrics_collector.cc
parent946d8152b2f91b78e7d41363254278e712ec3f4b (diff)
downloadcore-b77ae4506f7bc9a9ee913427f52dc4acfd012737.tar.gz
core-b77ae4506f7bc9a9ee913427f52dc4acfd012737.tar.bz2
core-b77ae4506f7bc9a9ee913427f52dc4acfd012737.zip
Remove metrics collector service trampoline
No longer needed to trampoline between RTTI and non-RTTI compiles. Move the service impl from libmetricscollector service to the metrics_collector executable, now that RTTI is no longer used (and the impl is not used by binder clients). Other fixups, including: * Move service registration and binder watcher to metrics_collector main. * Compile libmetricscollectorservice with clang just because. Bug: 26292405 Change-Id: Iae8115c13b203ff03d49bf7678d5eb3ede30e855
Diffstat (limited to 'metricsd/metrics_collector.cc')
-rw-r--r--metricsd/metrics_collector.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/metricsd/metrics_collector.cc b/metricsd/metrics_collector.cc
index a5daab5a2..97690ddf4 100644
--- a/metricsd/metrics_collector.cc
+++ b/metricsd/metrics_collector.cc
@@ -30,12 +30,13 @@
#include <base/strings/string_split.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
+#include <brillo/binder_watcher.h>
#include <brillo/osrelease_reader.h>
#include <dbus/dbus.h>
#include <dbus/message.h>
#include "constants.h"
-#include "metrics_collector_service_trampoline.h"
+#include "metrics_collector_service_impl.h"
using base::FilePath;
using base::StringPrintf;
@@ -128,10 +129,18 @@ int MetricsCollector::Run() {
version_cumulative_cpu_use_->Set(0);
}
- // Start metricscollectorservice via trampoline
- MetricsCollectorServiceTrampoline metricscollectorservice_trampoline(this);
- metricscollectorservice_trampoline.Run();
-
+ // Start metricscollectorservice
+ android::sp<BnMetricsCollectorServiceImpl> metrics_collector_service =
+ new BnMetricsCollectorServiceImpl(this);
+ android::status_t status = android::defaultServiceManager()->addService(
+ metrics_collector_service->getInterfaceDescriptor(),
+ metrics_collector_service);
+ CHECK(status == android::OK)
+ << "failed to register service metricscollectorservice";
+
+ // Watch Binder events in the main loop
+ brillo::BinderWatcher binder_watcher;
+ CHECK(binder_watcher.Init()) << "Binder FD watcher init failed";
return brillo::DBusDaemon::Run();
}