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

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

Issue 2700693004: service_manager: More consistent Service lifecycle API (Closed)
Patch Set: . Created 3 years, 10 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 | « no previous file | services/service_manager/public/cpp/lib/service_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/service_manager/public/cpp/lib/service.cc
diff --git a/services/service_manager/public/cpp/lib/service.cc b/services/service_manager/public/cpp/lib/service.cc
index 72222efac5352fd48fb510ba9ee9a67fd2418cfe..1044226e65607b4d089fdcaf0451e6d5c8343e15 100644
--- a/services/service_manager/public/cpp/lib/service.cc
+++ b/services/service_manager/public/cpp/lib/service.cc
@@ -44,6 +44,10 @@ void Service::OnBindInterface(const ServiceInfo& source_info,
bool Service::OnStop() { return true; }
+void Service::OnStartFailed() {
+ context()->QuitNow();
+}
+
ServiceContext* Service::context() const {
DCHECK(service_context_)
<< "Service::context() may only be called during or after OnStart().";
@@ -64,6 +68,19 @@ bool ForwardingService::OnConnect(const ServiceInfo& remote_info,
return target_->OnConnect(remote_info, registry);
}
+void ForwardingService::OnBindInterface(
+ const ServiceInfo& remote_info,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle interface_pipe) {
+ target_->OnBindInterface(remote_info, interface_name,
+ std::move(interface_pipe));
+}
+
bool ForwardingService::OnStop() { return target_->OnStop(); }
+void ForwardingService::OnStartFailed() {
+ target_->set_context(context());
+ return target_->OnStartFailed();
+}
+
} // namespace service_manager
« no previous file with comments | « no previous file | services/service_manager/public/cpp/lib/service_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698