Skip to content

Commit

Permalink
Remove ability to register multiple ChildProcessCreationParams object…
Browse files Browse the repository at this point in the history
…s part 4

This CL removes the org.chromium.content.browser.SANDBOXED_SERVICES_NAME
<meta-data> key. The <meta-data> key used to be necessary because we needed
to lookup the name of the sandboxed service in the WebAPK. Now that we are
removing this functionality, the <meta-data> key is no longer needed.

Bug=797999

R=slan@, jcivelli@, boliu@, yfriedman@
TBR=tedchoc@ for //components/test/android

Change-Id: Ibcc524d4952da7443214aeec6d308f209732d3ff
Reviewed-on: https://chromium-review.googlesource.com/887383
Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Stephen Lanham <slan@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Jay Civelli <jcivelli@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535202}
  • Loading branch information
pkotwicz authored and Commit Bot committed Feb 8, 2018
1 parent 28e4149 commit 679a628
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 55 deletions.
2 changes: 0 additions & 2 deletions android_webview/apk/java/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@
<meta-data android:name="com.android.webview.WebViewDonorPackage"
android:value="{{ donor_package }}" />
{% endif %}
<meta-data android:name="org.chromium.content.browser.SANDBOXED_SERVICES_NAME"
android:value="org.chromium.content.app.SandboxedProcessService"/>
{% set num_sandboxed_services = 20 %}
<meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
android:value="{{ num_sandboxed_services }}"/>
Expand Down
2 changes: 0 additions & 2 deletions android_webview/test/shell/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
</activity>
<provider android:name="org.chromium.android_webview.test.TestContentProvider"
android:authorities="org.chromium.android_webview.test.TestContentProvider" />
<meta-data android:name="org.chromium.content.browser.SANDBOXED_SERVICES_NAME"
android:value="org.chromium.content.app.SandboxedProcessService"/>
<!-- Some tests require 3 sandboxed services -->
<meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
android:value="3"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,14 @@ public ChildProcessConnection createConnection(Context context, ComponentName se
* AndroidManifest.xml.
*/
public static ChildConnectionAllocator create(Context context, Handler launcherHandler,
String packageName, String serviceClassNameManifestKey,
String numChildServicesManifestKey, boolean bindToCaller, boolean bindAsExternalService,
boolean useStrongBinding) {
String serviceClassName = null;
String packageName, String serviceClassName, String numChildServicesManifestKey,
boolean bindToCaller, boolean bindAsExternalService, boolean useStrongBinding) {
int numServices = -1;
PackageManager packageManager = context.getPackageManager();
try {
ApplicationInfo appInfo =
packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
if (appInfo.metaData != null) {
serviceClassName = appInfo.metaData.getString(serviceClassNameManifestKey);
numServices = appInfo.metaData.getInt(numChildServicesManifestKey, -1);
}
} catch (PackageManager.NameNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private MultiprocessTestClientLauncher(String[] commandLine, FileDescriptorInfo[
if (sConnectionAllocator == null) {
sConnectionAllocator = ChildConnectionAllocator.create(
ContextUtils.getApplicationContext(), sLauncherHandler,
"org.chromium.native_test", "org.chromium.native_test.TEST_CLIENT_SERVICE_NAME",
"org.chromium.native_test", "org.chromium.base.MultiprocessTestClientService",
"org.chromium.native_test.NUM_TEST_CLIENT_SERVICES", false /* bindToCaller */,
false /* bindAsExternalService */, false /* useStrongBinding */);
}
Expand Down
4 changes: 0 additions & 4 deletions chrome/android/java/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1033,8 +1033,6 @@ by a child template that "extends" this file.
{% set num_sandboxed_services = 20 %}
<meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
android:value="{{ num_sandboxed_services }}"/>
<meta-data android:name="org.chromium.content.browser.SANDBOXED_SERVICES_NAME"
android:value="org.chromium.content.app.SandboxedProcessService"/>

{% for i in range(num_sandboxed_services) %}
<!-- When use_order_profiling is set, the renderer processes need to be
Expand All @@ -1060,8 +1058,6 @@ by a child template that "extends" this file.
{% set num_privileged_services = 3 %}
<meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
android:value="{{ num_privileged_services }}"/>
<meta-data android:name="org.chromium.content.browser.PRIVILEGED_SERVICES_NAME"
android:value="org.chromium.content.app.PrivilegedProcessService"/>

{% for i in range(num_privileged_services) %}
{% set privileged_process_name = ':privileged_process%d' % i %}
Expand Down
4 changes: 0 additions & 4 deletions chromecast/browser/android/apk/AndroidManifest.xml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
{% set num_sandboxed_services = 20 %}
<meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
android:value="{{ num_sandboxed_services }}"/>
<meta-data android:name="org.chromium.content.browser.SANDBOXED_SERVICES_NAME"
android:value="org.chromium.content.app.SandboxedProcessService"/>

{% for i in range(num_sandboxed_services) %}
<service android:name="org.chromium.content.app.SandboxedProcessService{{ i }}"
Expand All @@ -50,8 +48,6 @@
{% set num_privileged_services = 3 %}
<meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
android:value="{{ num_privileged_services }}"/>
<meta-data android:name="org.chromium.content.browser.PRIVILEGED_SERVICES_NAME"
android:value="org.chromium.content.app.PrivilegedProcessService"/>

{% for i in range(num_privileged_services) %}
<service android:name="org.chromium.content.app.PrivilegedProcessService{{ i }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
{% set num_sandboxed_services = 20 %}
<meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
android:value="{{ num_sandboxed_services }}"/>
<meta-data android:name="org.chromium.content.browser.SANDBOXED_SERVICES_NAME"
android:value="org.chromium.content.app.SandboxedProcessService"/>

{% for i in range(num_sandboxed_services) %}
<service android:name="org.chromium.content.app.SandboxedProcessService{{ i }}"
Expand All @@ -54,8 +52,6 @@
{% set num_privileged_services = 3 %}
<meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
android:value="{{ num_privileged_services }}"/>
<meta-data android:name="org.chromium.content.browser.PRIVILEGED_SERVICES_NAME"
android:value="org.chromium.content.app.PrivilegedProcessService"/>

{% for i in range(num_privileged_services) %}
<service android:name="org.chromium.content.app.PrivilegedProcessService{{ i }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ public class ChildProcessLauncherHelper {
// Manifest values used to specify the service names.
private static final String NUM_SANDBOXED_SERVICES_KEY =
"org.chromium.content.browser.NUM_SANDBOXED_SERVICES";
private static final String SANDBOXED_SERVICES_NAME_KEY =
"org.chromium.content.browser.SANDBOXED_SERVICES_NAME";
private static final String SANDBOXED_SERVICES_NAME =
"org.chromium.content.app.SandboxedProcessService";
private static final String NUM_PRIVILEGED_SERVICES_KEY =
"org.chromium.content.browser.NUM_PRIVILEGED_SERVICES";
private static final String PRIVILEGED_SERVICES_NAME_KEY =
"org.chromium.content.browser.PRIVILEGED_SERVICES_NAME";
private static final String PRIVILEGED_SERVICES_NAME =
"org.chromium.content.app.PrivilegedProcessService";

// A warmed-up connection to a sandboxed service.
private static SpareChildConnection sSpareSandboxedConnection;
Expand Down Expand Up @@ -314,10 +314,10 @@ static ChildConnectionAllocator getConnectionAllocator(Context context, boolean

if (!sandboxed) {
if (sPrivilegedChildConnectionAllocator == null) {
sPrivilegedChildConnectionAllocator = ChildConnectionAllocator.create(context,
LauncherThread.getHandler(), packageName, PRIVILEGED_SERVICES_NAME_KEY,
NUM_PRIVILEGED_SERVICES_KEY, bindToCaller, bindAsExternalService,
true /* useStrongBinding */);
sPrivilegedChildConnectionAllocator =
ChildConnectionAllocator.create(context, LauncherThread.getHandler(),
packageName, PRIVILEGED_SERVICES_NAME, NUM_PRIVILEGED_SERVICES_KEY,
bindToCaller, bindAsExternalService, true /* useStrongBinding */);
}
return sPrivilegedChildConnectionAllocator;
}
Expand All @@ -337,10 +337,10 @@ static ChildConnectionAllocator getConnectionAllocator(Context context, boolean
serviceName, sSandboxedServicesCountForTesting, bindToCaller,
bindAsExternalService, false /* useStrongBinding */);
} else {
connectionAllocator = ChildConnectionAllocator.create(context,
LauncherThread.getHandler(), packageName, SANDBOXED_SERVICES_NAME_KEY,
NUM_SANDBOXED_SERVICES_KEY, bindToCaller, bindAsExternalService,
false /* useStrongBinding */);
connectionAllocator =
ChildConnectionAllocator.create(context, LauncherThread.getHandler(),
packageName, SANDBOXED_SERVICES_NAME, NUM_SANDBOXED_SERVICES_KEY,
bindToCaller, bindAsExternalService, false /* useStrongBinding */);
}
if (sSandboxedServiceFactoryForTesting != null) {
connectionAllocator.setConnectionFactoryForTesting(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public class ChildProcessLauncherTest {
private static final long CONDITION_WAIT_TIMEOUT_MS = 5000;

private static final String SERVICE_PACKAGE_NAME = "org.chromium.content_shell_apk";
private static final String SERVICE_NAME_META_DATA_KEY =
"org.chromium.content.browser.TEST_SERVICES_NAME";
private static final String SERVICE_NAME =
"org.chromium.content_shell_apk.TestChildProcessService";
private static final String SERVICE_COUNT_META_DATA_KEY =
"org.chromium.content.browser.NUM_TEST_SERVICES";

Expand Down Expand Up @@ -107,9 +107,9 @@ public void setUp() throws Exception {
public ChildConnectionAllocator call() {
Context context = InstrumentationRegistry.getTargetContext();
return ChildConnectionAllocator.create(context, LauncherThread.getHandler(),
SERVICE_PACKAGE_NAME, SERVICE_NAME_META_DATA_KEY,
SERVICE_COUNT_META_DATA_KEY, false /* bindToCaller */,
false /* bindAsExternalService */, false /* useStrongBinding */);
SERVICE_PACKAGE_NAME, SERVICE_NAME, SERVICE_COUNT_META_DATA_KEY,
false /* bindToCaller */, false /* bindAsExternalService */,
false /* useStrongBinding */);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
{% set num_sandboxed_services = 20 %}
<meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
android:value="{{ num_sandboxed_services }}"/>
<meta-data android:name="org.chromium.content.browser.SANDBOXED_SERVICES_NAME"
android:value="org.chromium.content.app.SandboxedProcessService"/>
{% for i in range(num_sandboxed_services) %}
<service android:name="org.chromium.content.app.SandboxedProcessService{{ i }}"
android:process=":sandboxed_process{{ i }}"
Expand All @@ -53,8 +51,6 @@
{% set num_privileged_services = 3 %}
<meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
android:value="{{ num_privileged_services }}"/>
<meta-data android:name="org.chromium.content.browser.PRIVILEGED_SERVICES_NAME"
android:value="org.chromium.content.app.PrivilegedProcessService"/>
{% for i in range(num_privileged_services) %}
<service android:name="org.chromium.content.app.PrivilegedProcessService{{ i }}"
android:process=":privileged_process{{ i }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
{% set num_sandboxed_services = 20 %}
<meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
android:value="{{ num_sandboxed_services }}"/>
<meta-data android:name="org.chromium.content.browser.SANDBOXED_SERVICES_NAME"
android:value="org.chromium.content.app.SandboxedProcessService"/>
{% for i in range(num_sandboxed_services) %}
<service android:name="org.chromium.content.app.SandboxedProcessService{{ i }}"
android:process=":sandboxed_process{{ i }}"
Expand All @@ -52,8 +50,6 @@
{% set num_privileged_services = 3 %}
<meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
android:value="{{ num_privileged_services }}"/>
<meta-data android:name="org.chromium.content.browser.PRIVILEGED_SERVICES_NAME"
android:value="org.chromium.content.app.PrivilegedProcessService"/>
{% for i in range(num_privileged_services) %}
<service android:name="org.chromium.content.app.PrivilegedProcessService{{ i }}"
android:process=":privileged_process{{ i }}"
Expand Down
6 changes: 0 additions & 6 deletions content/shell/android/shell_apk/AndroidManifest.xml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
{% set num_sandboxed_services = 20 %}
<meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
android:value="{{ num_sandboxed_services }}"/>
<meta-data android:name="org.chromium.content.browser.SANDBOXED_SERVICES_NAME"
android:value="org.chromium.content.app.SandboxedProcessService"/>
{% for i in range(num_sandboxed_services) %}
<service android:name="org.chromium.content.app.SandboxedProcessService{{ i }}"
android:process=":sandboxed_process{{ i }}"
Expand All @@ -54,8 +52,6 @@
{% set num_privileged_services = 3 %}
<meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
android:value="{{ num_privileged_services }}"/>
<meta-data android:name="org.chromium.content.browser.PRIVILEGED_SERVICES_NAME"
android:value="org.chromium.content.app.PrivilegedProcessService"/>
{% for i in range(num_privileged_services) %}
<service android:name="org.chromium.content.app.PrivilegedProcessService{{ i }}"
android:process=":privileged_process{{ i }}"
Expand All @@ -73,8 +69,6 @@
{% set num_test_services = 2 %}
<meta-data android:name="org.chromium.content.browser.NUM_TEST_SERVICES"
android:value="{{ num_test_services }}"/>
<meta-data android:name="org.chromium.content.browser.TEST_SERVICES_NAME"
android:value="org.chromium.content_shell_apk.TestChildProcessService"/>
{% for i in range(num_test_services) %}
<service android:name="org.chromium.content_shell_apk.TestChildProcessService{{ i }}"
android:process=":test_child_service_process{{ i }}"
Expand Down
2 changes: 0 additions & 2 deletions testing/android/native_test/java/AndroidManifest.xml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ found in the LICENSE file.
{% set num_test_client_services = 5 %}
<meta-data android:name="org.chromium.native_test.NUM_TEST_CLIENT_SERVICES"
android:value="{{ num_test_client_services }}"/>
<meta-data android:name="org.chromium.native_test.TEST_CLIENT_SERVICE_NAME"
android:value="org.chromium.base.MultiprocessTestClientService"/>
{% for i in range(num_test_client_services) %}
<service android:name="org.chromium.base.MultiprocessTestClientService{{ i }}"
android:process=":test_client_process{{ i }}"
Expand Down

0 comments on commit 679a628

Please sign in to comment.