Index: ipc/ipc_channel_handle.h |
diff --git a/ipc/ipc_channel_handle.h b/ipc/ipc_channel_handle.h |
index ba034cca23b87b51557d6f3e53ab992ee0716e79..349dec2229505048ce5085c203269dd1c3a3091b 100644 |
--- a/ipc/ipc_channel_handle.h |
+++ b/ipc/ipc_channel_handle.h |
@@ -10,6 +10,9 @@ |
#include "build/build_config.h" |
+#if defined(OS_WIN) |
+#include "base/win/scoped_handle.h" |
+#endif |
#if defined(OS_POSIX) |
#include "base/file_descriptor_posix.h" |
#endif |
@@ -35,6 +38,23 @@ struct ChannelHandle { |
// processes with different working directories. |
ChannelHandle(const std::string& n) : name(n) {} |
ChannelHandle(const char* n) : name(n) {} |
+#if defined(OS_WIN) |
+ ChannelHandle(HANDLE h) : pipe(h) {} |
+ ChannelHandle(const ChannelHandle& other) { |
+ Assign(other); |
+ } |
+ ChannelHandle& operator=(const ChannelHandle& other) { |
+ Assign(other); |
+ return *this; |
+ } |
+ void Assign(const ChannelHandle& other) { |
+ name = other.name; |
+ HANDLE copy = NULL; |
+ DuplicateHandle(GetCurrentProcess(), other.pipe, GetCurrentProcess(), |
+ ©, 0, FALSE, DUPLICATE_SAME_ACCESS); |
+ pipe.Set(copy); |
+ } |
+#endif |
#if defined(OS_POSIX) |
ChannelHandle(const std::string& n, const base::FileDescriptor& s) |
: name(n), socket(s) {} |
@@ -44,6 +64,9 @@ struct ChannelHandle { |
#if defined(OS_POSIX) |
base::FileDescriptor socket; |
#endif // defined(OS_POSIX) |
+#if defined(OS_WIN) |
+ base::win::ScopedHandle pipe; |
cpu_(ooo_6.6-7.5)
2012/01/19 20:56:05
so base::FileDescriptor does not close the descrip
|
+#endif |
}; |