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

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

Issue 2566663003: Fix UAF on singleton service instances (Closed)
Patch Set: 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // bounded by that of |instance|. The connection will be cancelled dropped if 112 // bounded by that of |instance|. The connection will be cancelled dropped if
113 // |instance| is destroyed. 113 // |instance| is destroyed.
114 void Connect(std::unique_ptr<ConnectParams> params, 114 void Connect(std::unique_ptr<ConnectParams> params,
115 mojom::ServicePtr service, 115 mojom::ServicePtr service,
116 base::WeakPtr<Instance> source_instance); 116 base::WeakPtr<Instance> source_instance);
117 117
118 // Returns a running instance matching |identity|. This might be an instance 118 // Returns a running instance matching |identity|. This might be an instance
119 // running as a different user if one is available that services all users. 119 // running as a different user if one is available that services all users.
120 Instance* GetExistingInstance(const Identity& identity) const; 120 Instance* GetExistingInstance(const Identity& identity) const;
121 121
122 // Erases any identities mapping to |instance|. Following this call it is
123 // impossible for any call to GetExistingInstance() to return |instance|.
124 void EraseInstanceIdentity(Instance* instance);
125
122 void NotifyServiceStarted(const Identity& identity, base::ProcessId pid); 126 void NotifyServiceStarted(const Identity& identity, base::ProcessId pid);
123 void NotifyServiceFailedToStart(const Identity& identity); 127 void NotifyServiceFailedToStart(const Identity& identity);
124 128
125 // Attempt to complete the connection requested by |params| by connecting to 129 // Attempt to complete the connection requested by |params| by connecting to
126 // an existing instance. If there is an existing instance, |params| is taken, 130 // an existing instance. If there is an existing instance, |params| is taken,
127 // and this function returns true. 131 // and this function returns true.
128 bool ConnectToExistingInstance(std::unique_ptr<ConnectParams>* params); 132 bool ConnectToExistingInstance(std::unique_ptr<ConnectParams>* params);
129 133
130 Instance* CreateInstance(const Identity& source, 134 Instance* CreateInstance(const Identity& source,
131 const Identity& target, 135 const Identity& target,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 base::WeakPtrFactory<ServiceManager> weak_ptr_factory_; 188 base::WeakPtrFactory<ServiceManager> weak_ptr_factory_;
185 189
186 DISALLOW_COPY_AND_ASSIGN(ServiceManager); 190 DISALLOW_COPY_AND_ASSIGN(ServiceManager);
187 }; 191 };
188 192
189 mojom::Connector::ConnectCallback EmptyConnectCallback(); 193 mojom::Connector::ConnectCallback EmptyConnectCallback();
190 194
191 } // namespace service_manager 195 } // namespace service_manager
192 196
193 #endif // SERVICES_SERVICE_MANAGER_SERVICE_MANAGER_H_ 197 #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