Commit d8b8f747 authored by Benoît Lizé's avatar Benoît Lizé Committed by Commit Bot

android: Introduce ProductConfig and use it for Locales and Linker.

ProductConfig is a class used for product-specific configuration. This is
specifically targeted at providing different settings for TrichromeChrome and
TrichromeWebView, without interfering with synchronized proguarding.

This CL contains two things:
1. Renaming LocaleConfig -> ProductConfig, as it is used more broadly than Locales
2. Adding support for setting up the linker with it.

The second point is required as TrichromeWebView must not be loaded with the
Chromium linker, yet the configuration class currently lives in //base, which is
in the library APK.

To ease the migration, some targets still use the "default" configuration, which
falls back to the existing mechanism, using NativeLibraries.java in base/android.

Change-Id: Id034b1b24d3aee836442253c4b398231271ca107
Bug: 979638
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1886682
Commit-Queue: Benoit L <lizeb@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713410}
parent ff3924cb
......@@ -778,20 +778,20 @@ android_library("common_aidl_java") {
srcjar_deps = [ ":common_aidl" ]
}
# Generate LocaleConfig.java so that android_webview_locale_config_java's
# Generate ProductConfig.java so that android_webview_product_config_java's
# compile step works.
generate_locale_config_srcjar("webview_locale_config") {
java_package = webview_locale_config_java_package
generate_product_config_srcjar("webview_product_config") {
java_package = webview_product_config_java_package
}
# LocaleConfig.java is excluded from the generated .jar
# ProductConfig.java is excluded from the generated .jar
# (via. jar_excluded_patterns) and the final version is inserted at the APK
# level - with the list of pak locales populated by looking at the assets that
# are listed in the final APK's .build_config.
android_library("android_webview_locale_config_java") {
android_library("android_webview_product_config_java") {
java_files = [ "java/src/org/chromium/android_webview/AwLocaleConfig.java" ]
srcjar_deps = [ ":webview_locale_config" ]
jar_excluded_patterns = [ "*/LocaleConfig.class" ]
srcjar_deps = [ ":webview_product_config" ]
jar_excluded_patterns = [ "*/ProductConfig.class" ]
}
if (public_android_sdk) {
......
......@@ -24,7 +24,7 @@ android_library("apk_java") {
deps = [
":devui_java",
":services_java",
"//android_webview:android_webview_locale_config_java",
"//android_webview:android_webview_product_config_java",
"//android_webview:common_commandline_java",
"//base:base_java",
"//base:jni_java",
......
......@@ -10,7 +10,7 @@ import("//build/config/android/rules.gni")
android_library("glue") {
deps = [
"//android_webview:android_webview_java",
"//android_webview:android_webview_locale_config_java",
"//android_webview:android_webview_product_config_java",
"//android_webview:common_commandline_java",
"//android_webview:common_java",
"//android_webview/apk:system_webview_manifest",
......
......@@ -12,6 +12,6 @@ public final class AwLocaleConfig {
private AwLocaleConfig() {}
public static String[] getWebViewSupportedPakLocales() {
return LocaleConfig.UNCOMPRESSED_LOCALES;
return ProductConfig.UNCOMPRESSED_LOCALES;
}
}
......@@ -34,9 +34,9 @@ template("system_webview_apk_tmpl") {
]
target_sdk_version = android_sdk_version
locale_config_java_packages = [
webview_locale_config_java_package,
weblayer_locale_config_java_package,
product_config_java_packages = [
webview_product_config_java_package,
weblayer_product_config_java_package,
]
if (!defined(alternative_android_sdk_dep)) {
......@@ -87,14 +87,14 @@ template("system_webview_apk_tmpl") {
}
} else {
shared_libraries = [ "//android_webview:monochrome" ]
deps += [
"//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline",
]
loadable_modules = [ "$root_out_dir/libcrashpad_handler_trampoline.so" ]
deps += [ "//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline" ]
loadable_modules =
[ "$root_out_dir/libcrashpad_handler_trampoline.so" ]
if (build_apk_secondary_abi) {
secondary_native_lib_placeholders = [ "libdummy.so" ]
if (use_v8_context_snapshot) {
deps += [ "//tools/v8_context_snapshot:v8_context_snapshot_assets" ]
deps +=
[ "//tools/v8_context_snapshot:v8_context_snapshot_assets" ]
} else {
deps += [ "//v8:v8_external_startup_data_assets" ]
}
......
......@@ -61,7 +61,7 @@ android_apk("webview_instrumentation_apk") {
":webview_instrumentation_apk_resources",
":webview_instrumentation_test_utils_java",
"//android_webview:android_webview_java",
"//android_webview:android_webview_locale_config_java",
"//android_webview:android_webview_product_config_java",
"//android_webview:common_java",
"//android_webview:locale_pak_assets",
"//android_webview:platform_service_bridge_upstream_implementation_java",
......@@ -92,7 +92,7 @@ android_apk("webview_instrumentation_apk") {
"shell/src/org/chromium/android_webview/test/OnlyRunIn.java",
"shell/src/org/chromium/android_webview/test/TestContentProvider.java",
]
locale_config_java_packages = [ webview_locale_config_java_package ]
product_config_java_packages = [ webview_product_config_java_package ]
shared_libraries = [ ":libstandalonelibwebviewchromium" ]
......
......@@ -11,12 +11,11 @@ system_webview_android_manifest =
"$root_gen_dir/android_webview/system_webview_apk/AndroidManifest.xml"
trichrome_webview_android_manifest =
"$root_gen_dir/android_webview/trichrome_webview_apk/AndroidManifest.xml"
trichrome_webview_64_32_android_manifest =
"$root_gen_dir/android_webview/trichrome_webview_64_32_apk/AndroidManifest.xml"
trichrome_webview_64_32_android_manifest = "$root_gen_dir/android_webview/trichrome_webview_64_32_apk/AndroidManifest.xml"
upstream_only_webview_deps = [
"//android_webview:platform_service_bridge_upstream_implementation_java",
"//android_webview/apk:icon_resources",
]
webview_locale_config_java_package = "org.chromium.android_webview"
webview_product_config_java_package = "org.chromium.android_webview"
......@@ -3363,7 +3363,6 @@ if (is_android) {
"android/java/src/org/chromium/base/compat/ApiHelperForP.java",
"android/java/src/org/chromium/base/library_loader/LegacyLinker.java",
"android/java/src/org/chromium/base/library_loader/LibraryLoader.java",
"android/java/src/org/chromium/base/library_loader/LibraryLoaderConfig.java",
"android/java/src/org/chromium/base/library_loader/LibraryPrefetcher.java",
"android/java/src/org/chromium/base/library_loader/Linker.java",
"android/java/src/org/chromium/base/library_loader/LoaderErrors.java",
......
......@@ -62,9 +62,6 @@ import javax.annotation.concurrent.GuardedBy;
public class LibraryLoader {
private static final String TAG = "LibraryLoader";
// Set to true to enable debug logs.
private static final boolean DEBUG = false;
// Experience shows that on some devices, the PackageManager fails to properly extract
// native shared libraries to the /data partition at installation or upgrade time,
// which creates all kind of chaos (https://crbug.com/806998).
......@@ -104,6 +101,15 @@ public class LibraryLoader {
private NativeLibraryPreloader mLibraryPreloader;
private boolean mLibraryPreloaderCalled;
// Whether to use the Chromium linker vs system linker.
private boolean mUseChromiumLinker;
// Whether to use ModernLinker, vs LegacyLinker.
private boolean mUseModernLinker;
// Whether the configuration has been set.
private boolean mConfigurationSet;
// One-way switch becomes true when the libraries are loaded.
private boolean mLoaded;
......@@ -150,12 +156,56 @@ public class LibraryLoader {
}
}
@GuardedBy("mLock")
private void setConfigurationIfNeeded() {
if (mConfigurationSet) return;
// Cannot use initializers for the variables below, as this makes roboelectric tests fail,
// since they don't have a NativeLibraries class.
mUseChromiumLinker = NativeLibraries.sUseLinker;
mUseModernLinker = NativeLibraries.sUseModernLinker;
mConfigurationSet = true;
}
public static LibraryLoader getInstance() {
return sInstance;
}
private LibraryLoader() {}
/**
* Sets the configuration for library loading.
*
* Must be called before loading the library.
*
* @param useChromiumLinker Whether to use the chromium linker.
* @param useModernLinker Whether to use ModernLinker.
*/
public void setConfiguration(boolean useChromiumLinker, boolean useModernLinker) {
synchronized (mLock) {
assert !mInitialized;
mUseChromiumLinker = useChromiumLinker;
mUseModernLinker = useModernLinker;
Log.d(TAG, "Configuration, useChromiumLinker = %b, useModernLinker = %b",
mUseChromiumLinker, mUseModernLinker);
mConfigurationSet = true;
}
}
public boolean useChromiumLinker() {
return mUseChromiumLinker;
}
public boolean useModernLinker() {
return mUseModernLinker;
}
public boolean areTestsEnabled() {
return NativeLibraries.sEnableLinkerTests;
}
/**
* Return if library is already loaded successfully by the zygote.
*/
......@@ -193,7 +243,8 @@ public class LibraryLoader {
*/
public void preloadNowOverrideApplicationContext(Context appContext) {
synchronized (mLock) {
if (LibraryLoaderConfig.useChromiumLinker()) return;
setConfigurationIfNeeded();
if (mUseChromiumLinker) return;
preloadAlreadyLocked(appContext.getApplicationInfo());
}
}
......@@ -201,7 +252,7 @@ public class LibraryLoader {
private void preloadAlreadyLocked(ApplicationInfo appInfo) {
try (TraceEvent te = TraceEvent.scoped("LibraryLoader.preloadAlreadyLocked")) {
// Preloader uses system linker, we shouldn't preload if Chromium linker is used.
assert !LibraryLoaderConfig.useChromiumLinker();
assert !mUseChromiumLinker;
if (mLibraryPreloader != null && !mLibraryPreloaderCalled) {
mLibraryPreloader.loadLibrary(appInfo);
mLibraryPreloaderCalled = true;
......@@ -384,16 +435,19 @@ public class LibraryLoader {
try (TraceEvent te = TraceEvent.scoped("LibraryLoader.loadAlreadyLocked")) {
if (mLoaded) return;
assert !mInitialized;
setConfigurationIfNeeded();
long startTime = SystemClock.uptimeMillis();
if (LibraryLoaderConfig.useChromiumLinker() && !inZygote) {
if (mUseChromiumLinker && !inZygote) {
Log.d(TAG, "Loading with the Chromium linker.");
// See base/android/linker/config.gni, the chromium linker is only enabled when
// we have a single library.
assert NativeLibraries.LIBRARIES.length == 1;
String library = NativeLibraries.LIBRARIES[0];
loadWithChromiumLinker(appInfo, library);
} else {
Log.d(TAG, "Loading with the System linker.");
loadWithSystemLinkerAlreadyLocked(appInfo);
}
......@@ -552,7 +606,7 @@ public class LibraryLoader {
// Called after all native initializations are complete.
public void onBrowserNativeInitializationComplete() {
if (LibraryLoaderConfig.useChromiumLinker()) {
if (mUseChromiumLinker) {
RecordHistogram.recordTimesHistogram(
"ChromiumAndroidLinker.BrowserLoadTime", mLibraryLoadTimeMs);
}
......@@ -563,7 +617,7 @@ public class LibraryLoader {
// time they are captured. This function stores a pending value, so that a later call to
// RecordChromiumAndroidLinkerRendererHistogram() will record it correctly.
public void registerRendererProcessHistogram() {
if (!LibraryLoaderConfig.useChromiumLinker()) return;
if (!mUseChromiumLinker) return;
synchronized (mLock) {
LibraryLoaderJni.get().recordRendererLibraryLoadTime(mLibraryLoadTimeMs);
}
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.base.library_loader;
/**
* Build-time configuration of LibraryLoader.
* These are in a separate class from LibraryLoader to ensure that they are inlined.
*/
// TODO(agrieve): Add @CheckDiscard once trichrome no longer requires a -keep for NativeLibraries:
// https://cs.chromium.org/chromium/src/chrome/android/java/trichrome.flags?rcl=233c4879107285b519cb55b3e9a7f439b15a418f
public class LibraryLoaderConfig {
private LibraryLoaderConfig() {}
/**
* Check that native library linker tests are enabled.
* If not enabled, calls to testing functions will fail with an assertion
* error.
*
* @return true if native library linker tests are enabled.
*/
public static boolean areTestsEnabled() {
return NativeLibraries.sEnableLinkerTests;
}
/**
* Call this method to determine if this chromium project must
* use this linker. If not, System.loadLibrary() should be used to load
* libraries instead.
*/
public static boolean useChromiumLinker() {
return NativeLibraries.sUseLinker;
}
}
......@@ -248,7 +248,7 @@ public abstract class Linker {
ContextUtils.getApplicationContext().getApplicationInfo().className;
boolean isIncrementalInstall =
appClass != null && appClass.contains("incrementalinstall");
if (NativeLibraries.sUseModernLinker && !isIncrementalInstall) {
if (LibraryLoader.getInstance().useModernLinker() && !isIncrementalInstall) {
sSingleton = new ModernLinker();
} else {
sSingleton = new LegacyLinker();
......
......@@ -10,16 +10,16 @@ NATIVE_LIBRARIES_TEMPLATE = """\
package org.chromium.base.library_loader;
public class NativeLibraries {{
public static final int CPU_FAMILY_UNKNOWN = 0;
public static final int CPU_FAMILY_ARM = 1;
public static final int CPU_FAMILY_MIPS = 2;
public static final int CPU_FAMILY_X86 = 3;
static final int CPU_FAMILY_UNKNOWN = 0;
static final int CPU_FAMILY_ARM = 1;
static final int CPU_FAMILY_MIPS = 2;
static final int CPU_FAMILY_X86 = 3;
// Set to true to enable the use of the Chromium Linker.
public static {MAYBE_FINAL}boolean sUseLinker{USE_LINKER};
public static {MAYBE_FINAL}boolean sUseLibraryInZipFile{USE_LIBRARY_IN_ZIP_FILE};
public static {MAYBE_FINAL}boolean sEnableLinkerTests{ENABLE_LINKER_TESTS};
public static {MAYBE_FINAL}boolean sUseModernLinker{USE_MODERN_LINKER};
static {MAYBE_FINAL}boolean sUseLinker{USE_LINKER};
static {MAYBE_FINAL}boolean sUseLibraryInZipFile{USE_LIBRARY_IN_ZIP_FILE};
static {MAYBE_FINAL}boolean sEnableLinkerTests{ENABLE_LINKER_TESTS};
static {MAYBE_FINAL}boolean sUseModernLinker{USE_MODERN_LINKER};
// This is the list of native libraries to be loaded (in the correct order)
// by LibraryLoader.java.
......@@ -30,11 +30,8 @@ public class NativeLibraries {{
// This is the expected version of the 'main' native library, which is the one that
// implements the initial set of base JNI functions including
// base::android::nativeGetVersionName()
// TODO(torne): This is public to work around classloader issues in Trichrome
// where NativeLibraries is not in the same dex as LibraryLoader.
// We should instead split up Java code along package boundaries.
public static {MAYBE_FINAL}String sVersionNumber = {VERSION_NUMBER};
static {MAYBE_FINAL}String sVersionNumber = {VERSION_NUMBER};
public static {MAYBE_FINAL}int sCpuFamily = {CPU_FAMILY};
static {MAYBE_FINAL}int sCpuFamily = {CPU_FAMILY};
}}
"""
......@@ -4,10 +4,20 @@
package PACKAGE;
#if defined(USE_FINAL)
#define MAYBE_FINAL final
#define MAYBE_USE_CHROMIUM_LINKER = USE_CHROMIUM_LINKER_VALUE
#define MAYBE_USE_MODERN_LINKER = USE_MODERN_LINKER_VALUE
#else
#define MAYBE_FINAL
#define MAYBE_USE_CHROMIUM_LINKER
#define MAYBE_USE_MODERN_LINKER
#endif
/**
* Locale configuration. Generated on a per-target basis.
* Product configuration. Generated on a per-target basis.
*/
public class LocaleConfig {
public class ProductConfig {
// Sorted list of locales that have a compressed .pak within assets.
// Stored as an array because AssetManager.list() is slow.
......@@ -24,4 +34,7 @@ public class LocaleConfig {
#else
public static final String[] UNCOMPRESSED_LOCALES = {};
#endif
public static MAYBE_FINAL boolean USE_CHROMIUM_LINKER MAYBE_USE_CHROMIUM_LINKER;
public static MAYBE_FINAL boolean USE_MODERN_LINKER MAYBE_USE_MODERN_LINKER;
}
......@@ -1973,19 +1973,40 @@ if (enable_java_templates) {
}
}
# Creates LocaleConfig.java, a file containing the list of compressed and
# uncompressed locale .pak files in an APK.
# Creates ProductConfig.java, a file containing product-specific configuration.
#
# Currently, this includes the list of locales, both in their compressed and
# uncompressed format, as well as library loading
#
# Variables:
# build_config: Path to build_config used for locale lists.
# java_package: Java package for the generated class.
template("generate_locale_config_srcjar") {
# use_chromium_linker:
# use_modern_linker:
template("generate_product_config_srcjar") {
java_cpp_template(target_name) {
defines = []
_use_final = defined(invoker.build_config) ||
defined(invoker.use_chromium_linker) ||
defined(invoker.use_modern_linker)
if (_use_final) {
defines += [ "USE_FINAL" ]
}
package_path = string_replace(invoker.java_package, ".", "/")
sources = [
"//build/android/java/templates/LocaleConfig.template",
"//build/android/java/templates/ProductConfig.template",
]
defines += [ "PACKAGE=${invoker.java_package}" ]
_use_chromium_linker =
defined(invoker.use_chromium_linker) && invoker.use_chromium_linker
_use_modern_linker =
defined(invoker.use_modern_linker) && invoker.use_modern_linker
defines += [
"USE_CHROMIUM_LINKER_VALUE=$_use_chromium_linker",
"USE_MODERN_LINKER_VALUE=$_use_modern_linker",
]
defines = [ "PACKAGE=${invoker.java_package}" ]
if (defined(invoker.build_config)) {
forward_variables_from(invoker,
[
......@@ -2099,9 +2120,8 @@ if (enable_java_templates) {
# enable_native_mocks: Allow native calls using
# org.chromium.base.annotations.NativeMethods to be mocked in tests
# (optional).
# locale_config_java_packages: Optional list of java packages. If given, a
# LocaleConfig.java file will be generated for each package, and will
# contain the list of compressed and uncompressed locale pak files.
# product_config_java_packages: Optional list of java packages. If given, a
# ProductConfig.java file will be generated for each package.
# disable_r8_outlining: Turn off outlining during the proguard step.
# annotation_processor_deps: List of java_annotation_processor targets to
# use when compiling the java_files given to this target (optional).
......@@ -2316,7 +2336,7 @@ if (enable_java_templates) {
_generate_buildconfig_java = invoker.generate_buildconfig_java
}
_generate_localeconfig_java = defined(invoker.locale_config_java_packages)
_generate_productconfig_java = defined(invoker.product_config_java_packages)
# JNI generation usually goes hand-in-hand with buildconfig generation.
_generate_final_jni = _generate_buildconfig_java
......@@ -2699,13 +2719,15 @@ if (enable_java_templates) {
_srcjar_deps += [ ":${_template_name}__build_config_srcjar" ]
}
if (_generate_localeconfig_java) {
foreach(_package, invoker.locale_config_java_packages) {
if (_generate_productconfig_java) {
foreach(_package, invoker.product_config_java_packages) {
_locale_target_name =
"${_template_name}_${_package}__locale_config_srcjar"
generate_locale_config_srcjar("$_locale_target_name") {
"${_template_name}_${_package}__product_config_srcjar"
generate_product_config_srcjar("$_locale_target_name") {
build_config = _build_config
java_package = _package
use_chromium_linker = _use_chromium_linker
use_modern_linker = _use_modern_linker
deps = [
":$_build_config_target",
]
......@@ -3404,7 +3426,7 @@ if (enable_java_templates) {
"loadable_modules",
"manifest_package",
"max_sdk_version",
"locale_config_java_packages",
"product_config_java_packages",
"min_sdk_version",
"native_lib_placeholders",
"native_lib_version_arg",
......@@ -3528,7 +3550,7 @@ if (enable_java_templates) {
"jni_sources_blacklist",
"load_library_from_apk",
"loadable_modules",
"locale_config_java_packages",
"product_config_java_packages",
"manifest_package",
"max_sdk_version",
"min_sdk_version",
......@@ -3565,6 +3587,7 @@ if (enable_java_templates) {
"testonly",
"uncompress_shared_libraries",
"use_chromium_linker",
"use_modern_linker",
"verify_manifest",
"version_code",
"version_name",
......
......@@ -354,7 +354,7 @@ android_library("chrome_java") {
":chrome_android_java_enums_srcjar",
":chrome_android_java_switches_srcjar",
":chrome_android_java_google_api_keys_srcjar",
":chrome_locale_config",
":chrome_product_config",
":photo_picker_aidl",
":resource_id_javagen",
":sync_user_settings_enums_java",
......@@ -429,7 +429,7 @@ android_library("chrome_java") {
# can provide their own implementations.
jar_excluded_patterns = [
"*/AppHooksImpl.class",
"*/LocaleConfig.class",
"*/ProductConfig.class",
]
annotation_processor_deps = [
......@@ -445,7 +445,7 @@ android_library("chrome_java") {
java_files += share_java_sources
}
generate_locale_config_srcjar("chrome_locale_config") {
generate_product_config_srcjar("chrome_product_config") {
java_package = "org.chromium.chrome.browser"
}
......@@ -1738,6 +1738,8 @@ template("monochrome_public_apk_or_module_tmpl") {
"resource_ids_provider_dep",
"static_library_provider",
"target_type",
"use_chromium_linker",
"use_modern_linker",
"use_trichrome_library",
"verify_manifest",
"failed_manifest_expectation_file",
......
......@@ -164,7 +164,7 @@ template("chrome_public_common_apk_or_module_tmpl") {
]
if (!_is_monochrome) {
locale_config_java_packages = [ "org.chromium.chrome.browser" ]
product_config_java_packages = [ "org.chromium.chrome.browser" ]
}
# Use zh-TW strings for zh-HK (https://crbug.com/780847).
......@@ -339,10 +339,10 @@ template("monochrome_public_common_apk_or_module_tmpl") {
]
if (is_monochrome) {
locale_config_java_packages = [
product_config_java_packages = [
"org.chromium.chrome.browser",
webview_locale_config_java_package,
weblayer_locale_config_java_package,
webview_product_config_java_package,
weblayer_product_config_java_package,
]
if (android_64bit_target_cpu) {
# Build //android_webview:monochrome with the opposite bitness that
......
......@@ -22,6 +22,7 @@ import org.chromium.base.JNIUtils;
import org.chromium.base.PathUtils;
import org.chromium.base.TraceEvent;
import org.chromium.base.annotations.MainDex;
import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.memory.MemoryPressureMonitor;
import org.chromium.base.multidex.ChromiumMultiDexInstaller;
import org.chromium.base.task.AsyncTask;
......@@ -139,7 +140,9 @@ public class ChromeApplication extends Application {
AsyncTask.takeOverAndroidThreadPool();
JNIUtils.setClassLoader(getClassLoader());
ResourceBundle.setAvailablePakLocales(
LocaleConfig.COMPRESSED_LOCALES, LocaleConfig.UNCOMPRESSED_LOCALES);
ProductConfig.COMPRESSED_LOCALES, ProductConfig.UNCOMPRESSED_LOCALES);
LibraryLoader.getInstance().setConfiguration(
ProductConfig.USE_CHROMIUM_LINKER, ProductConfig.USE_MODERN_LINKER);
if (isBrowserProcess) {
TraceEvent.end("ChromeApplication.attachBaseContext");
......
......@@ -19,7 +19,7 @@ import org.junit.runner.RunWith;
import org.chromium.base.Log;
import org.chromium.base.compat.ApiHelperForM;
import org.chromium.base.library_loader.LibraryLoaderConfig;
import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.library_loader.LoadStatusRecorder.LoadLibraryStatus;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.test.util.CommandLineFlags;
......@@ -158,7 +158,7 @@ public class StartupLoadingMetricsTest {
assertHistogramsRecorded(1, TABBED_SUFFIX);
// LibraryLoader checks.
if (!LibraryLoaderConfig.useChromiumLinker()) {
if (!LibraryLoader.getInstance().useChromiumLinker()) {
Log.w(TAG, "Skipping test because not using ChromiumLinker.");
return;
}
......
......@@ -661,7 +661,7 @@ if (is_android) {
shared_libraries = [ "//chromecast/android:libcast_shell_android" ]
locale_config_java_packages = [ "org.chromium.chromecast.shell" ]
product_config_java_packages = [ "org.chromium.chromecast.shell" ]
deps = [
":cast_shell_apk_assets",
......
......@@ -112,7 +112,7 @@ android_library("reactive_android_java") {
]
}
generate_locale_config_srcjar("chromecast_locale_config") {
generate_product_config_srcjar("chromecast_product_config") {
java_package = "org.chromium.chromecast.shell"
}
......@@ -148,12 +148,12 @@ android_library("cast_shell_java") {
srcjar_deps = [
":cast_shell_build_config_gen",
":chromecast_locale_config",
":chromecast_product_config",
":logs_provider_aidl",
"//chromecast/browser:java_enums",
]
jar_excluded_patterns = [ "*/LocaleConfig.class" ]
jar_excluded_patterns = [ "*/ProductConfig.class" ]
deps = [
":cast_audio_manager_java",
......
......@@ -10,6 +10,7 @@ import android.content.Context;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.ContextUtils;
import org.chromium.base.PathUtils;
import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.ui.base.ResourceBundle;
/**
......@@ -28,7 +29,9 @@ public class CastApplication extends Application {
super.attachBaseContext(base);
ContextUtils.initApplicationContext(this);
ResourceBundle.setAvailablePakLocales(
LocaleConfig.COMPRESSED_LOCALES, LocaleConfig.UNCOMPRESSED_LOCALES);
ProductConfig.COMPRESSED_LOCALES, ProductConfig.UNCOMPRESSED_LOCALES);
LibraryLoader.getInstance().setConfiguration(
ProductConfig.USE_CHROMIUM_LINKER, ProductConfig.USE_MODERN_LINKER);
}
@Override
......
......@@ -20,7 +20,6 @@ import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.MainDex;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.library_loader.LibraryLoaderConfig;
import org.chromium.base.library_loader.Linker;
import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.base.memory.MemoryPressureUma;
......@@ -83,7 +82,7 @@ public class ContentChildProcessServiceDelegate implements ChildProcessServiceDe
mCpuFeatures = connectionBundle.getLong(ContentChildProcessConstants.EXTRA_CPU_FEATURES);
assert mCpuCount > 0;
if (LibraryLoaderConfig.useChromiumLinker()
if (LibraryLoader.getInstance().useChromiumLinker()
&& !LibraryLoader.getInstance().isLoadedByZygote()) {
Bundle sharedRelros = connectionBundle.getBundle(Linker.EXTRA_LINKER_SHARED_RELROS);
if (sharedRelros != null) getLinker().provideSharedRelros(sharedRelros);
......@@ -109,7 +108,7 @@ public class ContentChildProcessServiceDelegate implements ChildProcessServiceDe
Linker linker = null;
boolean requestedSharedRelro = false;
if (LibraryLoaderConfig.useChromiumLinker()) {
if (LibraryLoader.getInstance().useChromiumLinker()) {
assert mLinkerParams != null;
linker = getLinker();
if (mLinkerParams.mWaitForSharedRelro) {
......@@ -167,7 +166,7 @@ public class ContentChildProcessServiceDelegate implements ChildProcessServiceDe
// Return a Linker instance. If testing, the Linker needs special setup.
private Linker getLinker() {
if (LibraryLoaderConfig.areTestsEnabled()) {
if (LibraryLoader.getInstance().areTestsEnabled()) {
// For testing, set the Linker implementation and the test runner
// class name to match those used by the parent.
assert mLinkerParams != null;
......
......@@ -24,7 +24,7 @@ import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.base.library_loader.LibraryLoaderConfig;
import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.library_loader.Linker;
import org.chromium.base.process_launcher.ChildConnectionAllocator;
import org.chromium.base.process_launcher.ChildProcessConnection;
......@@ -129,7 +129,7 @@ public final class ChildProcessLauncherHelperImpl {
ContentChildProcessConstants.EXTRA_CPU_COUNT, CpuFeatures.getCount());
connectionBundle.putLong(
ContentChildProcessConstants.EXTRA_CPU_FEATURES, CpuFeatures.getMask());
if (LibraryLoaderConfig.useChromiumLinker()) {
if (LibraryLoader.getInstance().useChromiumLinker()) {
connectionBundle.putBundle(Linker.EXTRA_LINKER_SHARED_RELROS,
Linker.getInstance().getSharedRelros());
}
......@@ -598,7 +598,7 @@ public final class ChildProcessLauncherHelperImpl {
private static void initLinker() {
assert LauncherThread.runningOnLauncherThread();
if (sLinkerInitialized) return;
if (LibraryLoaderConfig.useChromiumLinker()) {
if (LibraryLoader.getInstance().useChromiumLinker()) {
sLinkerLoadAddress = Linker.getInstance().getBaseLoadAddress();
if (sLinkerLoadAddress == 0) {
Log.i(TAG, "Shared RELRO support disabled!");
......@@ -616,7 +616,7 @@ public final class ChildProcessLauncherHelperImpl {
// Always wait for the shared RELROs in service processes.
final boolean waitForSharedRelros = true;
if (LibraryLoaderConfig.areTestsEnabled()) {
if (LibraryLoader.getInstance().areTestsEnabled()) {
Linker linker = Linker.getInstance();
return new ChromiumLinkerParams(sLinkerLoadAddress, waitForSharedRelros,
linker.getTestRunnerClassNameForTesting(),
......
......@@ -93,7 +93,7 @@ template("test") {
"android_manifest",
"android_manifest_dep",
"enable_multidex",
"locale_config_java_packages",
"product_config_java_packages",
"min_sdk_version",
"proguard_configs",
"proguard_enabled",
......
......@@ -11,8 +11,8 @@ android_resources("weblayer_resources") {
custom_package = "org.chromium.weblayer_private"
}
generate_locale_config_srcjar("weblayer_locale_config") {
java_package = weblayer_locale_config_java_package
generate_product_config_srcjar("weblayer_product_config") {
java_package = weblayer_product_config_java_package
}
java_cpp_enum("generated_enums") {
......@@ -65,9 +65,9 @@ android_library("java") {
]
srcjar_deps = [
":generated_enums",
":weblayer_locale_config",
":weblayer_product_config",
]
jar_excluded_patterns = [ "*/LocaleConfig.class" ]
jar_excluded_patterns = [ "*/ProductConfig.class" ]
annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
# Needed for android.webkit.WebView(Delegate|Factory)
......
......@@ -99,7 +99,7 @@ public final class WebLayerImpl extends IWebLayer.Stub {
// other expensive startup tasks.
R.onResourcesLoaded(resourcesPackageId);
ResourceBundle.setAvailablePakLocales(new String[] {}, LocaleConfig.UNCOMPRESSED_LOCALES);
ResourceBundle.setAvailablePakLocales(new String[] {}, ProductConfig.UNCOMPRESSED_LOCALES);
PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
ChildProcessCreationParams.set(appContext.getPackageName(), false /* isExternalService */,
......
......@@ -172,7 +172,7 @@ android_apk("weblayer_support_apk") {
android_manifest_dep = ":weblayer_support_manifest"
shared_resources = true
locale_config_java_packages = [ weblayer_locale_config_java_package ]
product_config_java_packages = [ weblayer_product_config_java_package ]
native_lib_version_rule = "//build/util:chrome_version_json"
_native_lib_file =
......
......@@ -126,6 +126,6 @@ test("weblayer_browsertests") {
android_manifest_dep = ":weblayer_browsertests_manifest"
use_default_launcher = false
shared_resources = true
locale_config_java_packages = [ weblayer_locale_config_java_package ]
product_config_java_packages = [ weblayer_product_config_java_package ]
}
}
......@@ -2,4 +2,4 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
weblayer_locale_config_java_package = "org.chromium.weblayer_private"
weblayer_product_config_java_package = "org.chromium.weblayer_private"
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