0

shimless: Remove rmad.proto references.

Temporarily remove references to rmad.proto so the prototype version can
be replaced in //third_party/cros_system_api/dbus/rmad.
New version of rmad.proto in
https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2836746

Bug: 1194292
TEST=Built and deployed. RmadClient is currently unused and only enabled
by the ShimlessRMAFlow feature flag.

Change-Id: I2719b78af64574f51b785b6a04c75bf47ee320b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2854396
Reviewed-by: Joon Ahn <joonbug@chromium.org>
Reviewed-by: Zentaro Kavanagh <zentaro@chromium.org>
Commit-Queue: Gavin Dodd <gavindodd@google.com>
Cr-Commit-Position: refs/heads/master@{#876691}
This commit is contained in:
Gavin Dodd
2021-04-27 18:50:40 +00:00
committed by Chromium LUCI CQ
parent 1945fd6d29
commit 30286d4425
4 changed files with 19 additions and 26 deletions

@ -10,7 +10,7 @@ FakeRmadClient::FakeRmadClient() = default;
FakeRmadClient::~FakeRmadClient() = default;
void FakeRmadClient::GetCurrentState(
DBusMethodCallback<rmad::GetCurrentStateReply> callback) {
DBusMethodCallback<rmad::GetStateReply> callback) {
// TODO(gavindodd): Implement fake state.
std::move(callback).Run(base::nullopt);
}

@ -6,7 +6,6 @@
#define CHROMEOS_DBUS_RMAD_FAKE_RMAD_CLIENT_H_
#include "base/component_export.h"
#include "chromeos/dbus/rmad/rmad.pb.h"
#include "chromeos/dbus/rmad/rmad_client.h"
namespace chromeos {
@ -19,7 +18,7 @@ class COMPONENT_EXPORT(RMAD) FakeRmadClient : public RmadClient {
~FakeRmadClient() override;
void GetCurrentState(
DBusMethodCallback<rmad::GetCurrentStateReply> callback) override;
DBusMethodCallback<rmad::GetStateReply> callback) override;
};
} // namespace chromeos

@ -22,7 +22,7 @@ class RmadClientImpl : public RmadClient {
public:
void Init(dbus::Bus* bus);
void GetCurrentState(
DBusMethodCallback<rmad::GetCurrentStateReply> callback) override;
DBusMethodCallback<rmad::GetStateReply> callback) override;
RmadClientImpl() = default;
RmadClientImpl(const RmadClientImpl&) = delete;
@ -30,9 +30,8 @@ class RmadClientImpl : public RmadClient {
~RmadClientImpl() override = default;
private:
void OnGetCurrentStateMethod(
DBusMethodCallback<rmad::GetCurrentStateReply> callback,
dbus::Response* response);
void OnGetCurrentStateMethod(DBusMethodCallback<rmad::GetStateReply> callback,
dbus::Response* response);
dbus::ObjectProxy* rmad_proxy_ = nullptr;
@ -47,18 +46,10 @@ void RmadClientImpl::Init(dbus::Bus* bus) {
}
void RmadClientImpl::GetCurrentState(
DBusMethodCallback<rmad::GetCurrentStateReply> callback) {
DBusMethodCallback<rmad::GetStateReply> callback) {
dbus::MethodCall method_call(rmad::kRmadInterfaceName,
rmad::kGetCurrentStateMethod);
dbus::MessageWriter writer(&method_call);
// Create the empty request proto.
rmad::GetCurrentStateRequest protobuf_request;
if (!writer.AppendProtoAsArrayOfBytes(protobuf_request)) {
LOG(ERROR) << "Error constructing message for "
<< rmad::kGetCurrentStateMethod;
std::move(callback).Run(base::nullopt);
return;
}
rmad_proxy_->CallMethod(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::BindOnce(&RmadClientImpl::OnGetCurrentStateMethod,
@ -66,7 +57,7 @@ void RmadClientImpl::GetCurrentState(
}
void RmadClientImpl::OnGetCurrentStateMethod(
DBusMethodCallback<rmad::GetCurrentStateReply> callback,
DBusMethodCallback<rmad::GetStateReply> callback,
dbus::Response* response) {
if (!response) {
LOG(ERROR) << "Error calling " << rmad::kGetCurrentStateMethod;
@ -75,13 +66,8 @@ void RmadClientImpl::OnGetCurrentStateMethod(
}
dbus::MessageReader reader(response);
rmad::GetCurrentStateReply response_proto;
if (!reader.PopArrayOfBytesAsProto(&response_proto)) {
LOG(ERROR) << "Unable to decode " << rmad::kGetCurrentStateMethod
<< " response";
std::move(callback).Run(base::nullopt);
return;
}
rmad::GetStateReply response_proto;
// TODO(gavindodd): pop the proto.
std::move(callback).Run(response_proto);
}

@ -7,12 +7,20 @@
#include "base/component_export.h"
#include "chromeos/dbus/dbus_method_call_status.h"
#include "chromeos/dbus/rmad/rmad.pb.h"
namespace dbus {
class Bus;
}
// Temporary to allow code to compile while prototype rmad.proto is replaced.
namespace rmad {
class GetStateReply {
public:
int state() { return 0; }
};
} // namespace rmad
namespace chromeos {
// RmadClient is responsible for receiving D-bus signals from the RmaDaemon
@ -37,7 +45,7 @@ class COMPONENT_EXPORT(RMAD) RmadClient {
// Asynchronously gets the current RMA state.
// The state contains an error code and the current state of the RMA process.
virtual void GetCurrentState(
DBusMethodCallback<rmad::GetCurrentStateReply> callback) = 0;
DBusMethodCallback<rmad::GetStateReply> callback) = 0;
protected:
// Initialize/Shutdown should be used instead.