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

Side by Side Diff: services/service_manager/public/cpp/service.h

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 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 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_H_ 5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_H_
6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_H_ 6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_H_
7 7
8 #include "base/macros.h"
9
8 namespace service_manager { 10 namespace service_manager {
9 11
10 class InterfaceRegistry; 12 class InterfaceRegistry;
11 class ServiceContext; 13 class ServiceContext;
12 struct ServiceInfo; 14 struct ServiceInfo;
13 15
14 // The primary contract between a Service and the Service Manager, receiving 16 // The primary contract between a Service and the Service Manager, receiving
15 // lifecycle notifications and connection requests. 17 // lifecycle notifications and connection requests.
16 class Service { 18 class Service {
17 public: 19 public:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 ServiceContext* context() const; 60 ServiceContext* context() const;
59 61
60 private: 62 private:
61 friend class ForwardingService; 63 friend class ForwardingService;
62 friend class ServiceContext; 64 friend class ServiceContext;
63 65
64 // NOTE: This is guaranteed to be called before OnStart(). 66 // NOTE: This is guaranteed to be called before OnStart().
65 void set_context(ServiceContext* context) { service_context_ = context; } 67 void set_context(ServiceContext* context) { service_context_ = context; }
66 68
67 ServiceContext* service_context_ = nullptr; 69 ServiceContext* service_context_ = nullptr;
70
71 DISALLOW_COPY_AND_ASSIGN(Service);
68 }; 72 };
69 73
70 // TODO(rockot): Remove this. It's here to satisfy a few remaining use cases 74 // TODO(rockot): Remove this. It's here to satisfy a few remaining use cases
71 // where a Service impl is owned by something other than its ServiceContext. 75 // where a Service impl is owned by something other than its ServiceContext.
72 class ForwardingService : public Service { 76 class ForwardingService : public Service {
73 public: 77 public:
74 // |target| must outlive this object. 78 // |target| must outlive this object.
75 explicit ForwardingService(Service* target); 79 explicit ForwardingService(Service* target);
76 ~ForwardingService() override; 80 ~ForwardingService() override;
77 81
78 private:
79 // Service: 82 // Service:
80 void OnStart() override; 83 void OnStart() override;
81 bool OnConnect(const ServiceInfo& remote_info, 84 bool OnConnect(const ServiceInfo& remote_info,
82 InterfaceRegistry* registry) override; 85 InterfaceRegistry* registry) override;
83 bool OnStop() override; 86 bool OnStop() override;
84 87
88 private:
85 Service* const target_ = nullptr; 89 Service* const target_ = nullptr;
90
91 DISALLOW_COPY_AND_ASSIGN(ForwardingService);
86 }; 92 };
87 93
88 } // namespace service_manager 94 } // namespace service_manager
89 95
90 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_H_ 96 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_H_
OLDNEW
« no previous file with comments | « services/service_manager/public/cpp/lib/service_runner.cc ('k') | services/service_manager/public/cpp/service.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698