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

Unified Diff: mojo/edk/embedder/platform_handle.h

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 | « no previous file | mojo/edk/embedder/platform_handle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/embedder/platform_handle.h
diff --git a/mojo/edk/embedder/platform_handle.h b/mojo/edk/embedder/platform_handle.h
index 3c945c69dffe17c62515184b7b5307bb11597c70..675dd1fe9c8f480c1a5e4fd42120dfc6007d16f5 100644
--- a/mojo/edk/embedder/platform_handle.h
+++ b/mojo/edk/embedder/platform_handle.h
@@ -10,6 +10,8 @@
#if defined(OS_WIN)
#include <windows.h>
+
+#include "base/process/process_handle.h"
#elif defined(OS_MACOSX) && !defined(OS_IOS)
#include <mach/mach.h>
#endif
@@ -58,13 +60,18 @@ struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle {
#elif defined(OS_WIN)
struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle {
PlatformHandle() : handle(INVALID_HANDLE_VALUE) {}
- explicit PlatformHandle(HANDLE handle) : handle(handle) {}
+ explicit PlatformHandle(HANDLE handle)
+ : handle(handle), owning_process(base::GetCurrentProcessHandle()) {}
void CloseIfNecessary();
bool is_valid() const { return handle != INVALID_HANDLE_VALUE; }
HANDLE handle;
+
+ // A Windows HANDLE may be duplicated to another process but not yet sent to
+ // that process. This tracks the handle's owning process.
+ base::ProcessHandle owning_process;
};
#else
#error "Platform not yet supported."
« no previous file with comments | « no previous file | mojo/edk/embedder/platform_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698