Share field trial allocator on Linux
Reported by
lawrencewu@chromium.org,
Nov 9 2016
|
||
Issue descriptionCurrently, shared memory for field trials only works on Windows. Let's expand support to Linux as well. We'll have to likely pass around fd's on the command-line and get the shared memory to the zygote process (or deal with it some other way).
,
Nov 30 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c4fe88004d0457cf00b1731c1e974c96a3cd649e commit c4fe88004d0457cf00b1731c1e974c96a3cd649e Author: lawrencewu <lawrencewu@chromium.org> Date: Wed Nov 30 16:25:02 2016 Share field trial allocator on zygote-using Linuxes This passes a read-only handle to the field trial allocator on Linux (that is, on POSIX machines that use the zygote model). It works in the following way: in child_process_launcher.cc, we add our handle to shared memory, which is a file descriptor (since shared memory is really just an unnamed file), to files_to_register. The fds in this mapping get remapped in the zygote process, and then all child processes fork off the zygote, so the fds are the same in the child as in the zygote. When we spawn a new process, then, we add our fd as a switch on the command line (--field-trial-handle). Then, in the child process, we must grab this fd and read from it. But first, we have to get the correct fd using GlobalDescriptors, which is a singleton that maps from the browser process's fd (key which we have) to the remapped fd on the zygote (actual fd containing shared memory). So we use that to look it up and then read from shared memory as usual. BUG= 663914 Review-Url: https://codereview.chromium.org/2530573002 Cr-Commit-Position: refs/heads/master@{#435284} [modify] https://crrev.com/c4fe88004d0457cf00b1731c1e974c96a3cd649e/base/metrics/field_trial.cc [modify] https://crrev.com/c4fe88004d0457cf00b1731c1e974c96a3cd649e/base/metrics/field_trial.h [modify] https://crrev.com/c4fe88004d0457cf00b1731c1e974c96a3cd649e/base/metrics/field_trial_unittest.cc [modify] https://crrev.com/c4fe88004d0457cf00b1731c1e974c96a3cd649e/components/variations/child_process_field_trial_syncer_unittest.cc [modify] https://crrev.com/c4fe88004d0457cf00b1731c1e974c96a3cd649e/content/app/content_main_runner.cc [modify] https://crrev.com/c4fe88004d0457cf00b1731c1e974c96a3cd649e/content/browser/child_process_launcher.cc [modify] https://crrev.com/c4fe88004d0457cf00b1731c1e974c96a3cd649e/content/public/common/content_descriptors.h [modify] https://crrev.com/c4fe88004d0457cf00b1731c1e974c96a3cd649e/content/public/test/render_view_test.cc
,
Nov 30 2016
|
||
►
Sign in to add a comment |
||
Comment 1 by lawrencewu@chromium.org
, Nov 9 2016