diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-11 22:41:48 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-11 22:41:48 +0000 |
commit | ef3797e4d14ce4b64cbbfdcf95843dc9bbdbb5b7 (patch) | |
tree | 243d458b098f7e06fdd00910a406116f5fb2db25 /mojo/system/message_pipe_dispatcher.h | |
parent | 5260b6683833c6d7c014346683b6bfc009f4ae72 (diff) | |
download | chromium_src-ef3797e4d14ce4b64cbbfdcf95843dc9bbdbb5b7.zip chromium_src-ef3797e4d14ce4b64cbbfdcf95843dc9bbdbb5b7.tar.gz chromium_src-ef3797e4d14ce4b64cbbfdcf95843dc9bbdbb5b7.tar.bz2 |
Mojo: Implement plumbing to support passing handles over MessagePipes.
This is tricky for several reasons:
- We have fine-grained locking (and would like to keep it that way),
and need to avoid deadlock. In particular, acquiring multiple
dispatcher locks simultaneously is dangerous -- so we allow it to
fail.
- We want clean failure semantics. In particular, on failure,
WriteMessage() should leave the handles being sent valid. This means
that we may not remove them from the handle table until the call has
succeeded. Thus we have to mark them as busy.
- We need to avoid various races. E.g., still to do: When sending a
handle in-process, it's important that once |WriteMessage()| has
sent a handle, no more calls done on that particular handle may
proceed. As a result, we won't be able to simply transfer
dispatchers to a new handle (in-process) but instead must create a
new dispatcher referencing the same resource. This will also ensure
that |Wait()|s on that handle will be properly cancelled.
R=darin@chromium.org, darin
Review URL: https://codereview.chromium.org/67413003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234302 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/system/message_pipe_dispatcher.h')
-rw-r--r-- | mojo/system/message_pipe_dispatcher.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/mojo/system/message_pipe_dispatcher.h b/mojo/system/message_pipe_dispatcher.h index a0e2f09..8fda16a 100644 --- a/mojo/system/message_pipe_dispatcher.h +++ b/mojo/system/message_pipe_dispatcher.h @@ -33,16 +33,13 @@ class MOJO_SYSTEM_EXPORT MessagePipeDispatcher : public Dispatcher { virtual void CancelAllWaitersNoLock() OVERRIDE; virtual MojoResult CloseImplNoLock() OVERRIDE; virtual MojoResult WriteMessageImplNoLock( - const void* bytes, - uint32_t num_bytes, - const MojoHandle* handles, - uint32_t num_handles, + const void* bytes, uint32_t num_bytes, + const std::vector<Dispatcher*>* dispatchers, MojoWriteMessageFlags flags) OVERRIDE; virtual MojoResult ReadMessageImplNoLock( - void* bytes, - uint32_t* num_bytes, - MojoHandle* handles, - uint32_t* num_handles, + void* bytes, uint32_t* num_bytes, + uint32_t max_num_dispatchers, + std::vector<scoped_refptr<Dispatcher> >* dispatchers, MojoReadMessageFlags flags) OVERRIDE; virtual MojoResult AddWaiterImplNoLock(Waiter* waiter, MojoWaitFlags flags, |