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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2613803003: Simplifying ContentBrowserClient::GetAdditionalMappedFiles...() (Closed)
Patch Set: Addressed jam@'s comment 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 2782 matching lines...) Expand 10 before | Expand all | Expand 10 after
2793 DCHECK(backend->CanHandleType(storage::kFileSystemTypeExternal)); 2793 DCHECK(backend->CanHandleType(storage::kFileSystemTypeExternal));
2794 additional_backends->push_back(backend); 2794 additional_backends->push_back(backend);
2795 #endif 2795 #endif
2796 2796
2797 for (size_t i = 0; i < extra_parts_.size(); ++i) { 2797 for (size_t i = 0; i < extra_parts_.size(); ++i) {
2798 extra_parts_[i]->GetAdditionalFileSystemBackends( 2798 extra_parts_[i]->GetAdditionalFileSystemBackends(
2799 browser_context, storage_partition_path, additional_backends); 2799 browser_context, storage_partition_path, additional_backends);
2800 } 2800 }
2801 } 2801 }
2802 2802
2803 #if defined(OS_ANDROID) 2803 #if defined(OS_POSIX) && !defined(OS_MACOSX)
2804 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 2804 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
2805 const base::CommandLine& command_line, 2805 const base::CommandLine& command_line,
2806 int child_process_id, 2806 int child_process_id,
2807 FileDescriptorInfo* mappings, 2807 FileDescriptorInfo* mappings) {
2808 std::map<int, base::MemoryMappedFile::Region>* regions) { 2808 #if defined(OS_ANDROID)
2809 int fd = ui::GetMainAndroidPackFd( 2809 base::MemoryMappedFile::Region region;
2810 &(*regions)[kAndroidUIResourcesPakDescriptor]); 2810 int fd = ui::GetMainAndroidPackFd(&region);
2811 mappings->Share(kAndroidUIResourcesPakDescriptor, fd); 2811 mappings->ShareWithRegion(kAndroidUIResourcesPakDescriptor, fd, region);
2812 2812
2813 fd = ui::GetCommonResourcesPackFd( 2813 fd = ui::GetCommonResourcesPackFd(&region);
2814 &(*regions)[kAndroidChrome100PercentPakDescriptor]); 2814 mappings->ShareWithRegion(kAndroidChrome100PercentPakDescriptor, fd, region);
2815 mappings->Share(kAndroidChrome100PercentPakDescriptor, fd);
2816 2815
2817 fd = ui::GetLocalePackFd(&(*regions)[kAndroidLocalePakDescriptor]); 2816 fd = ui::GetLocalePackFd(&region);
2818 mappings->Share(kAndroidLocalePakDescriptor, fd); 2817 mappings->ShareWithRegion(kAndroidLocalePakDescriptor, fd, region);
2819 2818
2820 if (breakpad::IsCrashReporterEnabled()) { 2819 if (breakpad::IsCrashReporterEnabled()) {
2821 base::File file = 2820 base::File file =
2822 breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( 2821 breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile(
2823 child_process_id); 2822 child_process_id);
2824 if (file.IsValid()) { 2823 if (file.IsValid()) {
2825 mappings->Transfer(kAndroidMinidumpDescriptor, 2824 mappings->Transfer(kAndroidMinidumpDescriptor,
2826 base::ScopedFD(file.TakePlatformFile())); 2825 base::ScopedFD(file.TakePlatformFile()));
2827 } else { 2826 } else {
2828 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " 2827 LOG(ERROR) << "Failed to create file for minidump, crash reporting will "
2829 "be disabled for this process."; 2828 "be disabled for this process.";
2830 } 2829 }
2831 } 2830 }
2832 2831
2833 base::FilePath app_data_path; 2832 base::FilePath app_data_path;
2834 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path); 2833 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path);
2835 DCHECK(!app_data_path.empty()); 2834 DCHECK(!app_data_path.empty());
2836 } 2835 #else
2837 #elif defined(OS_POSIX) && !defined(OS_MACOSX)
2838 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
2839 const base::CommandLine& command_line,
2840 int child_process_id,
2841 FileDescriptorInfo* mappings) {
2842 int crash_signal_fd = GetCrashSignalFD(command_line); 2836 int crash_signal_fd = GetCrashSignalFD(command_line);
2843 if (crash_signal_fd >= 0) { 2837 if (crash_signal_fd >= 0) {
2844 mappings->Share(kCrashDumpSignal, crash_signal_fd); 2838 mappings->Share(kCrashDumpSignal, crash_signal_fd);
2845 } 2839 }
2840 #endif // defined(OS_ANDROID)
2846 } 2841 }
2847 #endif // defined(OS_ANDROID) 2842 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
2848 2843
2849 #if defined(OS_WIN) 2844 #if defined(OS_WIN)
2850 base::string16 ChromeContentBrowserClient::GetAppContainerSidForSandboxType( 2845 base::string16 ChromeContentBrowserClient::GetAppContainerSidForSandboxType(
2851 int sandbox_type) const { 2846 int sandbox_type) const {
2852 base::string16 sid; 2847 base::string16 sid;
2853 2848
2854 #if defined(GOOGLE_CHROME_BUILD) 2849 #if defined(GOOGLE_CHROME_BUILD)
2855 const version_info::Channel channel = chrome::GetChannel(); 2850 const version_info::Channel channel = chrome::GetChannel();
2856 2851
2857 // It's possible to have a SxS installation running at the same time as a 2852 // 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
3364 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { 3359 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() {
3365 return variations::GetVariationParamValue( 3360 return variations::GetVariationParamValue(
3366 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; 3361 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true";
3367 } 3362 }
3368 3363
3369 bool ChromeContentBrowserClient:: 3364 bool ChromeContentBrowserClient::
3370 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3365 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3371 return variations::GetVariationParamValue( 3366 return variations::GetVariationParamValue(
3372 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3367 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3373 } 3368 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chromecast/browser/cast_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698