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

Unified Diff: mojo/edk/system/channel_win.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.cc ('k') | mojo/edk/system/message_pipe_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/channel_win.cc
diff --git a/mojo/edk/system/channel_win.cc b/mojo/edk/system/channel_win.cc
index 38744ab99b16e424daf497b24695fc17469c1e0b..ad5fda05afcc92565dcdefd4bae00b8b83e6f3c3 100644
--- a/mojo/edk/system/channel_win.cc
+++ b/mojo/edk/system/channel_win.cc
@@ -121,12 +121,18 @@ class ChannelWin : public Channel,
ScopedPlatformHandleVectorPtr* handles) override {
if (num_handles > std::numeric_limits<uint16_t>::max())
return false;
- size_t handles_size = sizeof(PlatformHandle) * num_handles;
+ using HandleEntry = Channel::Message::HandleEntry;
+ size_t handles_size = sizeof(HandleEntry) * num_handles;
if (handles_size > extra_header_size)
return false;
DCHECK(extra_header);
handles->reset(new PlatformHandleVector(num_handles));
- memcpy((*handles)->data(), extra_header, handles_size);
+ const HandleEntry* extra_header_handles =
+ reinterpret_cast<const HandleEntry*>(extra_header);
+ for (size_t i = 0; i < num_handles; i++) {
+ (*handles)->at(i).handle = reinterpret_cast<HANDLE>(
+ static_cast<uintptr_t>(extra_header_handles[i].handle));
+ }
return true;
}
« no previous file with comments | « mojo/edk/system/channel.cc ('k') | mojo/edk/system/message_pipe_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698