From 35f89638257b66497d53c20ea6c5717aac875884 Mon Sep 17 00:00:00 2001 From: Alex Vakulenko Date: Fri, 9 Oct 2015 08:18:35 -0700 Subject: [PATCH] metricsd: Update weave command APIs Weave has changed some of D-Bus APIs and metrics needs to be updated accrdingly. Command::Done is replaced with Complete(), Command::Abort now takes error code and error messages, Command::category is removed and Command::status is renamed to Command::state Change-Id: Ifbfd6d852f4a328168e28484d1152a24b8c8b42b --- metricsd/metrics_daemon.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/metricsd/metrics_daemon.cc b/metricsd/metrics_daemon.cc index 5b80b05b3..f83c5d42c 100644 --- a/metricsd/metrics_daemon.cc +++ b/metricsd/metrics_daemon.cc @@ -326,7 +326,7 @@ void MetricsDaemon::OnShutdown(int* return_code) { } void MetricsDaemon::OnWeaveCommand(CommandProxy* command) { - if (command->category() != "metrics" || command->status() != "queued") { + if (command->state() != "queued") { return; } @@ -342,24 +342,26 @@ void MetricsDaemon::OnEnableMetrics(CommandProxy* command) { if (base::WriteFile(metrics_directory_.Append(metrics::kConsentFileName), "", 0) != 0) { PLOG(ERROR) << "Could not create the consent file."; - command->Abort(nullptr); + command->Abort("metrics_error", "Could not create the consent file", + nullptr); return; } NotifyStateChanged(); - command->Done(nullptr); + command->Complete({}, nullptr); } void MetricsDaemon::OnDisableMetrics(CommandProxy* command) { if (!base::DeleteFile(metrics_directory_.Append(metrics::kConsentFileName), false)) { - PLOG(ERROR) << "Cound not delete the consent file."; - command->Abort(nullptr); + PLOG(ERROR) << "Could not delete the consent file."; + command->Abort("metrics_error", "Could not delete the consent file", + nullptr); return; } NotifyStateChanged(); - command->Done(nullptr); + command->Complete({}, nullptr); } void MetricsDaemon::NotifyStateChanged() {