Index: services/service_manager/public/cpp/lib/interface_registry.cc |
diff --git a/services/service_manager/public/cpp/lib/interface_registry.cc b/services/service_manager/public/cpp/lib/interface_registry.cc |
index 0e1059e25ccb50c7be2476418e7a7071f5e8df1a..0eff1e9545fba79dd65e2dfcae2dde2e7a2154a4 100644 |
--- a/services/service_manager/public/cpp/lib/interface_registry.cc |
+++ b/services/service_manager/public/cpp/lib/interface_registry.cc |
@@ -99,6 +99,8 @@ void InterfaceRegistry::Bind( |
remote_interface_provider_spec_ = remote_interface_provider_spec; |
RebuildExposedInterfaces(); |
binding_.Bind(std::move(local_interfaces_request)); |
+ binding_.set_connection_error_handler(base::Bind( |
+ &InterfaceRegistry::OnConnectionError, base::Unretained(this))); |
} |
void InterfaceRegistry::Serialize(std::stringstream* stream) { |
@@ -177,9 +179,9 @@ void InterfaceRegistry::GetInterfaceNames( |
interface_names->insert(entry.first); |
} |
-void InterfaceRegistry::SetConnectionLostClosure( |
+void InterfaceRegistry::AddConnectionLostClosure( |
const base::Closure& connection_lost_closure) { |
- binding_.set_connection_error_handler(connection_lost_closure); |
+ connection_lost_closures_.push_back(connection_lost_closure); |
} |
// mojom::InterfaceProvider: |
@@ -247,4 +249,9 @@ void InterfaceRegistry::RebuildExposedInterfaces() { |
exposed_interfaces_.size() == 1 && exposed_interfaces_.count("*") == 1; |
} |
+void InterfaceRegistry::OnConnectionError() { |
+ for (const auto& closure : connection_lost_closures_) |
+ closure.Run(); |
+} |
+ |
} // namespace service_manager |