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

Unified Diff: ipc/ipc_channel_handle.h

Issue 9150030: Initialize IPC:ChannelHandle from existing HANDLE (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed build error Created 8 years, 11 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
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(),
+ &copy, 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
};

Powered by Google App Engine
This is Rietveld 408576698