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

Unified Diff: services/service_manager/service_manager.cc

Issue 2557213002: Build services as standalone executables (Closed)
Patch Set: remove DCHECKs with side effects -_- Created 4 years 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/service_manager.cc
diff --git a/services/service_manager/service_manager.cc b/services/service_manager/service_manager.cc
index fc5160942ce53c85abd26f3a96a7a712929c33ff..5f815c350fcf430436026deaf1e26365af529826 100644
--- a/services/service_manager/service_manager.cc
+++ b/services/service_manager/service_manager.cc
@@ -190,15 +190,19 @@ class ServiceManager::Instance
StartWithService(std::move(service));
}
- void StartWithFilePath(const base::FilePath& path) {
- CHECK(!service_);
+ bool StartWithFilePath(const base::FilePath& path) {
+ DCHECK(!service_);
+ DCHECK(!path.empty());
runner_ = service_manager_->native_runner_factory_->Create(path);
+ if (!runner_)
+ return false;
bool start_sandboxed = false;
mojom::ServicePtr service = runner_->Start(
- path, identity_, start_sandboxed,
+ identity_, start_sandboxed,
base::Bind(&Instance::PIDAvailable, weak_factory_.GetWeakPtr()),
base::Bind(&Instance::OnRunnerCompleted, weak_factory_.GetWeakPtr()));
StartWithService(std::move(service));
+ return true;
}
mojom::RunningServiceInfoPtr CreateRunningServiceInfo() const {
@@ -947,9 +951,10 @@ void ServiceManager::OnGotResolvedName(std::unique_ptr<ConnectParams> params,
package_path = result->package_path;
}
- // TODO(rockot): Find a way to block this code path for content but allow
- // it for chrome_mash.
- instance->StartWithFilePath(package_path);
+ if (!instance->StartWithFilePath(package_path)) {
+ OnInstanceError(instance);
+ return;
+ }
}
}
« no previous file with comments | « services/service_manager/runner/host/out_of_process_native_runner.cc ('k') | services/service_manager/standalone/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698