Index: services/service_manager/public/cpp/service_context.h |
diff --git a/services/service_manager/public/cpp/service_context.h b/services/service_manager/public/cpp/service_context.h |
index 597aa05d1efad708d9f83de360e865d9e8845e2c..38b08399d9c02b38f1f9e1592f5d0b312014dfc9 100644 |
--- a/services/service_manager/public/cpp/service_context.h |
+++ b/services/service_manager/public/cpp/service_context.h |
@@ -5,12 +5,12 @@ |
#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ |
#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ |
+#include <map> |
#include <memory> |
-#include <utility> |
-#include <vector> |
#include "base/callback.h" |
#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
#include "mojo/public/cpp/bindings/binding.h" |
#include "mojo/public/cpp/system/core.h" |
#include "services/service_manager/public/cpp/connector.h" |
@@ -65,6 +65,9 @@ class ServiceContext : public mojom::Service { |
void SetConnectionLostClosure(const base::Closure& closure); |
private: |
+ using InterfaceRegistryMap = |
+ std::map<InterfaceRegistry*, std::unique_ptr<InterfaceRegistry>>; |
+ |
// mojom::Service: |
void OnStart(const ServiceInfo& info, |
const OnStartCallback& callback) override; |
@@ -72,13 +75,15 @@ class ServiceContext : public mojom::Service { |
mojom::InterfaceProviderRequest interfaces) override; |
void OnConnectionError(); |
+ void OnRegistryConnectionError(InterfaceRegistry* registry); |
+ void DestroyConnectionInterfaceRegistry(InterfaceRegistry* registry); |
// A callback called when OnStart() is run. |
base::Closure initialize_handler_; |
- // We track the lifetime of incoming connection registries as it more |
- // convenient for the client. |
- std::vector<std::unique_ptr<InterfaceRegistry>> incoming_connections_; |
+ // We track the lifetime of incoming connection registries as a convenience |
+ // for the client. |
+ InterfaceRegistryMap connection_interface_registries_; |
// A pending Connector request which will eventually be passed to the Service |
// Manager. |
@@ -92,6 +97,8 @@ class ServiceContext : public mojom::Service { |
base::Closure connection_lost_closure_; |
+ base::WeakPtrFactory<ServiceContext> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ServiceContext); |
}; |