Commit 9ffb198d authored by sievers's avatar sievers Committed by Commit bot

Android: Allow sandboxed utility process

DCHECK() that it was not launched with DisableSandbox().

The utility process is used for sandboxed image decoding
(and probably only that) on Android.

BUG=396568
NOTRY=True

Review URL: https://codereview.chromium.org/800993003

Cr-Commit-Position: refs/heads/master@{#308162}
parent 18a4639a
...@@ -181,11 +181,17 @@ void ChildProcessLauncher::Context::Launch( ...@@ -181,11 +181,17 @@ void ChildProcessLauncher::Context::Launch(
client_ = client; client_ = client;
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// We currently only support renderer and gpu child processes. // Android only supports renderer, sandboxed utility and gpu.
std::string process_type = std::string process_type =
cmd_line->GetSwitchValueASCII(switches::kProcessType); cmd_line->GetSwitchValueASCII(switches::kProcessType);
CHECK(process_type == switches::kGpuProcess || CHECK(process_type == switches::kGpuProcess ||
process_type == switches::kRendererProcess); process_type == switches::kRendererProcess ||
process_type == switches::kUtilityProcess)
<< "Unsupported process type: " << process_type;
// Non-sandboxed utility or renderer process are currently not supported.
DCHECK(process_type == switches::kGpuProcess ||
!cmd_line->HasSwitch(switches::kNoSandbox));
// We need to close the client end of the IPC channel to reliably detect // We need to close the client end of the IPC channel to reliably detect
// child termination. We will close this fd after we create the child // child termination. We will close this fd after we create the child
......
...@@ -40,9 +40,11 @@ public class ChildProcessLauncher { ...@@ -40,9 +40,11 @@ public class ChildProcessLauncher {
static final int CALLBACK_FOR_UNKNOWN_PROCESS = 0; static final int CALLBACK_FOR_UNKNOWN_PROCESS = 0;
static final int CALLBACK_FOR_GPU_PROCESS = 1; static final int CALLBACK_FOR_GPU_PROCESS = 1;
static final int CALLBACK_FOR_RENDERER_PROCESS = 2; static final int CALLBACK_FOR_RENDERER_PROCESS = 2;
static final int CALLBACK_FOR_UTILITY_PROCESS = 3;
private static final String SWITCH_PROCESS_TYPE = "type"; private static final String SWITCH_PROCESS_TYPE = "type";
private static final String SWITCH_RENDERER_PROCESS = "renderer"; private static final String SWITCH_RENDERER_PROCESS = "renderer";
private static final String SWITCH_UTILITY_PROCESS = "utility";
private static final String SWITCH_GPU_PROCESS = "gpu-process"; private static final String SWITCH_GPU_PROCESS = "gpu-process";
private static class ChildConnectionAllocator { private static class ChildConnectionAllocator {
...@@ -403,6 +405,9 @@ public class ChildProcessLauncher { ...@@ -403,6 +405,9 @@ public class ChildProcessLauncher {
} else if (SWITCH_GPU_PROCESS.equals(processType)) { } else if (SWITCH_GPU_PROCESS.equals(processType)) {
callbackType = CALLBACK_FOR_GPU_PROCESS; callbackType = CALLBACK_FOR_GPU_PROCESS;
inSandbox = false; inSandbox = false;
} else if (SWITCH_UTILITY_PROCESS.equals(processType)) {
// We only support sandboxed right now.
callbackType = CALLBACK_FOR_UTILITY_PROCESS;
} else { } else {
assert false; assert false;
} }
...@@ -459,9 +464,7 @@ public class ChildProcessLauncher { ...@@ -459,9 +464,7 @@ public class ChildProcessLauncher {
} }
}; };
// TODO(sievers): Revisit this as it doesn't correctly handle the utility process assert callbackType != CALLBACK_FOR_UNKNOWN_PROCESS;
// assert callbackType != CALLBACK_FOR_UNKNOWN_PROCESS;
connection.setupConnection(commandLine, connection.setupConnection(commandLine,
filesToBeMapped, filesToBeMapped,
createCallback(childProcessId, callbackType), createCallback(childProcessId, callbackType),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment