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

@ -35,7 +35,6 @@
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
#include "chrome/browser/ui/webui/theme_source.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chrome_unscaled_resources.h"
#include "content/browser/renderer_host/debug_urls.h"
#include "content/browser/webui/content_web_ui_controller_factory.h"
#include "content/public/browser/browser_url_handler.h"
@ -354,17 +353,9 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
}
bool OnLicenseUI(std::string* mime_type, std::string* output) {
// TODO(chrome): Currently, CEF-specific resources for the Alloy runtime come
// from cef/libcef/resources/cef_resources.grd via cef.pak and CEF-specific
// resources for the Chrome runtime come from
// chrome/app/theme/chrome_unscaled_resources.grd via chrome_100_percent.pak.
// It would be better to have a single pak file (and single ID value) for
// CEF-specific resources and share the same *.pak files as Chrome for the
// other resources.
std::string piece =
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
cef::IsChromeRuntimeEnabled() ? IDR_CHROME_CEF_LICENSE_TXT
: IDR_CEF_LICENSE_TXT);
IDR_CEF_LICENSE_TXT);
if (piece.empty()) {
NOTREACHED() << "Failed to load license txt resource.";
return false;