Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Unified Diff: services/data_decoder/data_decoder_service.cc

Issue 2795883002: Eliminate OnConnect usage (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/data_decoder/data_decoder_service.h ('k') | services/device/device_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/data_decoder/data_decoder_service.cc
diff --git a/services/data_decoder/data_decoder_service.cc b/services/data_decoder/data_decoder_service.cc
index 17c9e424a230fb04a376d42060ac8333182e26ac..cf79391031003744883db4c222ac43330775c9fc 100644
--- a/services/data_decoder/data_decoder_service.cc
+++ b/services/data_decoder/data_decoder_service.cc
@@ -11,18 +11,12 @@
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "services/data_decoder/image_decoder_impl.h"
#include "services/data_decoder/public/interfaces/image_decoder.mojom.h"
-#include "services/service_manager/public/cpp/interface_registry.h"
#include "services/service_manager/public/cpp/service_context.h"
namespace data_decoder {
namespace {
-void OnConnectionLost(std::unique_ptr<service_manager::ServiceContextRef> ref) {
- // No-op. This merely takes ownership of |ref| so it can be destroyed when
- // this function is invoked.
-}
-
void OnImageDecoderRequest(
service_manager::ServiceContextRefFactory* ref_factory,
mojom::ImageDecoderRequest request) {
@@ -45,20 +39,16 @@ std::unique_ptr<service_manager::Service> DataDecoderService::Create() {
void DataDecoderService::OnStart() {
ref_factory_.reset(new service_manager::ServiceContextRefFactory(base::Bind(
&DataDecoderService::MaybeRequestQuitDelayed, base::Unretained(this))));
+ registry_.AddInterface(
+ base::Bind(&OnImageDecoderRequest, ref_factory_.get()));
}
-bool DataDecoderService::OnConnect(
- const service_manager::ServiceInfo& remote_info,
- service_manager::InterfaceRegistry* registry) {
- // Add a reference to the service and tie it to the lifetime of the
- // InterfaceRegistry's connection.
- std::unique_ptr<service_manager::ServiceContextRef> connection_ref =
- ref_factory_->CreateRef();
- registry->AddConnectionLostClosure(
- base::Bind(&OnConnectionLost, base::Passed(&connection_ref)));
- registry->AddInterface(
- base::Bind(&OnImageDecoderRequest, ref_factory_.get()));
- return true;
+void DataDecoderService::OnBindInterface(
+ const service_manager::ServiceInfo& source_info,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle interface_pipe) {
+ registry_.BindInterface(source_info.identity, interface_name,
+ std::move(interface_pipe));
}
void DataDecoderService::MaybeRequestQuitDelayed() {
« no previous file with comments | « services/data_decoder/data_decoder_service.h ('k') | services/device/device_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698