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

Unified Diff: services/service_manager/public/cpp/lib/service_context.cc

Issue 2480603004: Service Manager: Implement graceful service termination (Closed)
Patch Set: Created 4 years, 1 month 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
Index: services/service_manager/public/cpp/lib/service_context.cc
diff --git a/services/service_manager/public/cpp/lib/service_context.cc b/services/service_manager/public/cpp/lib/service_context.cc
index 95db8eb535d1b09654ce2cd4481c49d667459312..d95d60629ee2e696867663b376e565222be35edf 100644
--- a/services/service_manager/public/cpp/lib/service_context.cc
+++ b/services/service_manager/public/cpp/lib/service_context.cc
@@ -51,7 +51,8 @@ void ServiceContext::SetConnectionLostClosure(const base::Closure& closure) {
}
void ServiceContext::RequestQuit() {
- // TODO(rockot): Implement this.
+ DCHECK(service_control_.is_bound());
+ service_control_->RequestQuit();
}
void ServiceContext::DisconnectFromServiceManager() {
@@ -78,13 +79,15 @@ void ServiceContext::DestroyService() {
void ServiceContext::OnStart(const ServiceInfo& info,
const OnStartCallback& callback) {
local_info_ = info;
- callback.Run(std::move(pending_connector_request_));
+ callback.Run(std::move(pending_connector_request_),
+ mojo::GetProxy(&service_control_, binding_.associated_group()));
service_->OnStart(this);
}
void ServiceContext::OnConnect(
const ServiceInfo& source_info,
- mojom::InterfaceProviderRequest interfaces) {
+ mojom::InterfaceProviderRequest interfaces,
+ const OnConnectCallback& callback) {
InterfaceProviderSpec source_spec, target_spec;
GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec,
local_info_.interface_provider_specs, &target_spec);
@@ -95,6 +98,9 @@ void ServiceContext::OnConnect(
registry->Bind(std::move(interfaces), local_info_.identity, target_spec,
source_info.identity, source_spec);
+ // Acknowledge the request regardless of whether it's accepted.
+ callback.Run();
+
if (!service_->OnConnect(source_info, registry.get()))
return;

Powered by Google App Engine
This is Rietveld 408576698