Index: services/shell/public/cpp/lib/interface_registry.cc |
diff --git a/services/shell/public/cpp/lib/interface_registry.cc b/services/shell/public/cpp/lib/interface_registry.cc |
index a4657b24e8304fc825e1892fffb2367a7e224ec8..03e135dece389b3ac5c151e274c0ce54d142f66f 100644 |
--- a/services/shell/public/cpp/lib/interface_registry.cc |
+++ b/services/shell/public/cpp/lib/interface_registry.cc |
@@ -9,7 +9,7 @@ |
namespace shell { |
InterfaceRegistry::InterfaceRegistry(Connection* connection) |
- : binding_(this), connection_(connection) {} |
+ : binding_(this), connection_(connection), weak_factory_(this) {} |
InterfaceRegistry::~InterfaceRegistry() {} |
void InterfaceRegistry::Bind( |
@@ -18,6 +18,20 @@ void InterfaceRegistry::Bind( |
binding_.Bind(std::move(local_interfaces_request)); |
} |
+base::WeakPtr<InterfaceRegistry> InterfaceRegistry::GetWeakPtr() { |
+ return weak_factory_.GetWeakPtr(); |
+} |
+ |
+bool InterfaceRegistry::AddInterface( |
+ const std::string& name, |
+ const base::Callback<void(mojo::ScopedMessagePipeHandle)>& callback, |
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { |
+ return SetInterfaceBinderForName( |
+ base::WrapUnique( |
+ new internal::GenericCallbackBinder(callback, task_runner)), |
+ name); |
+} |
+ |
void InterfaceRegistry::RemoveInterface(const std::string& name) { |
auto it = name_to_binder_.find(name); |
if (it != name_to_binder_.end()) |