ml: Switch to new Mojo types
Migrate from &, Request, etc to pending_receiver, etc, now that these
are supported in libchrome.
This includes migrating from "connection error" to "disconnection"
terminology that Mojo switched to (since disconnection is not always
error).
BUG=chromium:1103123
TEST=ebuild bla/ml-9999.ebuild clean test
TEST=tast -verbose run bla platform.MLServiceBootstrap power.SmartDim
Change-Id: I015e116442281cbda313eb8d0593bb543090008c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2289245
Tested-by: Andrew Moylan <amoylan@chromium.org>
Auto-Submit: Andrew Moylan <amoylan@chromium.org>
Reviewed-by: Honglin Yu <honglinyu@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Reviewed-by: Thanh Nguyen <thanhdng@chromium.org>
Commit-Queue: Andrew Moylan <amoylan@chromium.org>
diff --git a/ml/graph_executor_impl.cc b/ml/graph_executor_impl.cc
index 0de35b6..3c902b1 100644
--- a/ml/graph_executor_impl.cc
+++ b/ml/graph_executor_impl.cc
@@ -19,7 +19,7 @@
namespace {
using ::chromeos::machine_learning::mojom::ExecuteResult;
-using ::chromeos::machine_learning::mojom::GraphExecutorRequest;
+using ::chromeos::machine_learning::mojom::GraphExecutor;
using ::chromeos::machine_learning::mojom::Int64List;
using ::chromeos::machine_learning::mojom::Tensor;
using ::chromeos::machine_learning::mojom::TensorPtr;
@@ -157,17 +157,17 @@
const std::map<std::string, int>& required_inputs,
const std::map<std::string, int>& required_outputs,
std::unique_ptr<tflite::Interpreter> interpreter,
- GraphExecutorRequest request,
+ mojo::PendingReceiver<GraphExecutor> receiver,
const std::string& metrics_model_name)
: required_inputs_(required_inputs),
required_outputs_(required_outputs),
interpreter_(std::move(interpreter)),
- binding_(this, std::move(request)),
+ receiver_(this, std::move(receiver)),
metrics_model_name_(metrics_model_name) {}
-void GraphExecutorImpl::set_connection_error_handler(
- base::Closure connection_error_handler) {
- binding_.set_connection_error_handler(std::move(connection_error_handler));
+void GraphExecutorImpl::set_disconnect_handler(
+ base::Closure disconnect_handler) {
+ receiver_.set_disconnect_handler(std::move(disconnect_handler));
}
void GraphExecutorImpl::Execute(base::flat_map<std::string, TensorPtr> tensors,