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

Issue 67413003: Mojo: Implement plumbing to support passing handles over MessagePipes. (Closed)

Created:
7 years, 1 month ago by viettrungluu
Modified:
7 years, 1 month ago
CC:
chromium-reviews, Aaron Boodman, darin (slow to review), viettrungluu+watch_chromium.org, ben+mojo_chromium.org, abarth-chromium
Visibility:
Public.

Description

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 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=234302

Patch Set 1 #

Patch Set 2 : old chunk mismatch #

Total comments: 12

Patch Set 3 : rebased & review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+538 lines, -202 lines) Patch
M mojo/public/system/core.h View 3 chunks +6 lines, -0 lines 0 comments Download
M mojo/system/core_impl.h View 1 2 2 chunks +35 lines, -3 lines 0 comments Download
M mojo/system/core_impl.cc View 1 2 8 chunks +181 lines, -13 lines 0 comments Download
M mojo/system/core_impl_unittest.cc View 3 chunks +140 lines, -0 lines 0 comments Download
M mojo/system/core_test_base.cc View 2 chunks +10 lines, -11 lines 0 comments Download
M mojo/system/dispatcher.h View 5 chunks +31 lines, -19 lines 0 comments Download
M mojo/system/dispatcher.cc View 4 chunks +26 lines, -21 lines 0 comments Download
M mojo/system/dispatcher_unittest.cc View 3 chunks +6 lines, -6 lines 0 comments Download
M mojo/system/message_pipe.h View 3 chunks +8 lines, -4 lines 0 comments Download
M mojo/system/message_pipe.cc View 1 2 2 chunks +8 lines, -6 lines 0 comments Download
M mojo/system/message_pipe_dispatcher.h View 1 chunk +5 lines, -8 lines 0 comments Download
M mojo/system/message_pipe_dispatcher.cc View 2 chunks +16 lines, -18 lines 0 comments Download
M mojo/system/message_pipe_dispatcher_unittest.cc View 14 chunks +19 lines, -46 lines 0 comments Download
M mojo/system/message_pipe_unittest.cc View 32 chunks +33 lines, -33 lines 0 comments Download
M mojo/system/remote_message_pipe_posix_unittest.cc View 9 chunks +14 lines, -14 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
viettrungluu
This is probably about two-thirds of the work needed to send handles in-process, but it's ...
7 years, 1 month ago (2013-11-08 23:29:53 UTC) #1
darin (slow to review)
LGTM https://codereview.chromium.org/67413003/diff/20002/mojo/system/core_impl.cc File mojo/system/core_impl.cc (right): https://codereview.chromium.org/67413003/diff/20002/mojo/system/core_impl.cc#newcode180 mojo/system/core_impl.cc:180: what if |handle| is currently busy (and num_handles ...
7 years, 1 month ago (2013-11-11 21:22:21 UTC) #2
viettrungluu
Thanks. https://codereview.chromium.org/67413003/diff/20002/mojo/system/core_impl.cc File mojo/system/core_impl.cc (right): https://codereview.chromium.org/67413003/diff/20002/mojo/system/core_impl.cc#newcode180 mojo/system/core_impl.cc:180: On 2013/11/11 21:22:21, darin wrote: > what if ...
7 years, 1 month ago (2013-11-11 22:40:25 UTC) #3
viettrungluu
Committed patchset #3 manually as r234302 (presubmit successful).
7 years, 1 month ago (2013-11-11 22:41:57 UTC) #4
darin (slow to review)
7 years, 1 month ago (2013-11-11 22:57:03 UTC) #5
On Mon, Nov 11, 2013 at 2:40 PM, <viettrungluu@chromium.org> wrote:

> Thanks.
>
>
>
> https://codereview.chromium.org/67413003/diff/20002/mojo/
> system/core_impl.cc
> File mojo/system/core_impl.cc (right):
>
> https://codereview.chromium.org/67413003/diff/20002/mojo/
> system/core_impl.cc#newcode180
> mojo/system/core_impl.cc:180:
> On 2013/11/11 21:22:21, darin wrote:
>
>> what if |handle| is currently busy (and num_handles is 0)? shouldn't
>> WriteMessage fail with MOJO_RESULT_BUSY?
>>
>
> If |handle| is busy, then its dispatcher's lock will be held, so that
> |dispatcher->WriteMessage()| will just block on its lock. This is the
> behavior for other calls involving a busy handle as well.
>
>
Ah, yeah... of course. Thanks!

-Darin



> (This is okay, since we never unconditionally acquire dispatcher locks
> under handle_table_lock_. Phew.)
>
>
> https://codereview.chromium.org/67413003/diff/20002/mojo/
> system/core_impl.cc#newcode327
> mojo/system/core_impl.cc:327: if (dispatchers.size() > 0) {
> On 2013/11/11 21:22:21, darin wrote:
>
>> nit: !dispatchers.empty()
>>
>
> Done.
>
>
> https://codereview.chromium.org/67413003/diff/20002/mojo/
> system/core_impl.h
> File mojo/system/core_impl.h (right):
>
> https://codereview.chromium.org/67413003/diff/20002/mojo/
> system/core_impl.h#newcode63
> mojo/system/core_impl.h:63: // |WriteMessage()|) that wants to hold onto
> a dispatcher and later remove it
> On 2013/11/11 21:22:21, darin wrote:
>
>> nit: wants -> want, onto -> on to
>>
>
> Done.
>
>
> https://codereview.chromium.org/67413003/diff/20002/mojo/
> system/core_impl.h#newcode82
> mojo/system/core_impl.h:82: // message in-process. Instead, it must
> create transfer the "contents" of the
> On 2013/11/11 21:22:21, darin wrote:
>
>> nit: "create transfer"
>>
>
> Done.
>
> https://codereview.chromium.org/67413003/diff/20002/mojo/
> system/core_impl.h#newcode96
> mojo/system/core_impl.h:96:
> On 2013/11/11 21:22:21, darin wrote:
>
>> nit: extra new line
>>
>
> Done.
>
>
> https://codereview.chromium.org/67413003/diff/20002/mojo/
> system/message_pipe.cc
> File mojo/system/message_pipe.cc (right):
>
> https://codereview.chromium.org/67413003/diff/20002/mojo/
> system/message_pipe.cc#newcode91
> mojo/system/message_pipe.cc:91: //
> handles, num_handles,
> On 2013/11/11 21:22:21, darin wrote:
>
>> nit: remove commented out code or add a TODO?
>>
>
> Oops, deleted. Thanks.
>
> https://codereview.chromium.org/67413003/
>

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698