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

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

Issue 585203002: Turn FileDescriptorInfo a collection class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 for (size_t i = 0; i < extra_parts_.size(); ++i) { 2389 for (size_t i = 0; i < extra_parts_.size(); ++i) {
2390 extra_parts_[i]->GetAdditionalFileSystemBackends( 2390 extra_parts_[i]->GetAdditionalFileSystemBackends(
2391 browser_context, storage_partition_path, additional_backends); 2391 browser_context, storage_partition_path, additional_backends);
2392 } 2392 }
2393 } 2393 }
2394 2394
2395 #if defined(OS_POSIX) && !defined(OS_MACOSX) 2395 #if defined(OS_POSIX) && !defined(OS_MACOSX)
2396 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 2396 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
2397 const CommandLine& command_line, 2397 const CommandLine& command_line,
2398 int child_process_id, 2398 int child_process_id,
2399 std::vector<FileDescriptorInfo>* mappings) { 2399 FileDescriptorInfo* mappings) {
2400 #if defined(OS_ANDROID) 2400 #if defined(OS_ANDROID)
2401 base::FilePath data_path; 2401 base::FilePath data_path;
2402 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); 2402 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path);
2403 DCHECK(!data_path.empty()); 2403 DCHECK(!data_path.empty());
2404 2404
2405 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; 2405 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
2406 base::FilePath chrome_resources_pak = 2406 base::FilePath chrome_resources_pak =
2407 data_path.AppendASCII("chrome_100_percent.pak"); 2407 data_path.AppendASCII("chrome_100_percent.pak");
2408 base::File file(chrome_resources_pak, flags); 2408 base::File file(chrome_resources_pak, flags);
2409 DCHECK(file.IsValid()); 2409 DCHECK(file.IsValid());
2410 mappings->push_back(FileDescriptorInfo(kAndroidChrome100PercentPakDescriptor, 2410 mappings->Transfer(kAndroidChrome100PercentPakDescriptor,
2411 FileDescriptor(file.Pass()))); 2411 ScopedFD(file.TakePlatformFile()));
2412 2412
2413 const std::string locale = GetApplicationLocale(); 2413 const std::string locale = GetApplicationLocale();
2414 base::FilePath locale_pak = ResourceBundle::GetSharedInstance(). 2414 base::FilePath locale_pak = ResourceBundle::GetSharedInstance().
2415 GetLocaleFilePath(locale, false); 2415 GetLocaleFilePath(locale, false);
2416 file.Initialize(locale_pak, flags); 2416 file.Initialize(locale_pak, flags);
2417 DCHECK(file.IsValid()); 2417 DCHECK(file.IsValid());
2418 mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, 2418 mappings->Transfer(kAndroidLocalePakDescriptor,
2419 FileDescriptor(file.Pass()))); 2419 ScopedFD(file.TakePlatformFile()));
2420 2420
2421 base::FilePath resources_pack_path; 2421 base::FilePath resources_pack_path;
2422 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); 2422 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path);
2423 file.Initialize(resources_pack_path, flags); 2423 file.Initialize(resources_pack_path, flags);
2424 DCHECK(file.IsValid()); 2424 DCHECK(file.IsValid());
2425 mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, 2425 mappings->Transfer(kAndroidUIResourcesPakDescriptor,
2426 FileDescriptor(file.Pass()))); 2426 ScopedFD(file.TakePlatformFile()));
2427 2427
2428 if (breakpad::IsCrashReporterEnabled()) { 2428 if (breakpad::IsCrashReporterEnabled()) {
2429 file = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( 2429 file = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile(
2430 child_process_id); 2430 child_process_id);
2431 if (file.IsValid()) { 2431 if (file.IsValid()) {
2432 mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor, 2432 mappings->Transfer(kAndroidMinidumpDescriptor,
2433 FileDescriptor(file.Pass()))); 2433 ScopedFD(file.TakePlatformFile()));
2434 } else { 2434 } else {
2435 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " 2435 LOG(ERROR) << "Failed to create file for minidump, crash reporting will "
2436 "be disabled for this process."; 2436 "be disabled for this process.";
2437 } 2437 }
2438 } 2438 }
2439 2439
2440 base::FilePath app_data_path; 2440 base::FilePath app_data_path;
2441 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path); 2441 PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path);
2442 DCHECK(!app_data_path.empty()); 2442 DCHECK(!app_data_path.empty());
2443 2443
2444 flags = base::File::FLAG_OPEN | base::File::FLAG_READ; 2444 flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
2445 base::FilePath icudata_path = 2445 base::FilePath icudata_path =
2446 app_data_path.AppendASCII("icudtl.dat"); 2446 app_data_path.AppendASCII("icudtl.dat");
2447 base::File icudata_file(icudata_path, flags); 2447 base::File icudata_file(icudata_path, flags);
2448 DCHECK(icudata_file.IsValid()); 2448 DCHECK(icudata_file.IsValid());
2449 mappings->push_back(FileDescriptorInfo(kAndroidICUDataDescriptor, 2449 mappings->Transfer(kAndroidICUDataDescriptor,
2450 FileDescriptor(icudata_file.Pass()))); 2450 ScopedFD(icudata_file.TakePlatformFile()));
2451 2451
2452 #else 2452 #else
2453 int crash_signal_fd = GetCrashSignalFD(command_line); 2453 int crash_signal_fd = GetCrashSignalFD(command_line);
2454 if (crash_signal_fd >= 0) { 2454 if (crash_signal_fd >= 0) {
2455 mappings->push_back(FileDescriptorInfo(kCrashDumpSignal, 2455 mappings->Share(kCrashDumpSignal, crash_signal_fd);
2456 FileDescriptor(crash_signal_fd,
2457 false)));
2458 } 2456 }
2459 #endif // defined(OS_ANDROID) 2457 #endif // defined(OS_ANDROID)
2460 } 2458 }
2461 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 2459 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
2462 2460
2463 #if defined(OS_WIN) 2461 #if defined(OS_WIN)
2464 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { 2462 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() {
2465 return chrome::kBrowserResourcesDll; 2463 return chrome::kBrowserResourcesDll;
2466 } 2464 }
2467 2465
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 switches::kDisableWebRtcEncryption, 2591 switches::kDisableWebRtcEncryption,
2594 }; 2592 };
2595 to_command_line->CopySwitchesFrom(from_command_line, 2593 to_command_line->CopySwitchesFrom(from_command_line,
2596 kWebRtcDevSwitchNames, 2594 kWebRtcDevSwitchNames,
2597 arraysize(kWebRtcDevSwitchNames)); 2595 arraysize(kWebRtcDevSwitchNames));
2598 } 2596 }
2599 } 2597 }
2600 #endif // defined(ENABLE_WEBRTC) 2598 #endif // defined(ENABLE_WEBRTC)
2601 2599
2602 } // namespace chrome 2600 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698