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

Unified Diff: mojo/edk/system/message_pipe_dispatcher.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/channel_win.cc ('k') | mojo/edk/system/node_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/message_pipe_dispatcher.cc
diff --git a/mojo/edk/system/message_pipe_dispatcher.cc b/mojo/edk/system/message_pipe_dispatcher.cc
index a1bd1d02ede9664ca12d2a7dd2f0aa736fd50b06..23e5a3fb47dd0bbb478d78ba2d41d10242d15364 100644
--- a/mojo/edk/system/message_pipe_dispatcher.cc
+++ b/mojo/edk/system/message_pipe_dispatcher.cc
@@ -289,6 +289,8 @@ MojoResult MessagePipeDispatcher::ReadMessage(
dispatcher_headers + header->num_dispatchers);
size_t port_index = 0;
size_t platform_handle_index = 0;
+ ScopedPlatformHandleVectorPtr msg_handles = msg->TakeHandles();
+ const size_t num_msg_handles = msg_handles ? msg_handles->size() : 0;
for (size_t i = 0; i < header->num_dispatchers; ++i) {
const DispatcherHeader& dh = dispatcher_headers[i];
Type type = static_cast<Type>(dh.type);
@@ -305,13 +307,14 @@ MojoResult MessagePipeDispatcher::ReadMessage(
size_t next_platform_handle_index =
platform_handle_index + dh.num_platform_handles;
- if (msg->num_handles() < next_platform_handle_index ||
+ if (num_msg_handles < next_platform_handle_index ||
next_platform_handle_index < platform_handle_index) {
return MOJO_RESULT_UNKNOWN;
}
PlatformHandle* out_handles =
- msg->num_handles() ? msg->handles() + platform_handle_index : nullptr;
+ num_msg_handles ? msg_handles->data() + platform_handle_index
+ : nullptr;
dispatchers[i].dispatcher = Dispatcher::Deserialize(
type, dispatcher_data, dh.num_bytes, msg->ports() + port_index,
dh.num_ports, out_handles, dh.num_platform_handles);
« no previous file with comments | « mojo/edk/system/channel_win.cc ('k') | mojo/edk/system/node_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698