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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2613803003: Simplifying ContentBrowserClient::GetAdditionalMappedFiles...() (Closed)
Patch Set: Created 3 years, 11 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 204aa6a6ddb5b602fdf51659e66fa5e93c34fb1c..71088623cc4a1a806b9578c6bdc517246c117837 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -2807,22 +2807,21 @@ void ChromeContentBrowserClient::GetAdditionalFileSystemBackends(
}
}
-#if defined(OS_ANDROID)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
- FileDescriptorInfo* mappings,
- std::map<int, base::MemoryMappedFile::Region>* regions) {
- int fd = ui::GetMainAndroidPackFd(
- &(*regions)[kAndroidUIResourcesPakDescriptor]);
- mappings->Share(kAndroidUIResourcesPakDescriptor, fd);
+ FileDescriptorInfo* mappings) {
+#if defined(OS_ANDROID)
+ base::MemoryMappedFile::Region region;
+ int fd = ui::GetMainAndroidPackFd(&region);
+ mappings->ShareWithRegion(kAndroidUIResourcesPakDescriptor, fd, region);
- fd = ui::GetCommonResourcesPackFd(
- &(*regions)[kAndroidChrome100PercentPakDescriptor]);
- mappings->Share(kAndroidChrome100PercentPakDescriptor, fd);
+ fd = ui::GetCommonResourcesPackFd(&region);
+ mappings->ShareWithRegion(kAndroidChrome100PercentPakDescriptor, fd, region);
- fd = ui::GetLocalePackFd(&(*regions)[kAndroidLocalePakDescriptor]);
- mappings->Share(kAndroidLocalePakDescriptor, fd);
+ fd = ui::GetLocalePackFd(&region);
+ mappings->ShareWithRegion(kAndroidLocalePakDescriptor, fd, region);
if (breakpad::IsCrashReporterEnabled()) {
base::File file =
@@ -2840,18 +2839,14 @@ void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
base::FilePath app_data_path;
PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path);
DCHECK(!app_data_path.empty());
-}
-#elif defined(OS_POSIX) && !defined(OS_MACOSX)
-void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
- const base::CommandLine& command_line,
- int child_process_id,
- FileDescriptorInfo* mappings) {
+#else
int crash_signal_fd = GetCrashSignalFD(command_line);
if (crash_signal_fd >= 0) {
mappings->Share(kCrashDumpSignal, crash_signal_fd);
}
-}
#endif // defined(OS_ANDROID)
+}
+#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
#if defined(OS_WIN)
base::string16 ChromeContentBrowserClient::GetAppContainerSidForSandboxType(

Powered by Google App Engine
This is Rietveld 408576698