Commit ed8cd473 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Shrink main dex size of multidex apks via --disable-annotation-resolution-workaround

Shaves off about 10000 methods.

Bug: 820570
Change-Id: I4c35e704f76e0b1e62756adaf2cbfdf2945adea3
Reviewed-on: https://chromium-review.googlesource.com/963281
Commit-Queue: agrieve <agrieve@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543593}
parent ad7f4854
...@@ -79,6 +79,10 @@ def main(args): ...@@ -79,6 +79,10 @@ def main(args):
main_dex_list_cmd = [ main_dex_list_cmd = [
'java', '-cp', dx_jar, 'java', '-cp', dx_jar,
'com.android.multidex.MainDexListBuilder', 'com.android.multidex.MainDexListBuilder',
# This workaround significantly increases main dex size and doesn't seem to
# be needed by Chrome. See comment in the source:
# https://android.googlesource.com/platform/dalvik/+/master/dx/src/com/android/multidex/MainDexListBuilder.java
'--disable-annotation-resolution-workaround',
] ]
input_paths = list(args.paths) input_paths = list(args.paths)
......
...@@ -26,3 +26,7 @@ ...@@ -26,3 +26,7 @@
-keep class android.support.v4.content.ContextCompat { -keep class android.support.v4.content.ContextCompat {
*; *;
} }
# Need test classes to be in the main dex because test listing does not
# load secondary dex on Dalvik devices.
-keep @**.RunWith class * {}
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include "content/shell/browser/shell_download_manager_delegate.h" #include "content/shell/browser/shell_download_manager_delegate.h"
#include "content/shell/browser/shell_network_delegate.h" #include "content/shell/browser/shell_network_delegate.h"
#include "content/test/content_browser_test_utils_internal.h" #include "content/test/content_browser_test_utils_internal.h"
#include "content/test/test_content_browser_client.h"
#include "net/dns/mock_host_resolver.h" #include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_request.h"
...@@ -99,7 +100,7 @@ const char k404Response[] = "HTTP/1.1 404 Not found\r\n\r\n"; ...@@ -99,7 +100,7 @@ const char k404Response[] = "HTTP/1.1 404 Not found\r\n\r\n";
// Implementation of TestContentBrowserClient that overrides // Implementation of TestContentBrowserClient that overrides
// AllowRenderingMhtmlOverHttp() and allows consumers to set a value. // AllowRenderingMhtmlOverHttp() and allows consumers to set a value.
class DownloadTestContentBrowserClient : public ContentBrowserClient { class DownloadTestContentBrowserClient : public TestContentBrowserClient {
public: public:
DownloadTestContentBrowserClient() = default; DownloadTestContentBrowserClient() = default;
...@@ -111,6 +112,10 @@ class DownloadTestContentBrowserClient : public ContentBrowserClient { ...@@ -111,6 +112,10 @@ class DownloadTestContentBrowserClient : public ContentBrowserClient {
allowed_rendering_mhtml_over_http_ = allowed; allowed_rendering_mhtml_over_http_ = allowed;
} }
base::FilePath GetDefaultDownloadDirectory() override {
return base::FilePath();
}
private: private:
bool allowed_rendering_mhtml_over_http_ = false; bool allowed_rendering_mhtml_over_http_ = false;
......
...@@ -37,10 +37,19 @@ config("content_shell_lib_warnings") { ...@@ -37,10 +37,19 @@ config("content_shell_lib_warnings") {
} }
} }
static_library("content_shell_lib") { source_set("android_shell_descriptors") {
testonly = true testonly = true
sources = [ sources = [
"android/shell_descriptors.h", "android/shell_descriptors.h",
]
public_deps = [
"//content/public/common:content_descriptors",
]
}
static_library("content_shell_lib") {
testonly = true
sources = [
"android/shell_manager.cc", "android/shell_manager.cc",
"android/shell_manager.h", "android/shell_manager.h",
"app/blink_test_platform_support.h", "app/blink_test_platform_support.h",
...@@ -209,6 +218,8 @@ static_library("content_shell_lib") { ...@@ -209,6 +218,8 @@ static_library("content_shell_lib") {
defines = [ "CONTENT_SHELL_VERSION=\"$content_shell_version\"" ] defines = [ "CONTENT_SHELL_VERSION=\"$content_shell_version\"" ]
public_deps = [ public_deps = [
":android_shell_descriptors",
# This exposes all public content APIs. # This exposes all public content APIs.
"//content/public/app:both", "//content/public/app:both",
"//content/public/browser", "//content/public/browser",
......
...@@ -372,7 +372,10 @@ jumbo_static_library("test_support") { ...@@ -372,7 +372,10 @@ jumbo_static_library("test_support") {
"mock_google_streaming_server.cc", "mock_google_streaming_server.cc",
"mock_google_streaming_server.h", "mock_google_streaming_server.h",
] ]
deps += [ "//mojo/android:libsystem_java" ] deps += [
"//content/shell:android_shell_descriptors",
"//mojo/android:libsystem_java",
]
} }
if (enable_plugins) { if (enable_plugins) {
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
#include "base/logging.h" #include "base/logging.h"
#include "storage/browser/quota/quota_settings.h" #include "storage/browser/quota/quota_settings.h"
#if defined(OS_ANDROID)
#include "content/shell/android/shell_descriptors.h"
#endif
namespace content { namespace content {
TestContentBrowserClient::TestContentBrowserClient() { TestContentBrowserClient::TestContentBrowserClient() {
...@@ -31,4 +35,15 @@ void TestContentBrowserClient::GetQuotaSettings( ...@@ -31,4 +35,15 @@ void TestContentBrowserClient::GetQuotaSettings(
std::move(callback).Run(storage::GetHardCodedSettings(100 * 1024 * 1024)); std::move(callback).Run(storage::GetHardCodedSettings(100 * 1024 * 1024));
} }
#if defined(OS_ANDROID)
void TestContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
content::PosixFileDescriptorInfo* mappings) {
mappings->ShareWithRegion(
kShellPakDescriptor,
base::GlobalDescriptors::GetInstance()->Get(kShellPakDescriptor),
base::GlobalDescriptors::GetInstance()->GetRegion(kShellPakDescriptor));
}
#endif
} // namespace content } // namespace content
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/files/scoped_temp_dir.h" #include "base/files/scoped_temp_dir.h"
#include "base/macros.h" #include "base/macros.h"
#include "build/build_config.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
namespace content { namespace content {
...@@ -24,6 +25,12 @@ class TestContentBrowserClient : public ContentBrowserClient { ...@@ -24,6 +25,12 @@ class TestContentBrowserClient : public ContentBrowserClient {
content::BrowserContext* context, content::BrowserContext* context,
content::StoragePartition* partition, content::StoragePartition* partition,
storage::OptionalQuotaSettingsCallback callback) override; storage::OptionalQuotaSettingsCallback callback) override;
#if defined(OS_ANDROID)
void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
content::PosixFileDescriptorInfo* mappings) override;
#endif // defined(OS_ANDROID)
private: private:
// Temporary directory for GetDefaultDownloadDirectory. // Temporary directory for GetDefaultDownloadDirectory.
......
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