Index: ipc/ipc_message_utils.cc |
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc |
index db36c0fe7a62622fd0b7e4489c2bfdfd26f4a2f7..a36f51b123c7bd394f9db984c4a673c08b751c3d 100644 |
--- a/ipc/ipc_message_utils.cc |
+++ b/ipc/ipc_message_utils.cc |
@@ -35,6 +35,7 @@ |
#if defined(OS_WIN) |
#include <tchar.h> |
#include "ipc/handle_win.h" |
+#include "ipc/ipc_platform_file.h" |
#endif |
namespace IPC { |
@@ -842,6 +843,48 @@ void ParamTraits<base::SharedMemoryHandle>::Log(const param_type& p, |
} |
#endif // defined(OS_MACOSX) && !defined(OS_IOS) |
+#if defined(OS_WIN) |
+void ParamTraits<PlatformFileForTransit>::GetSize(base::PickleSizer* s, |
+ const param_type& p) { |
+ GetParamSize(s, p.IsValid()); |
+ if (p.IsValid()) |
+ GetParamSize(s, p.GetHandle()); |
+} |
+ |
+void ParamTraits<PlatformFileForTransit>::Write(base::Pickle* m, |
+ const param_type& p) { |
+ m->WriteBool(p.IsValid()); |
+ if (p.IsValid()) { |
+ HandleWin handle_win(p.GetHandle(), HandleWin::DUPLICATE); |
+ ParamTraits<HandleWin>::Write(m, handle_win); |
+ ::CloseHandle(p.GetHandle()); |
+ } |
+} |
+ |
+bool ParamTraits<PlatformFileForTransit>::Read(const base::Pickle* m, |
+ base::PickleIterator* iter, |
+ param_type* r) { |
+ bool is_valid; |
+ if (!iter->ReadBool(&is_valid)) |
+ return false; |
+ if (!is_valid) { |
+ *r = PlatformFileForTransit(); |
+ return true; |
+ } |
+ |
+ HandleWin handle_win; |
+ if (!ParamTraits<HandleWin>::Read(m, iter, &handle_win)) |
+ return false; |
+ *r = PlatformFileForTransit(handle_win.get_handle()); |
+ return true; |
+} |
+ |
+void ParamTraits<PlatformFileForTransit>::Log(const param_type& p, |
+ std::string* l) { |
+ LogParam(p.GetHandle(), l); |
+} |
+#endif // defined(OS_WIN) |
+ |
void ParamTraits<base::FilePath>::GetSize(base::PickleSizer* sizer, |
const param_type& p) { |
p.GetSizeForPickle(sizer); |