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

Unified Diff: ipc/ipc_channel_mojo.cc

Issue 2137353002: Adds associated interface support to IPC::Channel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@channel-bindings-1
Patch Set: rebase Created 4 years, 5 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: ipc/ipc_channel_mojo.cc
diff --git a/ipc/ipc_channel_mojo.cc b/ipc/ipc_channel_mojo.cc
index 22efa3a335f6a9594eda2dccad69497dc8579b80..b7f7a4f35dbc13b2e7d3a5abbd8c5a66a0edccab 100644
--- a/ipc/ipc_channel_mojo.cc
+++ b/ipc/ipc_channel_mojo.cc
@@ -294,6 +294,25 @@ void ChannelMojo::Close() {
reader.reset();
}
+mojo::AssociatedGroup* ChannelMojo::GetAssociatedGroup() {
+ DCHECK(bootstrap_);
+ return bootstrap_->GetAssociatedGroup();
+}
+
+void ChannelMojo::AddGenericAssociatedInterface(
+ const std::string& name,
+ const GenericAssociatedInterfaceFactory& factory) {
+ auto result = associated_interfaces_.insert({ name, factory });
+ DCHECK(result.second);
+}
+
+void ChannelMojo::GetGenericRemoteAssociatedInterface(
+ const std::string& name,
+ mojo::ScopedInterfaceEndpointHandle handle) {
+ DCHECK(message_reader_);
+ message_reader_->GetRemoteInterface(name, std::move(handle));
+}
+
// MojoBootstrap::Delegate implementation
void ChannelMojo::OnPipesAvailable(
mojom::ChannelAssociatedPtrInfo send_channel,
@@ -307,6 +326,14 @@ void ChannelMojo::OnBootstrapError() {
listener_->OnChannelError();
}
+void ChannelMojo::OnAssociatedInterfaceRequest(
+ const std::string& name,
+ mojo::ScopedInterfaceEndpointHandle handle) {
+ auto iter = associated_interfaces_.find(name);
+ if (iter != associated_interfaces_.end())
+ iter->second.Run(std::move(handle));
+}
+
void ChannelMojo::InitMessageReader(mojom::ChannelAssociatedPtrInfo sender,
mojom::ChannelAssociatedRequest receiver,
base::ProcessId peer_pid) {

Powered by Google App Engine
This is Rietveld 408576698