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

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

Issue 2487573002: Service Manager: Remove ServiceContext* arg from Service::OnStart() (Closed)
Patch Set: rebase 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 | « services/navigation/navigation.cc ('k') | 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 7d0d72a269cc14988e116a0c9601a763c6c3cfd1..c9d85ce73032fdf2fa74697da520bedf4e76cded 100644
--- a/services/service_manager/public/cpp/lib/service.cc
+++ b/services/service_manager/public/cpp/lib/service.cc
@@ -4,12 +4,43 @@
#include "services/service_manager/public/cpp/service.h"
+#include "base/logging.h"
+
namespace service_manager {
-Service::~Service() {}
+Service::Service() = default;
+
+Service::~Service() = default;
+
+void Service::OnStart() {}
-void Service::OnStart(ServiceContext* context) {}
+bool Service::OnConnect(const ServiceInfo& remote_info,
+ InterfaceRegistry* registry) {
+ return false;
+}
bool Service::OnStop() { return true; }
+ServiceContext* Service::context() const {
+ DCHECK(service_context_)
+ << "Service::context() may only be called during or after OnStart().";
+ return service_context_;
+}
+
+ForwardingService::ForwardingService(Service* target) : target_(target) {}
+
+ForwardingService::~ForwardingService() {}
+
+void ForwardingService::OnStart() {
+ target_->set_context(context());
+ target_->OnStart();
+}
+
+bool ForwardingService::OnConnect(const ServiceInfo& remote_info,
+ InterfaceRegistry* registry) {
+ return target_->OnConnect(remote_info, registry);
+}
+
+bool ForwardingService::OnStop() { return target_->OnStop(); }
+
} // namespace service_manager
« no previous file with comments | « services/navigation/navigation.cc ('k') | services/service_manager/public/cpp/lib/service_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698