| Index: components/arc/arc_bridge_bootstrap.cc
|
| diff --git a/components/arc/arc_bridge_bootstrap.cc b/components/arc/arc_bridge_bootstrap.cc
|
| index 1d7a94f55178b590325f95b1ce23fff6f1c2afb5..6fcee5507d3a6be719fc56fbe268282f786e49c0 100644
|
| --- a/components/arc/arc_bridge_bootstrap.cc
|
| +++ b/components/arc/arc_bridge_bootstrap.cc
|
| @@ -32,17 +32,15 @@
|
|
|
| namespace arc {
|
|
|
| -namespace {
|
| +// This assumes all video accelerator clients are from the same namespace and
|
| +// the max pid of the said namespace is kPidMask.
|
| +base::ProcessHandle RemapChildPid(base::ProcessHandle pid) {
|
| + uint32_t kPidBase = 0x3DE0EA7C; // arbitrarily chosen.
|
| + uint32_t kPidMask = 0x7fff; // the default, 32k.
|
| + return kPidBase + (pid & kPidMask);
|
| +}
|
|
|
| -// We do not know the PID of ARC, since Chrome does not create it directly.
|
| -// Since Mojo in POSIX does not use the child PID except as an unique
|
| -// identifier for the routing table, rather than doing a lot of plumbing in the
|
| -// whole system to get the correct PID, just use an arbitrary number that will
|
| -// never be used by a legitimate process. Chrome OS assigns unassigned PIDs
|
| -// sequentially until it reaches a certain maximum value (Chrome OS uses the
|
| -// default value of 32k), at which point it loops around to zero. An arbitrary
|
| -// number larger than the maximum should be safe.
|
| -const pid_t kArcPid = 0x3DE0EA7C;
|
| +namespace {
|
|
|
| const base::FilePath::CharType kArcBridgeSocketPath[] =
|
| FILE_PATH_LITERAL("/var/run/chrome/arc_bridge.sock");
|
| @@ -260,6 +258,11 @@ base::ScopedFD ArcBridgeBootstrapImpl::AcceptInstanceConnection(
|
| }
|
| base::ScopedFD scoped_fd(raw_fd);
|
|
|
| + // We do not know the PID of ARC, since Chrome does not create it directly
|
| + // and it may in the difference namespace. Here we assume the pid is zero
|
| + // (should not happen in its namespace) and RemapChildPid to safe range (not
|
| + // conflict in our namespace).
|
| + const base::ProcessHandle kArcPid = RemapChildPid(0);
|
| mojo::edk::ScopedPlatformHandle child_handle =
|
| mojo::edk::ChildProcessLaunched(kArcPid);
|
|
|
|
|