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

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: remove handles accessor 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
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..003da4ad90354b3d0b697f42aab96c602e12f38e 100644
--- a/mojo/edk/system/message_pipe_dispatcher.cc
+++ b/mojo/edk/system/message_pipe_dispatcher.cc
@@ -289,6 +289,7 @@ MojoResult MessagePipeDispatcher::ReadMessage(
dispatcher_headers + header->num_dispatchers);
size_t port_index = 0;
size_t platform_handle_index = 0;
+ ScopedPlatformHandleVectorPtr msg_handles = msg->TakeHandles();
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 +306,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 ||
Ken Rockot(use gerrit already) 2016/05/25 15:48:12 nit: Could you create a local num_handles near msg
Anand Mistry (off Chromium) 2016/05/25 23:36:38 Done.
+ if ((msg_handles && msg_handles->size() < 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;
+ (msg_handles && msg_handles->size()) ?
+ 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);

Powered by Google App Engine
This is Rietveld 408576698