OLD | NEW |
---|---|
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 Loading... | |
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 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2216 for (size_t i = 0; i < extra_parts_.size(); ++i) { | 2217 for (size_t i = 0; i < extra_parts_.size(); ++i) { |
2217 extra_parts_[i]->GetAdditionalFileSystemBackends( | 2218 extra_parts_[i]->GetAdditionalFileSystemBackends( |
2218 browser_context, storage_partition_path, additional_backends); | 2219 browser_context, storage_partition_path, additional_backends); |
2219 } | 2220 } |
2220 } | 2221 } |
2221 | 2222 |
2222 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 2223 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
2223 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 2224 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
2224 const base::CommandLine& command_line, | 2225 const base::CommandLine& command_line, |
2225 int child_process_id, | 2226 int child_process_id, |
2226 FileDescriptorInfo* mappings) { | 2227 FileDescriptorInfo* mappings |
2228 #if defined(OS_ANDROID) | |
2229 , | |
2230 std::map<int, base::MemoryMappedFile::Region>* regions | |
2231 #endif | |
2232 ) { | |
2227 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 2233 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
2228 if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) { | 2234 if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) { |
2229 int v8_natives_fd = -1; | 2235 int v8_natives_fd = -1; |
2230 int v8_snapshot_fd = -1; | 2236 int v8_snapshot_fd = -1; |
2231 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd, | 2237 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd, |
2232 &v8_snapshot_fd)) { | 2238 &v8_snapshot_fd)) { |
2233 v8_natives_fd_.reset(v8_natives_fd); | 2239 v8_natives_fd_.reset(v8_natives_fd); |
2234 v8_snapshot_fd_.reset(v8_snapshot_fd); | 2240 v8_snapshot_fd_.reset(v8_snapshot_fd); |
2235 } | 2241 } |
2236 } | 2242 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2272 child_process_id); | 2278 child_process_id); |
2273 if (file.IsValid()) { | 2279 if (file.IsValid()) { |
2274 mappings->Transfer(kAndroidMinidumpDescriptor, | 2280 mappings->Transfer(kAndroidMinidumpDescriptor, |
2275 base::ScopedFD(file.TakePlatformFile())); | 2281 base::ScopedFD(file.TakePlatformFile())); |
2276 } else { | 2282 } else { |
2277 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " | 2283 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " |
2278 "be disabled for this process."; | 2284 "be disabled for this process."; |
2279 } | 2285 } |
2280 } | 2286 } |
2281 | 2287 |
2282 base::FilePath app_data_path; | 2288 if (!icudtl_fd_.is_valid()) { |
2283 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path); | 2289 icudtl_fd_.reset(base::android::OpenApkAsset(base::i18n::kIcuDataFileName, |
2284 DCHECK(!app_data_path.empty()); | 2290 &icudtl_region_)); |
2291 DCHECK(icudtl_fd_.is_valid()); | |
2292 } | |
2293 mappings->Share(kAndroidICUDataDescriptor, icudtl_fd_.get()); | |
2294 regions->insert(std::make_pair(kAndroidICUDataDescriptor, icudtl_region_)); | |
jam
2015/06/04 03:13:30
why is chrome layer doing this instead of content
agrieve
2015/06/04 19:17:20
I'm new to this code, and have no idea. I do know
jam
2015/06/09 01:12:46
Hi, please work with someone on the android side t
Yaron
2015/06/09 03:39:40
Hmm. I definitely touched the crash fd code and it
| |
2285 | 2295 |
2286 flags = base::File::FLAG_OPEN | base::File::FLAG_READ; | |
2287 base::FilePath icudata_path = | |
2288 app_data_path.AppendASCII(base::i18n::kIcuDataFileName); | |
2289 base::File icudata_file(icudata_path, flags); | |
2290 DCHECK(icudata_file.IsValid()); | |
2291 mappings->Transfer(kAndroidICUDataDescriptor, | |
2292 base::ScopedFD(icudata_file.TakePlatformFile())); | |
2293 #else | 2296 #else |
2294 int crash_signal_fd = GetCrashSignalFD(command_line); | 2297 int crash_signal_fd = GetCrashSignalFD(command_line); |
2295 if (crash_signal_fd >= 0) { | 2298 if (crash_signal_fd >= 0) { |
2296 mappings->Share(kCrashDumpSignal, crash_signal_fd); | 2299 mappings->Share(kCrashDumpSignal, crash_signal_fd); |
2297 } | 2300 } |
2298 #endif // defined(OS_ANDROID) | 2301 #endif // defined(OS_ANDROID) |
2299 } | 2302 } |
2300 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 2303 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
2301 | 2304 |
2302 #if defined(OS_WIN) | 2305 #if defined(OS_WIN) |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2446 switches::kDisableWebRtcEncryption, | 2449 switches::kDisableWebRtcEncryption, |
2447 }; | 2450 }; |
2448 to_command_line->CopySwitchesFrom(from_command_line, | 2451 to_command_line->CopySwitchesFrom(from_command_line, |
2449 kWebRtcDevSwitchNames, | 2452 kWebRtcDevSwitchNames, |
2450 arraysize(kWebRtcDevSwitchNames)); | 2453 arraysize(kWebRtcDevSwitchNames)); |
2451 } | 2454 } |
2452 } | 2455 } |
2453 #endif // defined(ENABLE_WEBRTC) | 2456 #endif // defined(ENABLE_WEBRTC) |
2454 | 2457 |
2455 } // namespace chrome | 2458 } // namespace chrome |
OLD | NEW |