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 "content/public/app/content_main_runner.h" | 5 #include "content/public/app/content_main_runner.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 } else { | 693 } else { |
694 CHECK(base::i18n::InitializeICU()); | 694 CHECK(base::i18n::InitializeICU()); |
695 } | 695 } |
696 #else | 696 #else |
697 CHECK(base::i18n::InitializeICU()); | 697 CHECK(base::i18n::InitializeICU()); |
698 #endif // OS_ANDROID | 698 #endif // OS_ANDROID |
699 | 699 |
700 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 700 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
701 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 701 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
702 #if !defined(OS_ANDROID) | 702 #if !defined(OS_ANDROID) |
703 // kV8NativesDataDescriptor and kV8SnapshotDataDescriptor are shared with | 703 // kV8NativesDataDescriptor and kV8SnapshotDataDescriptor could be shared |
704 // child processes. On Android they are set in | 704 // with child processes via file descriptors. On Android they are set in |
705 // ChildProcessService::InternalInitChildProcess, otherwise set them here. | 705 // ChildProcessService::InternalInitChildProcess, otherwise set them here. |
706 if (!process_type.empty() && process_type != switches::kZygoteProcess | 706 if (command_line.HasSwitch(switches::kV8NativesPassedByFD)) { |
707 && process_type != "service") { | |
708 g_fds->Set( | 707 g_fds->Set( |
709 kV8NativesDataDescriptor, | 708 kV8NativesDataDescriptor, |
710 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); | 709 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); |
| 710 } |
| 711 if (command_line.HasSwitch(switches::kV8SnapshotPassedByFD)) { |
711 g_fds->Set( | 712 g_fds->Set( |
712 kV8SnapshotDataDescriptor, | 713 kV8SnapshotDataDescriptor, |
713 kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); | 714 kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); |
714 } | 715 } |
715 #endif // !OS_ANDROID | 716 #endif // !OS_ANDROID |
716 int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor); | 717 int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor); |
717 int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor); | 718 int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor); |
718 if (v8_natives_fd != -1 && v8_snapshot_fd != -1) { | 719 if (v8_natives_fd != -1 && v8_snapshot_fd != -1) { |
719 auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor); | 720 auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor); |
720 auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor); | 721 auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 | 835 |
835 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 836 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
836 }; | 837 }; |
837 | 838 |
838 // static | 839 // static |
839 ContentMainRunner* ContentMainRunner::Create() { | 840 ContentMainRunner* ContentMainRunner::Create() { |
840 return new ContentMainRunnerImpl(); | 841 return new ContentMainRunnerImpl(); |
841 } | 842 } |
842 | 843 |
843 } // namespace content | 844 } // namespace content |
OLD | NEW |