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 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 browser_context, storage_partition_path, additional_backends); | 2176 browser_context, storage_partition_path, additional_backends); |
2177 } | 2177 } |
2178 } | 2178 } |
2179 | 2179 |
2180 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 2180 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
2181 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 2181 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
2182 const base::CommandLine& command_line, | 2182 const base::CommandLine& command_line, |
2183 int child_process_id, | 2183 int child_process_id, |
2184 FileDescriptorInfo* mappings) { | 2184 FileDescriptorInfo* mappings) { |
2185 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 2185 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
2186 if (v8_snapshot_fd_.get() == -1 && v8_natives_fd_.get() == -1) { | 2186 if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) { |
2187 base::FilePath v8_data_path; | 2187 int v8_natives_fd = -1; |
2188 PathService::Get(gin::V8Initializer::kV8SnapshotBasePathKey, &v8_data_path); | 2188 int v8_snapshot_fd = -1; |
2189 DCHECK(!v8_data_path.empty()); | 2189 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd, |
2190 | 2190 &v8_snapshot_fd)) { |
2191 int file_flags = base::File::FLAG_OPEN | base::File::FLAG_READ; | 2191 v8_natives_fd_.reset(v8_natives_fd); |
2192 base::FilePath v8_natives_data_path = | 2192 v8_snapshot_fd_.reset(v8_snapshot_fd); |
2193 v8_data_path.AppendASCII(gin::V8Initializer::kNativesFileName); | 2193 } |
2194 base::FilePath v8_snapshot_data_path = | |
2195 v8_data_path.AppendASCII(gin::V8Initializer::kSnapshotFileName); | |
2196 base::File v8_natives_data_file(v8_natives_data_path, file_flags); | |
2197 base::File v8_snapshot_data_file(v8_snapshot_data_path, file_flags); | |
2198 DCHECK(v8_natives_data_file.IsValid()); | |
2199 DCHECK(v8_snapshot_data_file.IsValid()); | |
2200 v8_natives_fd_.reset(v8_natives_data_file.TakePlatformFile()); | |
2201 v8_snapshot_fd_.reset(v8_snapshot_data_file.TakePlatformFile()); | |
2202 } | 2194 } |
| 2195 DCHECK(v8_natives_fd_.get() != -1 && v8_snapshot_fd_.get() != -1); |
2203 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); | 2196 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); |
2204 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); | 2197 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); |
2205 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 2198 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
2206 | 2199 |
2207 #if defined(OS_ANDROID) | 2200 #if defined(OS_ANDROID) |
2208 base::FilePath data_path; | 2201 base::FilePath data_path; |
2209 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); | 2202 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); |
2210 DCHECK(!data_path.empty()); | 2203 DCHECK(!data_path.empty()); |
2211 | 2204 |
2212 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; | 2205 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 switches::kDisableWebRtcEncryption, | 2407 switches::kDisableWebRtcEncryption, |
2415 }; | 2408 }; |
2416 to_command_line->CopySwitchesFrom(from_command_line, | 2409 to_command_line->CopySwitchesFrom(from_command_line, |
2417 kWebRtcDevSwitchNames, | 2410 kWebRtcDevSwitchNames, |
2418 arraysize(kWebRtcDevSwitchNames)); | 2411 arraysize(kWebRtcDevSwitchNames)); |
2419 } | 2412 } |
2420 } | 2413 } |
2421 #endif // defined(ENABLE_WEBRTC) | 2414 #endif // defined(ENABLE_WEBRTC) |
2422 | 2415 |
2423 } // namespace chrome | 2416 } // namespace chrome |
OLD | NEW |