Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: chrome/app/chrome_main_delegate.cc

Issue 1181953002: Load non-locale .pak files directly from the .apk on Android (rather than extracting on start-up). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@raw-paks
Patch Set: Fix content_browsertests Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/app/chrome_main_delegate.cc
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc
index 747d482086c36e087ddc5f7ed2031d51054133d4..5189e6b5414cbd64fe1c3eefe85b86150591addf 100644
--- a/chrome/app/chrome_main_delegate.cc
+++ b/chrome/app/chrome_main_delegate.cc
@@ -743,22 +743,22 @@ void ChromeMainDelegate::PreSandboxStartup() {
// The renderer sandbox prevents us from accessing our .pak files directly.
// Therefore file descriptors to the .pak files that we need are passed in
// at process creation time.
- int locale_pak_fd = base::GlobalDescriptors::GetInstance()->MaybeGet(
- kAndroidLocalePakDescriptor);
- CHECK(locale_pak_fd != -1);
- ResourceBundle::InitSharedInstanceWithPakFileRegion(
- base::File(locale_pak_fd), base::MemoryMappedFile::Region::kWholeFile);
+ auto global_descriptors = base::GlobalDescriptors::GetInstance();
+ int pak_fd = global_descriptors->Get(kAndroidLocalePakDescriptor);
+ base::MemoryMappedFile::Region pak_region =
+ global_descriptors->GetRegion(kAndroidLocalePakDescriptor);
+ ResourceBundle::InitSharedInstanceWithPakFileRegion(base::File(pak_fd),
+ pak_region);
int extra_pak_keys[] = {
kAndroidChrome100PercentPakDescriptor,
kAndroidUIResourcesPakDescriptor,
};
for (size_t i = 0; i < arraysize(extra_pak_keys); ++i) {
- int pak_fd =
- base::GlobalDescriptors::GetInstance()->MaybeGet(extra_pak_keys[i]);
- CHECK(pak_fd != -1);
- ResourceBundle::GetSharedInstance().AddDataPackFromFile(
- base::File(pak_fd), ui::SCALE_FACTOR_100P);
+ pak_fd = global_descriptors->Get(extra_pak_keys[i]);
+ pak_region = global_descriptors->GetRegion(extra_pak_keys[i]);
+ ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion(
+ base::File(pak_fd), pak_region, ui::SCALE_FACTOR_100P);
}
base::i18n::SetICUDefaultLocale(locale);

Powered by Google App Engine
This is Rietveld 408576698