diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-10 17:26:03 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-10 17:26:03 +0000 |
commit | ff79fa2e4ed182580ccdea61ba24a955f8f06507 (patch) | |
tree | f725cd487192caa355ddef4ed0ef39f3db955a04 /ipc/ipc_channel_nacl.h | |
parent | 4575961728be1794ed1f58f5210368d633d20590 (diff) | |
download | chromium_src-ff79fa2e4ed182580ccdea61ba24a955f8f06507.zip chromium_src-ff79fa2e4ed182580ccdea61ba24a955f8f06507.tar.gz chromium_src-ff79fa2e4ed182580ccdea61ba24a955f8f06507.tar.bz2 |
PPAPI/NaCl: Support Handle passing in ipc_channel_nacl
This is speculative, since we don't have the underlying support in NaClIPCAdapter. But I verified locally that it works as well as it did before (i.e., sending data works).
BUG=116317
TEST=
Review URL: https://chromiumcodereview.appspot.com/10750005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145899 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_nacl.h')
-rw-r--r-- | ipc/ipc_channel_nacl.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/ipc/ipc_channel_nacl.h b/ipc/ipc_channel_nacl.h index 84f4ef7..4fefe4f 100644 --- a/ipc/ipc_channel_nacl.h +++ b/ipc/ipc_channel_nacl.h @@ -19,6 +19,10 @@ namespace IPC { +// Contains the results from one call to imc_recvmsg (data and file +// descriptors). +struct MessageContents; + // Similar to the Posix version of ChannelImpl but for Native Client code. // This is somewhat different because sendmsg/recvmsg here do not follow POSIX // semantics. Instead, they are implemented by a custom embedding of @@ -42,7 +46,7 @@ class Channel::ChannelImpl : public internal::ChannelReader { bool Send(Message* message); // Posted to the main thread by ReaderThreadRunner. - void DidRecvMsg(scoped_ptr<std::vector<char> > buffer); + void DidRecvMsg(scoped_ptr<MessageContents> contents); void ReadDidFail(); private: @@ -84,15 +88,22 @@ class Channel::ChannelImpl : public internal::ChannelReader { // IPC::ChannelReader expects to be able to call ReadData on us to // synchronously read data waiting in the pipe's buffer without blocking. // Since we can't do that (see 1 and 2 above), the reader thread does blocking - // reads and posts the data over to the main thread in byte vectors. Each byte - // vector is the result of one call to "recvmsg". When ReadData is called, it - // pulls the bytes out of these vectors in order. + // reads and posts the data over to the main thread in MessageContents. Each + // MessageContents object is the result of one call to "imc_recvmsg". + // DidRecvMsg breaks the MessageContents out in to the data and the file + // descriptors, and puts them on these two queues. // TODO(dmichael): There's probably a more efficient way to emulate this with // a circular buffer or something, so we don't have to do so // many heap allocations. But it maybe isn't worth // the trouble given that we probably want to implement 1 and // 2 above in NaCl eventually. + // When ReadData is called, it pulls the bytes out of this queue in order. std::deque<linked_ptr<std::vector<char> > > read_queue_; + // Queue of file descriptors extracted from imc_recvmsg messages. + // NOTE: The implementation assumes underlying storage here is contiguous, so + // don't change to something like std::deque<> without changing the + // implementation! + std::vector<int> input_fds_; // This queue is used when a message is sent prior to Connect having been // called. Normally after we're connected, the queue is empty. |