private static ChildProcessConnection allocateConnection( Context context, boolean inSandbox, ChromiumLinkerParams chromiumLinkerParams, boolean alwaysInForeground) { ChildProcessConnection.DeathCallback deathCallback = new ChildProcessConnection.DeathCallback() { @Override public void onChildProcessDied(ChildProcessConnection connection) { if (connection.getPid() != 0) { stop(connection.getPid()); } else { freeConnection(connection); } } }; initConnectionAllocatorsIfNecessary(context); return getConnectionAllocator(inSandbox) .allocate(context, deathCallback, chromiumLinkerParams, alwaysInForeground); }
/** @return the count of sandboxed connections managed by the allocator */ @VisibleForTesting static int allocatedConnectionsCountForTesting(Context context) { initConnectionAllocatorsIfNecessary(context); return sSandboxedChildConnectionAllocator.allocatedConnectionsCountForTesting(); }