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

Unified Diff: ipc/ipc_message_utils.cc

Issue 2846293002: Make PlatformFileForTransit its own class on Windows. (Closed)
Patch Set: Use nullptr instead of INVALID_HANDLE_VALUE. Created 3 years, 8 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_message_utils.cc
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc
index db36c0fe7a62622fd0b7e4489c2bfdfd26f4a2f7..68f07f8795f480a6faa9dfb94695ef2dcffe78cf 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,35 @@ 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.GetHandle());
+}
+
+void ParamTraits<PlatformFileForTransit>::Write(base::Pickle* m,
+ const param_type& p) {
+ 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) {
+ 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);

Powered by Google App Engine
This is Rietveld 408576698