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

Unified Diff: ipc/ipc_platform_file.cc

Issue 1830853002: Make PlatformFileForTransit a class on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from mseaborn. Created 4 years, 9 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 | « ipc/ipc_platform_file.h ('k') | remoting/host/daemon_process_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_platform_file.cc
diff --git a/ipc/ipc_platform_file.cc b/ipc/ipc_platform_file.cc
index 97c176f3d7b705de07591956a1dfa3363d6aee52..a9b7b880932e3c2dd4d5ca7b627c1d77764faf6f 100644
--- a/ipc/ipc_platform_file.cc
+++ b/ipc/ipc_platform_file.cc
@@ -16,18 +16,18 @@ PlatformFileForTransit GetFileHandleForProcess(base::PlatformFile handle,
bool close_source_handle) {
IPC::PlatformFileForTransit out_handle;
#if defined(OS_WIN)
+ HANDLE raw_handle = INVALID_HANDLE_VALUE;
DWORD options = DUPLICATE_SAME_ACCESS;
if (close_source_handle)
options |= DUPLICATE_CLOSE_SOURCE;
if (handle == INVALID_HANDLE_VALUE ||
- !::DuplicateHandle(::GetCurrentProcess(),
- handle,
- process,
- &out_handle,
- 0,
- FALSE,
- options)) {
+ !::DuplicateHandle(::GetCurrentProcess(), handle, process, &raw_handle, 0,
+ FALSE, options)) {
out_handle = IPC::InvalidPlatformFileForTransit();
+ } else {
+ out_handle =
+ IPC::PlatformFileForTransit(raw_handle, base::GetProcId(process));
+ out_handle.SetOwnershipPassesToIPC(true);
}
#elif defined(OS_POSIX)
// If asked to close the source, we can simply re-use the source fd instead of
« no previous file with comments | « ipc/ipc_platform_file.h ('k') | remoting/host/daemon_process_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698