Commit 41e4c6c3 authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

Allow building with isolated splits enabled without chrome module

This will allow testing with only isolated splits enabled, which will be
a useful configuration for perf testing, and a backup plan if the chrome
module ends up needing more work.

Bug: 1151538
Change-Id: I2db5ec610d9f1c21c0b9bca607cf51ad6ad3b85a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2553222Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830826}
parent 9843cc2b
...@@ -526,11 +526,13 @@ template("monochrome_public_common_apk_or_module_tmpl") { ...@@ -526,11 +526,13 @@ template("monochrome_public_common_apk_or_module_tmpl") {
} }
} }
# Sets ISOLATED_SPLITS_ENABLED in BuildConfig.java.
if (_is_bundle_module) {
isolated_splits_enabled = enable_isolated_splits
}
# Add all loadable modules and shared libraries from DFMs. # Add all loadable modules and shared libraries from DFMs.
if (_enable_chrome_module) { if (_enable_chrome_module) {
# Sets ISOLATED_SPLITS_ENABLED in BuildConfig.java.
isolated_splits_enabled = true
# The arcore manifest needs to be merged into the base module because the Play # The arcore manifest needs to be merged into the base module because the Play
# Store verifies the com.google.ar.core.min_apk_version meta-data tag is in # Store verifies the com.google.ar.core.min_apk_version meta-data tag is in
# the base manifest. # the base manifest.
......
...@@ -14,7 +14,8 @@ by a child template that "extends" this file. ...@@ -14,7 +14,8 @@ by a child template that "extends" this file.
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="{{ manifest_package }}" package="{{ manifest_package }}"
{% set definitions_in_split = definitions_in_split|default(0) == 'true' %} {% set definitions_in_split = definitions_in_split|default(0) == 'true' %}
{% if definitions_in_split %} {% set enable_isolated_splits = enable_isolated_splits|default(0) == 'true' %}
{% if enable_isolated_splits %}
android:isolatedSplits="true" android:isolatedSplits="true"
{% endif %} {% endif %}
tools:ignore="MissingVersion"> tools:ignore="MissingVersion">
...@@ -154,7 +155,7 @@ by a child template that "extends" this file. ...@@ -154,7 +155,7 @@ by a child template that "extends" this file.
<!-- Set android:largeHeap to "true" to allow more than the default <!-- Set android:largeHeap to "true" to allow more than the default
Java heap limit (32Mb on Nexus S, 48Mb on Xoom). --> Java heap limit (32Mb on Nexus S, 48Mb on Xoom). -->
<application android:name="{% block application_name %} <application android:name="{% block application_name %}
{%- if definitions_in_split -%} {%- if enable_isolated_splits -%}
org.chromium.chrome.browser.base.SplitChromeApplication org.chromium.chrome.browser.base.SplitChromeApplication
{%- else -%} {%- else -%}
org.chromium.chrome.browser.ChromeApplication org.chromium.chrome.browser.ChromeApplication
...@@ -177,7 +178,7 @@ by a child template that "extends" this file. ...@@ -177,7 +178,7 @@ by a child template that "extends" this file.
{% endif %} {% endif %}
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:allowAudioPlaybackCapture="false" android:allowAudioPlaybackCapture="false"
{% if definitions_in_split %} {% if enable_isolated_splits %}
android:appComponentFactory="org.chromium.chrome.browser.base.SplitCompatAppComponentFactory" android:appComponentFactory="org.chromium.chrome.browser.base.SplitCompatAppComponentFactory"
{% endif %} {% endif %}
{% block extra_application_attributes %}{% endblock %}> {% block extra_application_attributes %}{% endblock %}>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
## ##
{% block application_name %} {% block application_name %}
{%- if definitions_in_split -%} {%- if enable_isolated_splits -%}
org.chromium.chrome.browser.base.SplitMonochromeApplication org.chromium.chrome.browser.base.SplitMonochromeApplication
{%- else -%} {%- else -%}
org.chromium.chrome.browser.MonochromeApplication org.chromium.chrome.browser.MonochromeApplication
......
...@@ -18,6 +18,7 @@ import org.chromium.base.annotations.IdentifierNameString; ...@@ -18,6 +18,7 @@ import org.chromium.base.annotations.IdentifierNameString;
/** Utils for compatibility with isolated splits. */ /** Utils for compatibility with isolated splits. */
public class SplitCompatUtils { public class SplitCompatUtils {
private static final String CHROME_SPLIT_NAME = "chrome";
private static final ArraySet<ClassLoader> sInflationClassLoaders = new ArraySet<>(); private static final ArraySet<ClassLoader> sInflationClassLoaders = new ArraySet<>();
private SplitCompatUtils() {} private SplitCompatUtils() {}
...@@ -33,7 +34,10 @@ public class SplitCompatUtils { ...@@ -33,7 +34,10 @@ public class SplitCompatUtils {
/** Creates a context which can be used to load code and resources in the chrome split. */ /** Creates a context which can be used to load code and resources in the chrome split. */
public static Context createChromeContext(Context base) { public static Context createChromeContext(Context base) {
return BundleUtils.createIsolatedSplitContext(base, "chrome"); if (!BundleUtils.isIsolatedSplitInstalled(base, CHROME_SPLIT_NAME)) {
return base;
}
return BundleUtils.createIsolatedSplitContext(base, CHROME_SPLIT_NAME);
} }
/** /**
......
...@@ -21,6 +21,12 @@ declare_args() { ...@@ -21,6 +21,12 @@ declare_args() {
enable_chrome_child_modules = true enable_chrome_child_modules = true
} }
declare_args() {
# Whether isolated splits are enabled. This can be enabled/disabled separately
# from enable_chrome_module to test performance in various configurations.
enable_isolated_splits = enable_chrome_module
}
# If true, lld is used to partition feature code into separate libraries, which # If true, lld is used to partition feature code into separate libraries, which
# in turn are included in Dynamic Feature Modules. # in turn are included in Dynamic Feature Modules.
use_native_partitions = is_android && is_clang && use_lld && !is_component_build use_native_partitions = is_android && is_clang && use_lld && !is_component_build
...@@ -2,10 +2,13 @@ ...@@ -2,10 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/android/modules/buildflags.gni")
use_32bit_abi_jinja_variable = "use32bitAbi=android:use32bitAbi=\"true\"" use_32bit_abi_jinja_variable = "use32bitAbi=android:use32bitAbi=\"true\""
monochrome_android_manifest_jinja_variables = [ monochrome_android_manifest_jinja_variables = [
"min_sdk_version=24", "min_sdk_version=24",
"sandboxed_service_exported=true", "sandboxed_service_exported=true",
use_32bit_abi_jinja_variable, use_32bit_abi_jinja_variable,
"enable_isolated_splits=$enable_isolated_splits",
] ]
...@@ -6,6 +6,7 @@ import("//build/config/android/config.gni") ...@@ -6,6 +6,7 @@ import("//build/config/android/config.gni")
import("//build/config/android/rules.gni") import("//build/config/android/rules.gni")
import("//build/util/version.gni") import("//build/util/version.gni")
import("//chrome/android/chrome_public_apk_tmpl.gni") import("//chrome/android/chrome_public_apk_tmpl.gni")
import("//chrome/android/modules/buildflags.gni")
if (!defined(default_trichrome_certdigest)) { if (!defined(default_trichrome_certdigest)) {
default_trichrome_certdigest = default_trichrome_certdigest =
...@@ -32,6 +33,7 @@ trichrome_jinja_variables = [ ...@@ -32,6 +33,7 @@ trichrome_jinja_variables = [
"trichrome_library=$trichrome_library_package", "trichrome_library=$trichrome_library_package",
"trichrome_certdigest=$trichrome_certdigest", "trichrome_certdigest=$trichrome_certdigest",
"use32bitAbi=android:use32bitAbi=\"true\"", "use32bitAbi=android:use32bitAbi=\"true\"",
"enable_isolated_splits=$enable_isolated_splits",
] ]
trichrome_synchronized_proguard = trichrome_synchronized_proguard =
......
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