Index: base/platform_file_win.cc |
diff --git a/base/platform_file_win.cc b/base/platform_file_win.cc |
index f448db065a7be5be284d95b9ad9df6fb2001de16..e531577d0246e5032f8e8bf4d62163825a89c315 100644 |
--- a/base/platform_file_win.cc |
+++ b/base/platform_file_win.cc |
@@ -217,4 +217,19 @@ bool GetPlatformFileInfo(PlatformFile file, PlatformFileInfo* info) { |
return true; |
} |
+PlatformFile GetFileHandleForProcess(PlatformFile file, |
+ ProcessHandle process, |
+ bool close_source_handle) { |
+ if (file == base::kInvalidPlatformFileValue) |
+ return base::kInvalidPlatformFileValue; |
+ |
+ PlatformFile result = base::kInvalidPlatformFileValue; |
+ // Note that when |close_source_handle| is true, |file| is closed whether or |
+ // not DuplicateHandle succeeds. |
+ DuplicateHandle(GetCurrentProcess(), file, process, &result, 0, false, |
+ DUPLICATE_SAME_ACCESS | |
+ (close_source_handle ? DUPLICATE_CLOSE_SOURCE : 0)); |
+ return result; |
+} |
+ |
} // namespace disk_cache |