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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 1147213004: Store and load icudtl.dat directly from the apk rather than extracting on start-up (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@load-from-apk
Patch Set: Created 5 years, 7 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/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 32432acce8dbdbe5877b32f2f1c7aead7ed955ab..b5b92f06ee0f73b62066ec13e265aaea5d07d296 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -173,6 +173,7 @@
#endif
#if defined(OS_ANDROID)
+#include "base/android/apk_assets.h"
#include "ui/base/ui_base_paths.h"
#include "ui/gfx/android/device_display_info.h"
#endif
@@ -2279,17 +2280,14 @@ void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
}
}
- base::FilePath app_data_path;
- PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path);
- DCHECK(!app_data_path.empty());
-
- flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
- base::FilePath icudata_path =
- app_data_path.AppendASCII(base::i18n::kIcuDataFileName);
- base::File icudata_file(icudata_path, flags);
- DCHECK(icudata_file.IsValid());
- mappings->Transfer(kAndroidICUDataDescriptor,
- base::ScopedFD(icudata_file.TakePlatformFile()));
+ if (!icudtl_fd_.is_valid()) {
+ icudtl_fd_.reset(base::android::OpenApkAsset(base::i18n::kIcuDataFileName,
+ &icudtl_region_));
+ DCHECK(icudtl_fd_.is_valid());
+ }
+ mappings->Share(kAndroidICUDataDescriptor, icudtl_fd_.get());
+ regions->insert(std::make_pair(kAndroidICUDataDescriptor, icudtl_region_));
+
#else
int crash_signal_fd = GetCrashSignalFD(command_line);
if (crash_signal_fd >= 0) {

Powered by Google App Engine
This is Rietveld 408576698