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

Unified Diff: services/service_manager/public/cpp/lib/service_context.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 | « services/service_manager/public/cpp/lib/service.cc ('k') | services/service_manager/public/cpp/service.h » ('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_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 f45202e56b2324dd81f75d51d817a88c810a7fff..2158befed4e8a312149d7be76b046f7a6b51e03e 100644
--- a/services/service_manager/public/cpp/lib/service_context.cc
+++ b/services/service_manager/public/cpp/lib/service_context.cc
@@ -80,6 +80,7 @@ void ServiceContext::DestroyService() {
void ServiceContext::OnStart(const ServiceInfo& info,
const OnStartCallback& callback) {
+ service_started_ = true;
local_info_ = info;
callback.Run(std::move(pending_connector_request_),
mojo::MakeRequest(&service_control_));
@@ -140,6 +141,13 @@ void ServiceContext::CallOnConnect(const ServiceInfo& source_info,
}
void ServiceContext::OnConnectionError() {
+ if (!service_started_) {
+ // The pipe was broken before we even received OnStart().
+ service_->set_context(this);
+ service_->OnStartFailed();
+ return;
+ }
+
// Note that the Service doesn't technically have to quit now, it may live
// on to service existing connections. All existing Connectors however are
// invalid.
« no previous file with comments | « services/service_manager/public/cpp/lib/service.cc ('k') | services/service_manager/public/cpp/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698