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

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

Issue 1914053003: [mojo-edk] Fix lifetime management of rewritten Windows HANDLEs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/embedder/platform_handle.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/channel.cc
diff --git a/mojo/edk/system/channel.cc b/mojo/edk/system/channel.cc
index 69fe59df99623c4e133332661ba55d5908cfc9f8..88543f14b688e682b13ad7c3170f3d6740a6de5f 100644
--- a/mojo/edk/system/channel.cc
+++ b/mojo/edk/system/channel.cc
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/memory/aligned_memory.h"
+#include "base/process/process_handle.h"
#include "mojo/edk/embedder/platform_handle.h"
#if defined(OS_MACOSX) && !defined(OS_IOS)
@@ -330,11 +331,14 @@ bool Channel::Message::RewriteHandles(base::ProcessHandle from_process,
DLOG(ERROR) << "Refusing to duplicate invalid handle.";
continue;
}
+ DCHECK_EQ(handles[i].owning_process, from_process);
BOOL result = DuplicateHandle(
from_process, handles[i].handle, to_process,
- reinterpret_cast<HANDLE*>(handles + i), 0, FALSE,
+ &handles[i].handle, 0, FALSE,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
- if (!result)
+ if (result)
+ handles[i].owning_process = to_process;
+ else
success = false;
}
return success;
« no previous file with comments | « mojo/edk/embedder/platform_handle.cc ('k') | mojo/edk/system/node_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698