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

Side by Side 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: Keep extracting for components/ 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 #include "chrome/browser/chrome_browser_main_posix.h" 167 #include "chrome/browser/chrome_browser_main_posix.h"
168 #endif 168 #endif
169 169
170 #if defined(OS_POSIX) && !defined(OS_MACOSX) 170 #if defined(OS_POSIX) && !defined(OS_MACOSX)
171 #include "base/debug/leak_annotations.h" 171 #include "base/debug/leak_annotations.h"
172 #include "components/crash/app/breakpad_linux.h" 172 #include "components/crash/app/breakpad_linux.h"
173 #include "components/crash/browser/crash_handler_host_linux.h" 173 #include "components/crash/browser/crash_handler_host_linux.h"
174 #endif 174 #endif
175 175
176 #if defined(OS_ANDROID) 176 #if defined(OS_ANDROID)
177 #include "base/android/apk_assets.h"
177 #include "ui/base/ui_base_paths.h" 178 #include "ui/base/ui_base_paths.h"
178 #include "ui/gfx/android/device_display_info.h" 179 #include "ui/gfx/android/device_display_info.h"
179 #endif 180 #endif
180 181
181 #if defined(TOOLKIT_VIEWS) 182 #if defined(TOOLKIT_VIEWS)
182 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" 183 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h"
183 #endif 184 #endif
184 185
185 #if defined(USE_ASH) 186 #if defined(USE_ASH)
186 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" 187 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h"
(...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 for (size_t i = 0; i < extra_parts_.size(); ++i) { 2213 for (size_t i = 0; i < extra_parts_.size(); ++i) {
2213 extra_parts_[i]->GetAdditionalFileSystemBackends( 2214 extra_parts_[i]->GetAdditionalFileSystemBackends(
2214 browser_context, storage_partition_path, additional_backends); 2215 browser_context, storage_partition_path, additional_backends);
2215 } 2216 }
2216 } 2217 }
2217 2218
2218 #if defined(OS_POSIX) && !defined(OS_MACOSX) 2219 #if defined(OS_POSIX) && !defined(OS_MACOSX)
2219 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 2220 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
2220 const base::CommandLine& command_line, 2221 const base::CommandLine& command_line,
2221 int child_process_id, 2222 int child_process_id,
2222 FileDescriptorInfo* mappings) { 2223 FileDescriptorInfo* mappings
2224 #if defined(OS_ANDROID)
2225 , std::map<int, base::MemoryMappedFile::Region>* regions
2226 #endif
2227 ) {
2223 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 2228 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
2224 if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) { 2229 if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) {
2225 int v8_natives_fd = -1; 2230 int v8_natives_fd = -1;
2226 int v8_snapshot_fd = -1; 2231 int v8_snapshot_fd = -1;
2227 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd, 2232 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd,
2228 &v8_snapshot_fd)) { 2233 &v8_snapshot_fd)) {
2229 v8_natives_fd_.reset(v8_natives_fd); 2234 v8_natives_fd_.reset(v8_natives_fd);
2230 v8_snapshot_fd_.reset(v8_snapshot_fd); 2235 v8_snapshot_fd_.reset(v8_snapshot_fd);
2231 } 2236 }
2232 } 2237 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2268 child_process_id); 2273 child_process_id);
2269 if (file.IsValid()) { 2274 if (file.IsValid()) {
2270 mappings->Transfer(kAndroidMinidumpDescriptor, 2275 mappings->Transfer(kAndroidMinidumpDescriptor,
2271 base::ScopedFD(file.TakePlatformFile())); 2276 base::ScopedFD(file.TakePlatformFile()));
2272 } else { 2277 } else {
2273 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " 2278 LOG(ERROR) << "Failed to create file for minidump, crash reporting will "
2274 "be disabled for this process."; 2279 "be disabled for this process.";
2275 } 2280 }
2276 } 2281 }
2277 2282
2278 base::FilePath app_data_path; 2283 if (!icudtl_fd_.is_valid()) {
2279 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path); 2284 icudtl_fd_.reset(base::android::OpenApkAsset(base::i18n::kIcuDataFileName,
2280 DCHECK(!app_data_path.empty()); 2285 &icudtl_region_));
2286 DCHECK(icudtl_fd_.is_valid());
2287 }
2288 mappings->Share(kAndroidICUDataDescriptor, icudtl_fd_.get());
2289 regions->insert(std::make_pair(kAndroidICUDataDescriptor, icudtl_region_));
2281 2290
2282 flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
2283 base::FilePath icudata_path =
2284 app_data_path.AppendASCII(base::i18n::kIcuDataFileName);
2285 base::File icudata_file(icudata_path, flags);
2286 DCHECK(icudata_file.IsValid());
2287 mappings->Transfer(kAndroidICUDataDescriptor,
2288 base::ScopedFD(icudata_file.TakePlatformFile()));
2289 #else 2291 #else
2290 int crash_signal_fd = GetCrashSignalFD(command_line); 2292 int crash_signal_fd = GetCrashSignalFD(command_line);
2291 if (crash_signal_fd >= 0) { 2293 if (crash_signal_fd >= 0) {
2292 mappings->Share(kCrashDumpSignal, crash_signal_fd); 2294 mappings->Share(kCrashDumpSignal, crash_signal_fd);
2293 } 2295 }
2294 #endif // defined(OS_ANDROID) 2296 #endif // defined(OS_ANDROID)
2295 } 2297 }
2296 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 2298 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
2297 2299
2298 #if defined(OS_WIN) 2300 #if defined(OS_WIN)
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2442 switches::kDisableWebRtcEncryption, 2444 switches::kDisableWebRtcEncryption,
2443 }; 2445 };
2444 to_command_line->CopySwitchesFrom(from_command_line, 2446 to_command_line->CopySwitchesFrom(from_command_line,
2445 kWebRtcDevSwitchNames, 2447 kWebRtcDevSwitchNames,
2446 arraysize(kWebRtcDevSwitchNames)); 2448 arraysize(kWebRtcDevSwitchNames));
2447 } 2449 }
2448 } 2450 }
2449 #endif // defined(ENABLE_WEBRTC) 2451 #endif // defined(ENABLE_WEBRTC)
2450 2452
2451 } // namespace chrome 2453 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698