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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); | 734 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); |
735 } | 735 } |
736 if (command_line.HasSwitch(switches::kV8SnapshotPassedByFD)) { | 736 if (command_line.HasSwitch(switches::kV8SnapshotPassedByFD)) { |
737 g_fds->Set( | 737 g_fds->Set( |
738 kV8SnapshotDataDescriptor, | 738 kV8SnapshotDataDescriptor, |
739 kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); | 739 kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); |
740 } | 740 } |
741 #endif // !OS_ANDROID | 741 #endif // !OS_ANDROID |
742 int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor); | 742 int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor); |
743 int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor); | 743 int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor); |
744 if (v8_natives_fd != -1 && v8_snapshot_fd != -1) { | 744 if (v8_snapshot_fd != -1) { |
| 745 auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor); |
| 746 gin::V8Initializer::LoadV8SnapshotFromFD( |
| 747 v8_snapshot_fd, v8_snapshot_region.offset, v8_snapshot_region.size); |
| 748 } else { |
| 749 gin::V8Initializer::LoadV8Snapshot(); |
| 750 } |
| 751 if (v8_natives_fd != -1) { |
745 auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor); | 752 auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor); |
746 auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor); | 753 gin::V8Initializer::LoadV8NativesFromFD( |
747 CHECK(gin::V8Initializer::LoadV8SnapshotFromFD( | 754 v8_natives_fd, v8_natives_region.offset, v8_natives_region.size); |
748 v8_natives_fd, v8_natives_region.offset, v8_natives_region.size, | |
749 v8_snapshot_fd, v8_snapshot_region.offset, v8_snapshot_region.size)); | |
750 } else { | 755 } else { |
751 CHECK(gin::V8Initializer::LoadV8Snapshot()); | 756 gin::V8Initializer::LoadV8Natives(); |
752 } | 757 } |
753 #else | 758 #else |
754 CHECK(gin::V8Initializer::LoadV8Snapshot()); | 759 gin::V8Initializer::LoadV8Snapshot(); |
| 760 gin::V8Initializer::LoadV8Natives(); |
755 #endif // OS_POSIX && !OS_MACOSX | 761 #endif // OS_POSIX && !OS_MACOSX |
756 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 762 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
757 | 763 |
758 if (delegate_) | 764 if (delegate_) |
759 delegate_->PreSandboxStartup(); | 765 delegate_->PreSandboxStartup(); |
760 | 766 |
761 if (!process_type.empty()) | 767 if (!process_type.empty()) |
762 CommonSubprocessInit(process_type); | 768 CommonSubprocessInit(process_type); |
763 | 769 |
764 #if defined(OS_WIN) | 770 #if defined(OS_WIN) |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 | 866 |
861 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 867 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
862 }; | 868 }; |
863 | 869 |
864 // static | 870 // static |
865 ContentMainRunner* ContentMainRunner::Create() { | 871 ContentMainRunner* ContentMainRunner::Create() { |
866 return new ContentMainRunnerImpl(); | 872 return new ContentMainRunnerImpl(); |
867 } | 873 } |
868 | 874 |
869 } // namespace content | 875 } // namespace content |
OLD | NEW |