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

Unified Diff: services/shell/public/cpp/lib/interface_registry.cc

Issue 2075003002: Separate Remote InterfaceProvider again, and add a new client lib type for it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 months 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/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 d248dae83f0ae217543426c81f0352f694e97ffe..a4657b24e8304fc825e1892fffb2367a7e224ec8 100644
--- a/services/shell/public/cpp/lib/interface_registry.cc
+++ b/services/shell/public/cpp/lib/interface_registry.cc
@@ -9,33 +9,19 @@
namespace shell {
InterfaceRegistry::InterfaceRegistry(Connection* connection)
- : InterfaceRegistry(nullptr, nullptr, connection) {}
-
-InterfaceRegistry::InterfaceRegistry(
- mojom::InterfaceProviderPtr remote_interfaces,
- mojom::InterfaceProviderRequest local_interfaces_request,
- Connection* connection)
- : binding_(this),
- connection_(connection),
- remote_interfaces_(std::move(remote_interfaces)) {
- if (!local_interfaces_request.is_pending())
- local_interfaces_request = GetProxy(&client_handle_);
- binding_.Bind(std::move(local_interfaces_request));
-}
-
+ : binding_(this), connection_(connection) {}
InterfaceRegistry::~InterfaceRegistry() {}
-mojom::InterfaceProviderPtr InterfaceRegistry::TakeClientHandle() {
- return std::move(client_handle_);
-}
-
-mojom::InterfaceProvider* InterfaceRegistry::GetRemoteInterfaces() {
- return remote_interfaces_.get();
+void InterfaceRegistry::Bind(
+ mojom::InterfaceProviderRequest local_interfaces_request) {
+ DCHECK(!binding_.is_bound());
+ binding_.Bind(std::move(local_interfaces_request));
}
-void InterfaceRegistry::SetRemoteInterfacesConnectionLostClosure(
- const base::Closure& connection_lost_closure) {
- remote_interfaces_.set_connection_error_handler(connection_lost_closure);
+void InterfaceRegistry::RemoveInterface(const std::string& name) {
+ auto it = name_to_binder_.find(name);
+ if (it != name_to_binder_.end())
+ name_to_binder_.erase(it);
}
// mojom::InterfaceProvider:
@@ -57,19 +43,11 @@ bool InterfaceRegistry::SetInterfaceBinderForName(
const std::string& interface_name) {
if (!connection_ ||
(connection_ && connection_->AllowsInterface(interface_name))) {
- RemoveInterfaceBinderForName(interface_name);
+ RemoveInterface(interface_name);
name_to_binder_[interface_name] = std::move(binder);
return true;
}
return false;
}
-void InterfaceRegistry::RemoveInterfaceBinderForName(
- const std::string& interface_name) {
- NameToInterfaceBinderMap::iterator it = name_to_binder_.find(interface_name);
- if (it == name_to_binder_.end())
- return;
- name_to_binder_.erase(it);
-}
-
} // namespace shell
« no previous file with comments | « services/shell/public/cpp/lib/connection_impl.cc ('k') | services/shell/public/cpp/lib/remote_interface_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698