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

Unified Diff: services/service_manager/public/cpp/interface_registry.h

Issue 2478653003: Clean up dead InterfaceRegistry instances in ServiceContext (Closed)
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
Index: services/service_manager/public/cpp/interface_registry.h
diff --git a/services/service_manager/public/cpp/interface_registry.h b/services/service_manager/public/cpp/interface_registry.h
index e1813ead8cd09e6a43f06cfa85e4310d38f3ea95..fa7b898226a528c2445a6706bd2088c7d4cc0199 100644
--- a/services/service_manager/public/cpp/interface_registry.h
+++ b/services/service_manager/public/cpp/interface_registry.h
@@ -5,6 +5,7 @@
#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_REGISTRY_H_
#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_REGISTRY_H_
+#include <list>
#include <memory>
#include <queue>
#include <set>
@@ -150,7 +151,7 @@ class InterfaceRegistry : public mojom::InterfaceProvider {
void GetInterfaceNames(std::set<std::string>* interface_names);
// Sets a closure to be run when the InterfaceProvider pipe is closed.
- void SetConnectionLostClosure(const base::Closure& connection_lost_closure);
+ void AddConnectionLostClosure(const base::Closure& connection_lost_closure);
private:
using InterfaceNameToBinderMap =
@@ -173,6 +174,8 @@ class InterfaceRegistry : public mojom::InterfaceProvider {
// contents of |exposed_interfaces_| and |expose_all_interfaces_|.
void RebuildExposedInterfaces();
+ void OnConnectionError();
+
mojom::InterfaceProviderRequest pending_request_;
mojo::Binding<mojom::InterfaceProvider> binding_;
@@ -209,6 +212,8 @@ class InterfaceRegistry : public mojom::InterfaceProvider {
std::queue<std::pair<std::string, mojo::ScopedMessagePipeHandle>>
pending_interface_requests_;
+ std::list<base::Closure> connection_lost_closures_;
+
base::WeakPtrFactory<InterfaceRegistry> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(InterfaceRegistry);

Powered by Google App Engine
This is Rietveld 408576698