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

Unified Diff: mojo/edk/system/node_channel.cc

Issue 2008953003: [mojo-edk] Explicitly serialise HANDLEs into messages instead of PlatformHandles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cast2 Created 4 years, 7 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 | « mojo/edk/system/message_pipe_dispatcher.cc ('k') | mojo/edk/system/node_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/node_channel.cc
diff --git a/mojo/edk/system/node_channel.cc b/mojo/edk/system/node_channel.cc
index 25488602b203db4936c466f5da73d2282f900e13..7dc53fc950ac44d776a629e43dd55d3781fb160c 100644
--- a/mojo/edk/system/node_channel.cc
+++ b/mojo/edk/system/node_channel.cc
@@ -416,7 +416,7 @@ void NodeChannel::OnChannelMessage(const void* payload,
handle.owning_process = remote_process_handle_;
if (!Channel::Message::RewriteHandles(remote_process_handle_,
base::GetCurrentProcessHandle(),
- handles->data(), handles->size())) {
+ handles.get())) {
DLOG(ERROR) << "Received one or more invalid handles.";
}
} else if (handles) {
@@ -728,11 +728,13 @@ void NodeChannel::WriteChannelMessage(Channel::MessagePtr message) {
// Rewrite outgoing handles if we have a handle to the destination process.
if (remote_process_handle != base::kNullProcessHandle) {
- if (!message->RewriteHandles(base::GetCurrentProcessHandle(),
- remote_process_handle, message->handles(),
- message->num_handles())) {
+ ScopedPlatformHandleVectorPtr handles = message->TakeHandles();
+ if (!Channel::Message::RewriteHandles(base::GetCurrentProcessHandle(),
+ remote_process_handle,
+ handles.get())) {
DLOG(ERROR) << "Failed to duplicate one or more outgoing handles.";
}
+ message->SetHandles(std::move(handles));
}
}
#elif defined(OS_MACOSX) && !defined(OS_IOS)
« no previous file with comments | « mojo/edk/system/message_pipe_dispatcher.cc ('k') | mojo/edk/system/node_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698