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

Issue 1488853002: Add multiplexing of message pipes in the new EDK. (Closed)

Created:
5 years ago by jam
Modified:
5 years ago
Reviewers:
Tom Sepez, yzshen1
CC:
chromium-reviews, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review), ben+mojo_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add multiplexing of message pipes in the new EDK. This dramatically cuts down on the number of OS pipes used. The key is that the vast majority (all for now) of message pipes are only read or written in one process. If they're passed to another process, that is before they're interacted with. So by default, create message pipes such that they're not transferable after they're read or written. A non-transferable pipe is then just a unique ID. When two process "bind" their end by reading/writing to that ID, the parent process ensures that the two processes have a channel between them and tells them to connect to each other using it. "Transferable" message pipes can still be created and these can be sent after they're read or written to, by specifying MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_TRANSFERABLE. BUG=556259 R=tsepez@chromium.org, yzshen@chromium.org Committed: https://chromium.googlesource.com/chromium/src/+/44929cdb67189f2715c90b1a17bc29ccc2276991

Patch Set 1 #

Patch Set 2 : merge #

Patch Set 3 : use RawChannel instead of pipe #

Patch Set 4 : multiplexing shuts down correctly #

Patch Set 5 : cleanup #

Patch Set 6 : Fix chrome and POSIX #

Total comments: 23

Patch Set 7 : fix tests #

Patch Set 8 : merge #

Total comments: 4

Patch Set 9 : review comments #

Total comments: 11

Patch Set 10 : fix remaining tests #

Patch Set 11 : tsepez review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1472 lines, -391 lines) Patch
M components/web_view/frame.cc View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/browser_child_process_host_impl.cc View 1 2 3 4 5 2 chunks +0 lines, -3 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 5 6 7 2 chunks +0 lines, -3 lines 0 comments Download
M content/child/child_thread_impl.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M content/child/child_thread_impl.cc View 1 2 3 4 5 2 chunks +1 line, -2 lines 0 comments Download
M content/renderer/DEPS View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl_browsertest.cc View 1 2 3 4 5 6 2 chunks +3 lines, -1 line 0 comments Download
M mojo/edk/embedder/embedder.cc View 1 2 3 4 5 6 7 2 chunks +4 lines, -8 lines 0 comments Download
M mojo/edk/embedder/embedder_unittest.cc View 1 2 3 4 5 6 4 chunks +95 lines, -102 lines 0 comments Download
M mojo/edk/system/BUILD.gn View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/edk/system/broker.h View 1 2 3 4 5 6 7 8 2 chunks +22 lines, -5 lines 0 comments Download
M mojo/edk/system/broker_messages.h View 1 2 3 4 5 6 7 8 3 chunks +41 lines, -5 lines 0 comments Download
M mojo/edk/system/broker_state.h View 1 2 3 4 5 6 7 8 4 chunks +62 lines, -11 lines 0 comments Download
M mojo/edk/system/broker_state.cc View 1 2 3 4 5 6 7 8 9 10 5 chunks +199 lines, -5 lines 0 comments Download
M mojo/edk/system/child_broker.h View 1 2 3 4 5 6 7 8 3 chunks +66 lines, -3 lines 0 comments Download
M mojo/edk/system/child_broker.cc View 1 2 3 4 5 6 7 8 9 10 7 chunks +191 lines, -21 lines 0 comments Download
M mojo/edk/system/child_broker_host.h View 1 2 3 4 5 6 7 8 3 chunks +38 lines, -11 lines 0 comments Download
M mojo/edk/system/child_broker_host.cc View 1 2 3 4 5 6 7 8 9 10 4 chunks +139 lines, -25 lines 0 comments Download
M mojo/edk/system/core.cc View 1 2 3 4 2 chunks +20 lines, -9 lines 0 comments Download
M mojo/edk/system/core_test_base.h View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M mojo/edk/system/core_unittest.cc View 1 2 3 4 5 6 1 chunk +4 lines, -1 line 0 comments Download
M mojo/edk/system/data_pipe_unittest.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M mojo/edk/system/dispatcher.h View 1 chunk +1 line, -0 lines 0 comments Download
M mojo/edk/system/message_in_transit.h View 1 2 3 4 3 chunks +6 lines, -1 line 0 comments Download
M mojo/edk/system/message_in_transit.cc View 1 chunk +1 line, -0 lines 0 comments Download
M mojo/edk/system/message_pipe_dispatcher.h View 1 2 3 4 5 6 7 8 9 10 8 chunks +57 lines, -10 lines 0 comments Download
M mojo/edk/system/message_pipe_dispatcher.cc View 1 2 3 4 5 6 7 8 9 23 chunks +186 lines, -43 lines 0 comments Download
M mojo/edk/system/message_pipe_perftest.cc View 1 2 3 4 5 6 2 chunks +1 line, -7 lines 0 comments Download
M mojo/edk/system/message_pipe_test_utils.h View 1 2 3 4 5 6 2 chunks +0 lines, -12 lines 0 comments Download
M mojo/edk/system/message_pipe_test_utils.cc View 1 2 3 4 5 6 1 chunk +1 line, -10 lines 0 comments Download
M mojo/edk/system/message_pipe_unittest.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M mojo/edk/system/multiprocess_message_pipe_unittest.cc View 1 2 3 4 5 6 7 6 chunks +1 line, -27 lines 0 comments Download
M mojo/edk/system/raw_channel_unittest.cc View 1 2 3 4 5 6 16 chunks +30 lines, -18 lines 0 comments Download
A mojo/edk/system/routed_raw_channel.h View 1 2 3 4 5 1 chunk +78 lines, -0 lines 0 comments Download
A mojo/edk/system/routed_raw_channel.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +168 lines, -0 lines 0 comments Download
M mojo/edk/system/run_all_unittests.cc View 1 2 3 4 5 6 7 2 chunks +8 lines, -0 lines 0 comments Download
M mojo/edk/system/test_utils.h View 1 2 3 4 5 6 2 chunks +0 lines, -19 lines 0 comments Download
M mojo/edk/system/test_utils.cc View 1 2 3 4 5 6 1 chunk +0 lines, -9 lines 0 comments Download
M mojo/edk/test/BUILD.gn View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M mojo/edk/test/multiprocess_test_helper_unittest.cc View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M mojo/edk/test/run_all_perftests.cc View 1 2 3 4 5 6 1 chunk +18 lines, -3 lines 0 comments Download
M mojo/mojo_edk.gyp View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/public/c/system/message_pipe.h View 1 2 3 4 5 6 7 8 1 chunk +10 lines, -1 line 0 comments Download
M mojo/runner/host/child_process.cc View 1 2 3 4 5 6 7 4 chunks +3 lines, -4 lines 0 comments Download
M mojo/runner/host/child_process_host.cc View 1 2 3 4 5 5 chunks +0 lines, -7 lines 0 comments Download
M third_party/mojo/src/mojo/edk/embedder/embedder.cc View 1 2 3 4 5 6 7 8 9 2 chunks +3 lines, -0 lines 0 comments Download

