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

Unified Diff: services/service_manager/service_manager.cc

Issue 2576233002: Consolidating the mojo NativeRunner functionality. (Closed)
Patch Set: Clean-up. 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 5f815c350fcf430436026deaf1e26365af529826..7f5788ba76b4c0812254da741bc4344ed1c9f285 100644
--- a/services/service_manager/service_manager.cc
+++ b/services/service_manager/service_manager.cc
@@ -118,11 +118,6 @@ class ServiceManager::Instance
// Notify the ServiceManager that this Instance is really going away.
service_manager_->OnInstanceStopped(identity_);
}
-
- // Release |runner_| so that if we are called back to OnRunnerCompleted()
- // we know we're in the destructor.
- std::unique_ptr<NativeRunner> runner = std::move(runner_);
- runner.reset();
}
Instance* parent() const { return parent_; }
@@ -193,14 +188,13 @@ class ServiceManager::Instance
bool StartWithFilePath(const base::FilePath& path) {
DCHECK(!service_);
DCHECK(!path.empty());
- runner_ = service_manager_->native_runner_factory_->Create(path);
+ runner_ = service_manager_->service_process_launcher_factory_->Create(path);
if (!runner_)
return false;
bool start_sandboxed = false;
mojom::ServicePtr service = runner_->Start(
identity_, start_sandboxed,
- base::Bind(&Instance::PIDAvailable, weak_factory_.GetWeakPtr()),
- base::Bind(&Instance::OnRunnerCompleted, weak_factory_.GetWeakPtr()));
+ base::Bind(&Instance::PIDAvailable, weak_factory_.GetWeakPtr()));
StartWithService(std::move(service));
return true;
}
@@ -441,14 +435,6 @@ class ServiceManager::Instance
service_manager_->NotifyServiceStarted(identity_, pid_);
}
- // Callback when NativeRunner completes.
- void OnRunnerCompleted() {
- if (!runner_.get())
- return; // We're in the destructor.
-
- service_manager_->OnInstanceError(this);
- }
-
// mojom::ServiceControl:
void RequestQuit() override {
// If quit is requested, oblige when there are no pending OnConnects.
@@ -466,7 +452,7 @@ class ServiceManager::Instance
const InterfaceProviderSpecMap interface_provider_specs_;
const InterfaceProviderSpec empty_spec_;
const bool allow_any_application_;
- std::unique_ptr<NativeRunner> runner_;
+ std::unique_ptr<ServiceProcessLauncher> runner_;
mojom::ServicePtr service_;
mojo::Binding<mojom::PIDReceiver> pid_receiver_binding_;
mojo::BindingSet<mojom::Connector> connectors_;
@@ -534,9 +520,11 @@ bool ServiceManager::TestAPI::HasRunningInstanceForName(
// ServiceManager, public:
ServiceManager::ServiceManager(
- std::unique_ptr<NativeRunnerFactory> native_runner_factory,
+ std::unique_ptr<ServiceProcessLauncherFactory>
+ service_process_launcher_factory,
mojom::ServicePtr catalog)
- : native_runner_factory_(std::move(native_runner_factory)),
+ : service_process_launcher_factory_(
+ std::move(service_process_launcher_factory)),
weak_ptr_factory_(this) {
mojom::ServicePtr service;
mojom::ServiceRequest request = mojo::GetProxy(&service);

Powered by Google App Engine
This is Rietveld 408576698