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

Unified Diff: mash/init/init.cc

Issue 2476063002: Service Manager: Rework Service and ServiceContext lifetime (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
« no previous file with comments | « mash/init/init.h ('k') | mash/login/login.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/init/init.cc
diff --git a/mash/init/init.cc b/mash/init/init.cc
index 496cc1a839096f8e8f73597f6176f1fe17e5729a..72c004bb850e18d32b6f55b0f535e5cccdff5eeb 100644
--- a/mash/init/init.cc
+++ b/mash/init/init.cc
@@ -10,6 +10,8 @@
#include "mash/login/public/interfaces/login.mojom.h"
#include "services/service_manager/public/cpp/connection.h"
#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/service_context.h"
namespace mash {
namespace init {
@@ -17,8 +19,9 @@ namespace init {
Init::Init() {}
Init::~Init() {}
-void Init::OnStart(const service_manager::ServiceInfo& info) {
- connector()->Connect("service:ui");
+void Init::OnStart(service_manager::ServiceContext* context) {
+ context_ = context;
+ context->connector()->Connect("service:ui");
StartTracing();
StartLogin();
}
@@ -35,7 +38,7 @@ void Init::StartService(const mojo::String& name,
service_manager::Connector::ConnectParams params(
service_manager::Identity(name, user_id));
std::unique_ptr<service_manager::Connection> connection =
- connector()->Connect(&params);
+ context_->connector()->Connect(&params);
connection->SetConnectionLostClosure(
base::Bind(&Init::UserServiceQuit, base::Unretained(this), user_id));
user_services_[user_id] = std::move(connection);
@@ -60,11 +63,11 @@ void Init::UserServiceQuit(const std::string& user_id) {
}
void Init::StartTracing() {
- connector()->Connect("service:tracing");
+ context_->connector()->Connect("service:tracing");
}
void Init::StartLogin() {
- login_connection_ = connector()->Connect("service:login");
+ login_connection_ = context_->connector()->Connect("service:login");
mash::login::mojom::LoginPtr login;
login_connection_->GetInterface(&login);
login->ShowLoginUI();
« no previous file with comments | « mash/init/init.h ('k') | mash/login/login.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698