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

Side by Side Diff: services/service_manager/service_manager.h

Issue 2572803002: [ServiceManager] Eliminate parent-child relationship between services (Closed)
Patch Set: More general fix for ConnectTest shutdown deadlock 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
« no previous file with comments | « no previous file | services/service_manager/service_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SERVICE_MANAGER_H_ 5 #ifndef SERVICES_SERVICE_MANAGER_SERVICE_MANAGER_H_
6 #define SERVICES_SERVICE_MANAGER_SERVICE_MANAGER_H_ 6 #define SERVICES_SERVICE_MANAGER_SERVICE_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 void OnGotResolvedName(std::unique_ptr<ConnectParams> params, 155 void OnGotResolvedName(std::unique_ptr<ConnectParams> params,
156 mojom::ServicePtr service, 156 mojom::ServicePtr service,
157 bool has_source_instance, 157 bool has_source_instance,
158 base::WeakPtr<Instance> source_instance, 158 base::WeakPtr<Instance> source_instance,
159 mojom::ResolveResultPtr result); 159 mojom::ResolveResultPtr result);
160 160
161 base::WeakPtr<ServiceManager> GetWeakPtr(); 161 base::WeakPtr<ServiceManager> GetWeakPtr();
162 162
163 std::unique_ptr<ServiceOverrides> service_overrides_; 163 std::unique_ptr<ServiceOverrides> service_overrides_;
164 164
165 // Ownership of all root Instances. Non-root Instances are owned by their 165 // Ownership of all Instances.
166 // parent Instance.
167 using InstanceMap = std::map<Instance*, std::unique_ptr<Instance>>; 166 using InstanceMap = std::map<Instance*, std::unique_ptr<Instance>>;
168 InstanceMap root_instances_; 167 InstanceMap instances_;
169 168
170 // Maps service identities to reachable instances. Note that the Instance* 169 // Maps service identities to reachable instances. Note that the Instance*
171 // values here are NOT owned by this map. 170 // values here are NOT owned by this map.
172 std::map<Identity, Instance*> identity_to_instance_; 171 std::map<Identity, Instance*> identity_to_instance_;
173 172
174 // Always points to the ServiceManager's own Instance. Note that this 173 // Always points to the ServiceManager's own Instance. Note that this
175 // Instance still has an entry in |root_instances_|. 174 // Instance still has an entry in |instances_|.
176 Instance* service_manager_instance_; 175 Instance* service_manager_instance_;
177 176
178 // Tracks the names of instances that are allowed to field connection requests 177 // Tracks the names of instances that are allowed to field connection requests
179 // from all users. 178 // from all users.
180 std::set<std::string> singletons_; 179 std::set<std::string> singletons_;
181 180
182 std::map<Identity, mojom::ServiceFactoryPtr> service_factories_; 181 std::map<Identity, mojom::ServiceFactoryPtr> service_factories_;
183 std::map<Identity, mojom::ResolverPtr> identity_to_resolver_; 182 std::map<Identity, mojom::ResolverPtr> identity_to_resolver_;
184 mojo::InterfacePtrSet<mojom::ServiceManagerListener> listeners_; 183 mojo::InterfacePtrSet<mojom::ServiceManagerListener> listeners_;
185 base::Callback<void(const Identity&)> instance_quit_callback_; 184 base::Callback<void(const Identity&)> instance_quit_callback_;
186 std::unique_ptr<NativeRunnerFactory> native_runner_factory_; 185 std::unique_ptr<NativeRunnerFactory> native_runner_factory_;
187 std::unique_ptr<ServiceContext> service_context_; 186 std::unique_ptr<ServiceContext> service_context_;
188 base::WeakPtrFactory<ServiceManager> weak_ptr_factory_; 187 base::WeakPtrFactory<ServiceManager> weak_ptr_factory_;
189 188
190 DISALLOW_COPY_AND_ASSIGN(ServiceManager); 189 DISALLOW_COPY_AND_ASSIGN(ServiceManager);
191 }; 190 };
192 191
193 mojom::Connector::ConnectCallback EmptyConnectCallback(); 192 mojom::Connector::ConnectCallback EmptyConnectCallback();
194 193
195 } // namespace service_manager 194 } // namespace service_manager
196 195
197 #endif // SERVICES_SERVICE_MANAGER_SERVICE_MANAGER_H_ 196 #endif // SERVICES_SERVICE_MANAGER_SERVICE_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | services/service_manager/service_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698