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

Side by Side 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 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 <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 2789 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 DCHECK(backend->CanHandleType(storage::kFileSystemTypeExternal)); 2800 DCHECK(backend->CanHandleType(storage::kFileSystemTypeExternal));
2801 additional_backends->push_back(backend); 2801 additional_backends->push_back(backend);
2802 #endif 2802 #endif
2803 2803
2804 for (size_t i = 0; i < extra_parts_.size(); ++i) { 2804 for (size_t i = 0; i < extra_parts_.size(); ++i) {
2805 extra_parts_[i]->GetAdditionalFileSystemBackends( 2805 extra_parts_[i]->GetAdditionalFileSystemBackends(
2806 browser_context, storage_partition_path, additional_backends); 2806 browser_context, storage_partition_path, additional_backends);
2807 } 2807 }
2808 } 2808 }
2809 2809
2810 #if defined(OS_ANDROID) 2810 #if defined(OS_POSIX) && !defined(OS_MACOSX)
2811 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 2811 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
2812 const base::CommandLine& command_line, 2812 const base::CommandLine& command_line,
2813 int child_process_id, 2813 int child_process_id,
2814 FileDescriptorInfo* mappings, 2814 FileDescriptorInfo* mappings) {
2815 std::map<int, base::MemoryMappedFile::Region>* regions) { 2815 #if defined(OS_ANDROID)
2816 int fd = ui::GetMainAndroidPackFd( 2816 base::MemoryMappedFile::Region region;
2817 &(*regions)[kAndroidUIResourcesPakDescriptor]); 2817 int fd = ui::GetMainAndroidPackFd(&region);
2818 mappings->Share(kAndroidUIResourcesPakDescriptor, fd); 2818 mappings->ShareWithRegion(kAndroidUIResourcesPakDescriptor, fd, region);
2819 2819
2820 fd = ui::GetCommonResourcesPackFd( 2820 fd = ui::GetCommonResourcesPackFd(&region);
2821 &(*regions)[kAndroidChrome100PercentPakDescriptor]); 2821 mappings->ShareWithRegion(kAndroidChrome100PercentPakDescriptor, fd, region);
2822 mappings->Share(kAndroidChrome100PercentPakDescriptor, fd);
2823 2822
2824 fd = ui::GetLocalePackFd(&(*regions)[kAndroidLocalePakDescriptor]); 2823 fd = ui::GetLocalePackFd(&region);
2825 mappings->Share(kAndroidLocalePakDescriptor, fd); 2824 mappings->ShareWithRegion(kAndroidLocalePakDescriptor, fd, region);
2826 2825
2827 if (breakpad::IsCrashReporterEnabled()) { 2826 if (breakpad::IsCrashReporterEnabled()) {
2828 base::File file = 2827 base::File file =
2829 breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( 2828 breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile(
2830 child_process_id); 2829 child_process_id);
2831 if (file.IsValid()) { 2830 if (file.IsValid()) {
2832 mappings->Transfer(kAndroidMinidumpDescriptor, 2831 mappings->Transfer(kAndroidMinidumpDescriptor,
2833 base::ScopedFD(file.TakePlatformFile())); 2832 base::ScopedFD(file.TakePlatformFile()));
2834 } else { 2833 } else {
2835 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " 2834 LOG(ERROR) << "Failed to create file for minidump, crash reporting will "
2836 "be disabled for this process."; 2835 "be disabled for this process.";
2837 } 2836 }
2838 } 2837 }
2839 2838
2840 base::FilePath app_data_path; 2839 base::FilePath app_data_path;
2841 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path); 2840 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path);
2842 DCHECK(!app_data_path.empty()); 2841 DCHECK(!app_data_path.empty());
2843 } 2842 #else
2844 #elif defined(OS_POSIX) && !defined(OS_MACOSX)
2845 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
2846 const base::CommandLine& command_line,
2847 int child_process_id,
2848 FileDescriptorInfo* mappings) {
2849 int crash_signal_fd = GetCrashSignalFD(command_line); 2843 int crash_signal_fd = GetCrashSignalFD(command_line);
2850 if (crash_signal_fd >= 0) { 2844 if (crash_signal_fd >= 0) {
2851 mappings->Share(kCrashDumpSignal, crash_signal_fd); 2845 mappings->Share(kCrashDumpSignal, crash_signal_fd);
2852 } 2846 }
2847 #endif // defined(OS_ANDROID)
2853 } 2848 }
2854 #endif // defined(OS_ANDROID) 2849 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
2855 2850
2856 #if defined(OS_WIN) 2851 #if defined(OS_WIN)
2857 base::string16 ChromeContentBrowserClient::GetAppContainerSidForSandboxType( 2852 base::string16 ChromeContentBrowserClient::GetAppContainerSidForSandboxType(
2858 int sandbox_type) const { 2853 int sandbox_type) const {
2859 base::string16 sid; 2854 base::string16 sid;
2860 2855
2861 #if defined(GOOGLE_CHROME_BUILD) 2856 #if defined(GOOGLE_CHROME_BUILD)
2862 const version_info::Channel channel = chrome::GetChannel(); 2857 const version_info::Channel channel = chrome::GetChannel();
2863 2858
2864 // It's possible to have a SxS installation running at the same time as a 2859 // It's possible to have a SxS installation running at the same time as a
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
3371 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { 3366 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() {
3372 return variations::GetVariationParamValue( 3367 return variations::GetVariationParamValue(
3373 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; 3368 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true";
3374 } 3369 }
3375 3370
3376 bool ChromeContentBrowserClient:: 3371 bool ChromeContentBrowserClient::
3377 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3372 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3378 return variations::GetVariationParamValue( 3373 return variations::GetVariationParamValue(
3379 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3374 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3380 } 3375 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698