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

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

Issue 1019483002: Add support to extension_shell and ash_shell to use external V8 snapshot files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove gyp changes Created 5 years, 9 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 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_snapshot_fd_.get() == -1 && v8_natives_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::MapV8FilesForChildProcesses(&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 }
2429 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); 2421 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get());
2430 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); 2422 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get());
2431 #endif // V8_USE_EXTERNAL_STARTUP_DATA 2423 #endif // V8_USE_EXTERNAL_STARTUP_DATA
2432 2424
2433 #if defined(OS_ANDROID) 2425 #if defined(OS_ANDROID)
2434 base::FilePath data_path; 2426 base::FilePath data_path;
2435 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); 2427 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path);
2436 DCHECK(!data_path.empty()); 2428 DCHECK(!data_path.empty());
2437 2429
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 switches::kDisableWebRtcEncryption, 2632 switches::kDisableWebRtcEncryption,
2641 }; 2633 };
2642 to_command_line->CopySwitchesFrom(from_command_line, 2634 to_command_line->CopySwitchesFrom(from_command_line,
2643 kWebRtcDevSwitchNames, 2635 kWebRtcDevSwitchNames,
2644 arraysize(kWebRtcDevSwitchNames)); 2636 arraysize(kWebRtcDevSwitchNames));
2645 } 2637 }
2646 } 2638 }
2647 #endif // defined(ENABLE_WEBRTC) 2639 #endif // defined(ENABLE_WEBRTC)
2648 2640
2649 } // namespace chrome 2641 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698