diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-07 00:39:26 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-07 00:39:26 +0000 |
commit | 526776cf6ba5d6370ef28c9b483141fb0e4b1ae6 (patch) | |
tree | 5dd943dee4f2c74661c97f09a04b2358b16e3185 /chrome/common/ipc_message.h | |
parent | 95284326ea69903454907a200ad43ec41d158105 (diff) | |
download | chromium_src-526776cf6ba5d6370ef28c9b483141fb0e4b1ae6.zip chromium_src-526776cf6ba5d6370ef28c9b483141fb0e4b1ae6.tar.gz chromium_src-526776cf6ba5d6370ef28c9b483141fb0e4b1ae6.tar.bz2 |
FileDescriptor: passing fds over IPC
This patch introduces a FileDescriptor object which can be included in IPC messages and will perform the magic needed to pass file descriptors over IPC. After some consideration, Windows will continue to do the current DuplicateHandle tricks.
Review URL: http://codereview.chromium.org/20027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/ipc_message.h')
-rw-r--r-- | chrome/common/ipc_message.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/chrome/common/ipc_message.h b/chrome/common/ipc_message.h index 040a346..0af3b44 100644 --- a/chrome/common/ipc_message.h +++ b/chrome/common/ipc_message.h @@ -16,6 +16,8 @@ #ifndef NDEBUG #define IPC_MESSAGE_LOG_ENABLED #endif +#elif defined(OS_POSIX) +#include "chrome/common/file_descriptor_posix.h" #endif namespace IPC { @@ -159,6 +161,10 @@ class Message : public Pickle { return Pickle::FindNext(sizeof(Header), range_start, range_end); } +#if defined(OS_POSIX) + DescriptorSet* descriptor_set() const { return &descriptor_set_; } +#endif + #ifdef IPC_MESSAGE_LOG_ENABLED // Adds the outgoing time from Time::Now() at the end of the message and sets // a bit to indicate that it's been added. @@ -201,9 +207,12 @@ class Message : public Pickle { #pragma pack(push, 2) struct Header : Pickle::Header { - int32 routing; // ID of the view that this message is destined for - uint16 type; // specifies the user-defined message type - uint16 flags; // specifies control flags for the message + int32 routing; // ID of the view that this message is destined for + uint16 type; // specifies the user-defined message type + uint16 flags; // specifies control flags for the message +#if defined(OS_POSIX) + uint32 num_fds; // the number of descriptors included with this message +#endif }; #pragma pack(pop) @@ -216,6 +225,11 @@ class Message : public Pickle { void InitLoggingVariables(); +#if defined(OS_POSIX) + // The set of file descriptors associated with this message. + mutable DescriptorSet descriptor_set_; +#endif + #ifdef IPC_MESSAGE_LOG_ENABLED // Used for logging. mutable int64 received_time_; |