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

Unified Diff: ipc/ipc_channel_mojo.cc

Issue 2772983002: Make sure channel-associated interface pointers are always safe to call. (Closed)
Patch Set: . Created 3 years, 9 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
« no previous file with comments | « no previous file | ipc/ipc_sync_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel_mojo.cc
diff --git a/ipc/ipc_channel_mojo.cc b/ipc/ipc_channel_mojo.cc
index d0129e3fe0833596ac3b576886f6d3e4ca54fd8f..ab376f4bdc46a697d939694e7fcfe81993bcbfa5 100644
--- a/ipc/ipc_channel_mojo.cc
+++ b/ipc/ipc_channel_mojo.cc
@@ -479,8 +479,14 @@ void ChannelMojo::AddGenericAssociatedInterface(
void ChannelMojo::GetGenericRemoteAssociatedInterface(
const std::string& name,
mojo::ScopedInterfaceEndpointHandle handle) {
- if (message_reader_)
+ if (message_reader_) {
message_reader_->GetRemoteInterface(name, std::move(handle));
+ } else {
+ // Attach the associated interface to a disconnected pipe, so that the
+ // associated interface pointer can be used to make calls (which are
+ // dropped).
+ mojo::GetIsolatedInterface(std::move(handle));
+ }
}
} // namespace IPC
« no previous file with comments | « no previous file | ipc/ipc_sync_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698