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

Unified Diff: chrome/common/ipc_message_utils.h

Issue 20275: POSIX: Clean up DescriptorSet (Closed)
Patch Set: ... Created 11 years, 10 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
« no previous file with comments | « chrome/common/ipc_message.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/ipc_message_utils.h
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index e7dd7e355d5a47866cc9f3a3291105a5708b1df1..71698fd91aa444543ea12bbb45c3489b323c9255 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -671,29 +671,17 @@ template<>
struct ParamTraits<base::FileDescriptor> {
typedef base::FileDescriptor param_type;
static void Write(Message* m, const param_type& p) {
- if (p.auto_close) {
- if (!m->descriptor_set()->AddAndAutoClose(p.fd))
- NOTREACHED();
- } else {
- if (!m->descriptor_set()->Add(p.fd))
- NOTREACHED();
- }
+ if (!m->WriteFileDescriptor(p))
+ NOTREACHED();
}
static bool Read(const Message* m, void** iter, param_type* r) {
- r->auto_close = false;
- r->fd = m->descriptor_set()->NextDescriptor();
-
- // We always return true here because some of the IPC message logging
- // functions want to parse the message multiple times. On the second and
- // later attempts, the descriptor_set will be empty and so will return -1,
- // however, failing to parse at log time is a fatal error.
- return true;
+ return m->ReadFileDescriptor(iter, r);
}
static void Log(const param_type& p, std::wstring* l) {
if (p.auto_close) {
- l->append(L"FD(auto-close)");
+ l->append(StringPrintf(L"FD(%d auto-close)", p.fd));
} else {
- l->append(L"FD");
+ l->append(StringPrintf(L"FD(%d)", p.fd));
}
}
};
« no previous file with comments | « chrome/common/ipc_message.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698