Use the same pak files for the Alloy and Chrome runtimes (see issue #2969)

Chrome currently uses chrome_100_percent.pak, chrome_200_percent.pak,
resources.pak and locales/<locale>.pak files. This change adds CEF
resources to those existing pak files and updates the Alloy runtime to
use them instead of the previous CEF-specific pak files (cef.pak,
cef_100_percent.pak, cef_200_percent.pak, cef_extensions.pak,
devtools_resources.pak) which are no longer generated.

The addition of Chrome resources results in an ~16% (~4.1MB) increase in total
combined pak file size vs. the previous CEF-specific pak files. While a size
increase is not ideal for the Alloy runtime, it seems preferable to the
alternative of distributing separate (and partially duplicated) pak files for
each runtime, which would have added ~9.8MB to the total binary distribution
size.
This commit is contained in:
Marshall Greenblatt
2021-02-28 15:23:42 -05:00
parent a6a8c0e845
commit 8424f166cc
13 changed files with 160 additions and 518 deletions

View File

@ -77,18 +77,6 @@ index db85b6b2fcf5..bcf6867e8f4e 100644
}
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
diff --git chrome/app/theme/chrome_unscaled_resources.grd chrome/app/theme/chrome_unscaled_resources.grd
index b4e4545e3520..29335f1614e2 100644
--- chrome/app/theme/chrome_unscaled_resources.grd
+++ chrome/app/theme/chrome_unscaled_resources.grd
@@ -62,6 +62,7 @@
</if>
</if>
<if expr="not _google_chrome">
+ <include name="IDR_CHROME_CEF_LICENSE_TXT" file="../../../cef/LICENSE.txt" type="BINDATA" />
<include name="IDR_PRODUCT_LOGO_64" file="chromium/product_logo_64.png" type="BINDATA" />
<include name="IDR_PRODUCT_LOGO_128" file="chromium/product_logo_128.png" type="BINDATA" />
<include name="IDR_PRODUCT_LOGO_256" file="chromium/product_logo_256.png" type="BINDATA" />
diff --git chrome/browser/chrome_browser_main.cc chrome/browser/chrome_browser_main.cc
index fee4d5f1a8ca..2e4fb506d851 100644
--- chrome/browser/chrome_browser_main.cc
@ -140,7 +128,7 @@ index c30b73c2575f..5da45a243f9b 100644
#import "chrome/browser/app_controller_mac.h"
#include "chrome/browser/apps/app_shim/app_shim_listener.h"
#include "chrome/browser/browser_process.h"
@@ -111,6 +112,7 @@
@@ -111,6 +112,7 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() {
}
}
@ -148,7 +136,7 @@ index c30b73c2575f..5da45a243f9b 100644
// Create the app delegate. This object is intentionally leaked as a global
// singleton. It is accessed through -[NSApp delegate].
AppController* app_controller = [[AppController alloc] init];
@@ -119,6 +121,7 @@
@@ -119,6 +121,7 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() {
chrome::BuildMainMenu(NSApp, app_controller,
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), false);
[app_controller mainMenuCreated];
@ -156,7 +144,7 @@ index c30b73c2575f..5da45a243f9b 100644
PrefService* local_state = g_browser_process->local_state();
DCHECK(local_state);
@@ -175,7 +178,9 @@
@@ -175,7 +178,9 @@ void ChromeBrowserMainPartsMac::PostProfileInit() {
}
void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() {
@ -178,7 +166,7 @@ index 9e8fcb9f9f91..2a9eaca0fb0d 100644
#include "chrome/browser/browser_features.h"
#include "chrome/browser/notifications/notification_common.h"
#include "chrome/browser/notifications/notification_display_service_impl.h"
@@ -451,6 +452,12 @@ - (void)notificationClick:(NSDictionary*)notificationResponseData {
@@ -451,6 +452,12 @@ getDisplayedAlertsForProfileId:(NSString*)profileId
- (id<NotificationDelivery>)serviceProxy {
id<NotificationDelivery> proxy = [_xpcConnection remoteObjectProxy];

View File

@ -79,7 +79,7 @@ index 839144aa1e9b..29c8ab32398a 100644
+_OBJC_METACLASS_$_UnderlayOpenGLHostingWindow
+
diff --git chrome/chrome_paks.gni chrome/chrome_paks.gni
index 6ad9c87a3adf..33716990c792 100644
index 6ad9c87a3adf..a47694446b9a 100644
--- chrome/chrome_paks.gni
+++ chrome/chrome_paks.gni
@@ -4,6 +4,7 @@
@ -90,33 +90,40 @@ index 6ad9c87a3adf..33716990c792 100644
import("//chrome/browser/buildflags.gni")
import("//chrome/browser/resources/pdf/ink/ink.gni")
import("//chrome/common/features.gni")
@@ -344,6 +345,7 @@ template("chrome_paks") {
@@ -255,6 +256,10 @@ template("chrome_extra_paks") {
"//chrome/browser/resources/welcome:welcome_resources",
]
}
}
+ if (!enable_cef) {
chrome_repack_locales("${target_name}_locales") {
forward_variables_from(invoker,
[
@@ -366,14 +368,17 @@ template("chrome_paks") {
output_locales = locales
}
}
+ } # !enable_cef
group(target_name) {
forward_variables_from(invoker, [ "deps" ])
public_deps = [
":${target_name}_100_percent",
":${target_name}_extra",
- ":${target_name}_locales",
]
+ if (!enable_cef) {
+ public_deps += [ ":${target_name}_locales" ]
+ if (enable_cef) {
+ sources += [ "$root_gen_dir/cef/cef_resources.pak" ]
+ deps += [ "//cef:cef_resources" ]
+ }
if (enable_hidpi) {
public_deps += [ ":${target_name}_200_percent" ]
if (enable_extensions) {
sources += [
"$root_gen_dir/chrome/extensions_resources.pak",
diff --git chrome/chrome_repack_locales.gni chrome/chrome_repack_locales.gni
index a64a23560460..b08eee1f789a 100644
--- chrome/chrome_repack_locales.gni
+++ chrome/chrome_repack_locales.gni
@@ -6,6 +6,7 @@ import("//build/config/chrome_build.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
+import("//cef/libcef/features/features.gni")
import("//extensions/buildflags/buildflags.gni")
import("//tools/grit/repack.gni")
@@ -83,6 +84,10 @@ template("chrome_repack_locales") {
]
compress = true
}
+ if (enable_cef) {
+ source_patterns += [ "${root_gen_dir}/cef/cef_strings_" ]
+ deps += [ "//cef:cef_strings" ]
+ }
if (enable_extensions) {
source_patterns +=
[ "${root_gen_dir}/extensions/strings/extensions_strings_" ]
diff --git chrome/installer/mini_installer/BUILD.gn chrome/installer/mini_installer/BUILD.gn
index 5f5cb1c752f2..ef0a01caf9cd 100644
--- chrome/installer/mini_installer/BUILD.gn