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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/service_manager/public/cpp/service.h" 5 #include "services/service_manager/public/cpp/service.h"
6 6
7 #include "base/logging.h"
8
7 namespace service_manager { 9 namespace service_manager {
8 10
9 Service::~Service() {} 11 Service::Service() = default;
10 12
11 void Service::OnStart(ServiceContext* context) {} 13 Service::~Service() = default;
14
15 void Service::OnStart() {}
16
17 bool Service::OnConnect(const ServiceInfo& remote_info,
18 InterfaceRegistry* registry) {
19 return false;
20 }
12 21
13 bool Service::OnStop() { return true; } 22 bool Service::OnStop() { return true; }
14 23
24 ServiceContext* Service::context() const {
25 DCHECK(service_context_)
26 << "Service::context() may only be called during or after OnStart().";
27 return service_context_;
28 }
29
30 ForwardingService::ForwardingService(Service* target) : target_(target) {}
31
32 ForwardingService::~ForwardingService() {}
33
34 void ForwardingService::OnStart() {
35 target_->set_context(context());
36 target_->OnStart();
37 }
38
39 bool ForwardingService::OnConnect(const ServiceInfo& remote_info,
40 InterfaceRegistry* registry) {
41 return target_->OnConnect(remote_info, registry);
42 }
43
44 bool ForwardingService::OnStop() { return target_->OnStop(); }
45
15 } // namespace service_manager 46 } // namespace service_manager
OLDNEW
« 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