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

Unified Diff: services/shape_detection/shape_detection_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/shape_detection/shape_detection_service.h ('k') | services/tracing/service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shape_detection/shape_detection_service.cc
diff --git a/services/shape_detection/shape_detection_service.cc b/services/shape_detection/shape_detection_service.cc
index 9d4000b28be1765f490411b045d849d69d1a94e0..6891d4a672cf039fcb61a4a929aaedcdb5ed9f67 100644
--- a/services/shape_detection/shape_detection_service.cc
+++ b/services/shape_detection/shape_detection_service.cc
@@ -5,7 +5,6 @@
#include "services/shape_detection/shape_detection_service.h"
#include "base/macros.h"
-#include "services/service_manager/public/cpp/interface_registry.h"
#include "services/service_manager/public/cpp/service_context.h"
#include "services/shape_detection/barcode_detection_impl.h"
#include "services/shape_detection/face_detection_provider_impl.h"
@@ -13,14 +12,6 @@
namespace shape_detection {
-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.
-}
-}
-
std::unique_ptr<service_manager::Service> ShapeDetectionService::Create() {
return base::MakeUnique<ShapeDetectionService>();
}
@@ -33,21 +24,17 @@ void ShapeDetectionService::OnStart() {
ref_factory_.reset(new service_manager::ServiceContextRefFactory(
base::Bind(&service_manager::ServiceContext::RequestQuit,
base::Unretained(context()))));
+ registry_.AddInterface(base::Bind(&BarcodeDetectionImpl::Create));
+ registry_.AddInterface(base::Bind(&FaceDetectionProviderImpl::Create));
+ registry_.AddInterface(base::Bind(&TextDetectionImpl::Create));
}
-bool ShapeDetectionService::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(&BarcodeDetectionImpl::Create));
- registry->AddInterface(base::Bind(&FaceDetectionProviderImpl::Create));
- registry->AddInterface(base::Bind(&TextDetectionImpl::Create));
- return true;
+void ShapeDetectionService::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));
}
} // namespace shape_detection
« no previous file with comments | « services/shape_detection/shape_detection_service.h ('k') | services/tracing/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698