File size: 2,506 Bytes
f8dc3a0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/services/machine_learning/public/cpp/service_connection.h"
#include <utility>
#include "base/component_export.h"
#include "base/no_destructor.h"
#include "chromeos/lacros/lacros_service.h"
#include "chromeos/services/machine_learning/public/mojom/machine_learning_service.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace lacros {
namespace machine_learning {
namespace {
// Real Impl of ServiceConnection
class COMPONENT_EXPORT(CHROMEOS_MLSERVICE) ServiceConnectionLacros
: public chromeos::machine_learning::ServiceConnection {
public:
ServiceConnectionLacros();
ServiceConnectionLacros(const ServiceConnectionLacros&) = delete;
ServiceConnectionLacros& operator=(const ServiceConnectionLacros&) = delete;
~ServiceConnectionLacros() override;
chromeos::machine_learning::mojom::MachineLearningService&
GetMachineLearningService() override;
void BindMachineLearningService(
mojo::PendingReceiver<
chromeos::machine_learning::mojom::MachineLearningService> receiver)
override;
void Initialize() override;
};
ServiceConnectionLacros::ServiceConnectionLacros() = default;
ServiceConnectionLacros::~ServiceConnectionLacros() = default;
chromeos::machine_learning::mojom::MachineLearningService&
ServiceConnectionLacros::GetMachineLearningService() {
mojo::Remote<chromeos::machine_learning::mojom::MachineLearningService>&
machine_learning_service_remote =
chromeos::LacrosService::Get()
->GetRemote<
chromeos::machine_learning::mojom::MachineLearningService>();
return *machine_learning_service_remote.get();
}
void ServiceConnectionLacros::BindMachineLearningService(
mojo::PendingReceiver<
chromeos::machine_learning::mojom::MachineLearningService> receiver) {
chromeos::LacrosService::Get()->BindMachineLearningService(
std::move(receiver));
}
void ServiceConnectionLacros::Initialize() {}
} // namespace
} // namespace machine_learning
} // namespace lacros
namespace chromeos {
namespace machine_learning {
ServiceConnection* ServiceConnection::CreateRealInstance() {
static base::NoDestructor<lacros::machine_learning::ServiceConnectionLacros>
service_connection;
return service_connection.get();
}
} // namespace machine_learning
} // namespace chromeos
|