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

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: formatting nit 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/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 e07ea7aa1525c34b4ffab0b1a833072daa79498a..eef700f11641f93a4ab68e32762d79cd3229de34 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -174,6 +174,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
@@ -2223,7 +2224,11 @@ void ChromeContentBrowserClient::GetAdditionalFileSystemBackends(
void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
- FileDescriptorInfo* mappings) {
+ FileDescriptorInfo* mappings
+#if defined(OS_ANDROID)
+ , std::map<int, base::MemoryMappedFile::Region>* regions
+#endif
+ ) {
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) {
int v8_natives_fd = -1;
@@ -2279,17 +2284,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_));
Lei Zhang 2015/06/05 02:52:43 nit: funny indentation.
agrieve 2015/06/05 14:52:14 Done.
+ 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