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 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2402 browser_context, storage_partition_path, additional_backends); | 2402 browser_context, storage_partition_path, additional_backends); |
2403 } | 2403 } |
2404 } | 2404 } |
2405 | 2405 |
2406 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 2406 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
2407 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 2407 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
2408 const base::CommandLine& command_line, | 2408 const base::CommandLine& command_line, |
2409 int child_process_id, | 2409 int child_process_id, |
2410 FileDescriptorInfo* mappings) { | 2410 FileDescriptorInfo* mappings) { |
2411 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 2411 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
2412 if (v8_snapshot_fd_.get() == -1 && v8_natives_fd_.get() == -1) { | 2412 if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) { |
2413 base::FilePath v8_data_path; | 2413 int v8_natives_fd = -1; |
2414 PathService::Get(gin::IsolateHolder::kV8SnapshotBasePathKey, &v8_data_path); | 2414 int v8_snapshot_fd = -1; |
2415 DCHECK(!v8_data_path.empty()); | 2415 if (gin::IsolateHolder::OpenV8FilesForChildProcesses(&v8_natives_fd, |
2416 | 2416 &v8_snapshot_fd)) { |
2417 int file_flags = base::File::FLAG_OPEN | base::File::FLAG_READ; | 2417 v8_natives_fd_.reset(v8_natives_fd); |
2418 base::FilePath v8_natives_data_path = | 2418 v8_snapshot_fd_.reset(v8_snapshot_fd); |
2419 v8_data_path.AppendASCII(gin::IsolateHolder::kNativesFileName); | 2419 } |
2420 base::FilePath v8_snapshot_data_path = | |
2421 v8_data_path.AppendASCII(gin::IsolateHolder::kSnapshotFileName); | |
2422 base::File v8_natives_data_file(v8_natives_data_path, file_flags); | |
2423 base::File v8_snapshot_data_file(v8_snapshot_data_path, file_flags); | |
2424 DCHECK(v8_natives_data_file.IsValid()); | |
2425 DCHECK(v8_snapshot_data_file.IsValid()); | |
2426 v8_natives_fd_.reset(v8_natives_data_file.TakePlatformFile()); | |
2427 v8_snapshot_fd_.reset(v8_snapshot_data_file.TakePlatformFile()); | |
2428 } | 2420 } |
| 2421 DCHECK(v8_natives_fd_.get() != -1 && v8_snapshot_fd_.get() != -1); |
2429 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); | 2422 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); |
2430 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); | 2423 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); |
2431 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 2424 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
2432 | 2425 |
2433 #if defined(OS_ANDROID) | 2426 #if defined(OS_ANDROID) |
2434 base::FilePath data_path; | 2427 base::FilePath data_path; |
2435 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); | 2428 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); |
2436 DCHECK(!data_path.empty()); | 2429 DCHECK(!data_path.empty()); |
2437 | 2430 |
2438 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; | 2431 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 switches::kDisableWebRtcEncryption, | 2633 switches::kDisableWebRtcEncryption, |
2641 }; | 2634 }; |
2642 to_command_line->CopySwitchesFrom(from_command_line, | 2635 to_command_line->CopySwitchesFrom(from_command_line, |
2643 kWebRtcDevSwitchNames, | 2636 kWebRtcDevSwitchNames, |
2644 arraysize(kWebRtcDevSwitchNames)); | 2637 arraysize(kWebRtcDevSwitchNames)); |
2645 } | 2638 } |
2646 } | 2639 } |
2647 #endif // defined(ENABLE_WEBRTC) | 2640 #endif // defined(ENABLE_WEBRTC) |
2648 | 2641 |
2649 } // namespace chrome | 2642 } // namespace chrome |
OLD | NEW |