Messages

Total messages: 31 (13 generated)
jam
5 years ago (2015-12-03 00:44:51 UTC) #5
jam
+tsepez as security reviewer since you looked at the last mojo/edk/system/broker_messages.h changes. This should be ...
5 years ago (2015-12-03 23:04:05 UTC) #9
jam
Regarding the size of the pipe_id key: I pondered whether 64 bit is enough or ...
5 years ago (2015-12-03 23:22:08 UTC) #10
Tom Sepez
Ok on the rand IDs. I'm still plowing through the meat of this, its going ...
5 years ago (2015-12-03 23:35:28 UTC) #11
yzshen1
Just some nits. Thanks! https://codereview.chromium.org/1488853002/diff/120002/mojo/edk/system/broker.h File mojo/edk/system/broker.h (right): https://codereview.chromium.org/1488853002/diff/120002/mojo/edk/system/broker.h#newcode52 mojo/edk/system/broker.h:52: // that it can us ...
5 years ago (2015-12-03 23:37:51 UTC) #12
jam
https://codereview.chromium.org/1488853002/diff/190001/mojo/edk/system/broker_messages.h File mojo/edk/system/broker_messages.h (right): https://codereview.chromium.org/1488853002/diff/190001/mojo/edk/system/broker_messages.h#newcode44 mojo/edk/system/broker_messages.h:44: const int kBrokerMessageHeaderSize = On 2015/12/03 23:35:28, Tom Sepez ...
5 years ago (2015-12-04 00:43:47 UTC) #13
jam
https://codereview.chromium.org/1488853002/diff/120002/mojo/edk/system/broker.h File mojo/edk/system/broker.h (right): https://codereview.chromium.org/1488853002/diff/120002/mojo/edk/system/broker.h#newcode52 mojo/edk/system/broker.h:52: // that it can us for sending messages. On ...
5 years ago (2015-12-04 05:06:47 UTC) #14
yzshen1
LGTM Thanks! https://codereview.chromium.org/1488853002/diff/120002/mojo/edk/system/broker_state.h File mojo/edk/system/broker_state.h (right): https://codereview.chromium.org/1488853002/diff/120002/mojo/edk/system/broker_state.h#newcode78 mojo/edk/system/broker_state.h:78: base::Lock lock_; // Guards access to below. ...
5 years ago (2015-12-04 05:57:05 UTC) #15
Tom Sepez
https://codereview.chromium.org/1488853002/diff/210001/mojo/edk/system/broker_state.cc File mojo/edk/system/broker_state.cc (right): https://codereview.chromium.org/1488853002/diff/210001/mojo/edk/system/broker_state.cc#newcode119 mojo/edk/system/broker_state.cc:119: CHECK(connected_pipes_.find(message_pipe) != connected_pipes_.end()); These checks are essential for safety; ...
5 years ago (2015-12-04 17:59:43 UTC) #16
jam
Thanks Yuzhu and Tom for the thorough review. Tom: your comments are addressed now. ptal. ...
5 years ago (2015-12-05 00:09:34 UTC) #17
Tom Sepez
LGTM
5 years ago (2015-12-05 00:14:36 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1488853002/250001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1488853002/250001
5 years ago (2015-12-06 22:24:11 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/151094)
5 years ago (2015-12-06 23:36:03 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1488853002/250001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1488853002/250001
5 years ago (2015-12-06 23:40:48 UTC) #25
commit-bot: I haz the power
Patchset 11 (id:??) landed as https://crrev.com/44929cdb67189f2715c90b1a17bc29ccc2276991 Cr-Commit-Position: refs/heads/master@{#363386}
5 years ago (2015-12-06 23:51:04 UTC) #27
jam
Committed patchset #11 (id:250001) manually as 44929cdb67189f2715c90b1a17bc29ccc2276991 (presubmit successful).
5 years ago (2015-12-06 23:51:41 UTC) #29
loyso (OOO)
On 2015/12/06 23:51:41, jam wrote: > Committed patchset #11 (id:250001) manually as > 44929cdb67189f2715c90b1a17bc29ccc2276991 (presubmit ...
5 years ago (2015-12-07 06:57:29 UTC) #30
jam
5 years ago (2015-12-07 15:38:04 UTC) #31
Message was sent while issue was closed.
On 2015/12/07 06:57:29, loyso wrote:
> On 2015/12/06 23:51:41, jam wrote:
> > Committed patchset #11 (id:250001) manually as
> > 44929cdb67189f2715c90b1a17bc29ccc2276991 (presubmit successful).
> 
> Looks like this CL breaks win build for battor_agent.
> http://build.chromium.org/p/chromium/buildstatus?builder=Win&number=38134
> 
> FAILED: ninja -t msvc -e environment.x86 -- C:\b\build\goma/gomacc
> "C:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo
> /showIncludes /FC
@obj\tools\battor_agent\battor_agent_lib.battor_agent.obj.rsp
> /c ..\..\tools\battor_agent\battor_agent.cc
> /Foobj\tools\battor_agent\battor_agent_lib.battor_agent.obj
> /Fdobj\tools\battor_agent\battor_agent_lib.cc.pdb 
> c:\b\build\slave\win\build\src\device\serial\buffer.h(10) : fatal error C1083:
> Cannot open include file: 'device/serial/serial.mojom.h': No such file or
> directory
> FAILED: ninja -t msvc -e environment.x86 -- C:\b\build\goma/gomacc
> "C:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo
> /showIncludes /FC
> @obj\tools\battor_agent\battor_agent_lib.battor_connection.obj.rsp /c
> ..\..\tools\battor_agent\battor_connection.cc
> /Foobj\tools\battor_agent\battor_agent_lib.battor_connection.obj
> /Fdobj\tools\battor_agent\battor_agent_lib.cc.pdb 
> c:\b\build\slave\win\build\src\device\serial\buffer.h(10) : fatal error C1083:
> Cannot open include file: 'device/serial/serial.mojom.h': No such file or
> directory

This is unrelated; it looks like there's a missing dependency for that and
that's why the build intermittently fails (even before this cl). I'll file a
bug.

Powered by Google App Engine
This is Rietveld 408576698