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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 #include "content/public/app/content_main.h" | 47 #include "content/public/app/content_main.h" |
48 #include "content/public/app/content_main_delegate.h" | 48 #include "content/public/app/content_main_delegate.h" |
49 #include "content/public/common/content_client.h" | 49 #include "content/public/common/content_client.h" |
50 #include "content/public/common/content_constants.h" | 50 #include "content/public/common/content_constants.h" |
51 #include "content/public/common/content_descriptor_keys.h" | 51 #include "content/public/common/content_descriptor_keys.h" |
52 #include "content/public/common/content_features.h" | 52 #include "content/public/common/content_features.h" |
53 #include "content/public/common/content_paths.h" | 53 #include "content/public/common/content_paths.h" |
54 #include "content/public/common/content_switches.h" | 54 #include "content/public/common/content_switches.h" |
55 #include "content/public/common/main_function_params.h" | 55 #include "content/public/common/main_function_params.h" |
56 #include "content/public/common/sandbox_init.h" | 56 #include "content/public/common/sandbox_init.h" |
57 #include "gin/v8_initializer.h" | |
57 #include "ipc/ipc_descriptors.h" | 58 #include "ipc/ipc_descriptors.h" |
58 #include "media/base/media.h" | 59 #include "media/base/media.h" |
59 #include "ppapi/features/features.h" | 60 #include "ppapi/features/features.h" |
60 #include "services/service_manager/embedder/switches.h" | 61 #include "services/service_manager/embedder/switches.h" |
61 #include "ui/base/ui_base_paths.h" | 62 #include "ui/base/ui_base_paths.h" |
62 #include "ui/base/ui_base_switches.h" | 63 #include "ui/base/ui_base_switches.h" |
63 | 64 |
64 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) && \ | |
65 !defined(CHROME_MULTIPLE_DLL_BROWSER) | |
66 #include "gin/v8_initializer.h" | |
67 #endif | |
68 | |
69 #if defined(OS_WIN) | 65 #if defined(OS_WIN) |
70 #include <malloc.h> | 66 #include <malloc.h> |
71 #include <cstring> | 67 #include <cstring> |
72 | 68 |
73 #include "base/trace_event/trace_event_etw_export_win.h" | 69 #include "base/trace_event/trace_event_etw_export_win.h" |
74 #include "sandbox/win/src/sandbox_types.h" | 70 #include "sandbox/win/src/sandbox_types.h" |
75 #include "ui/display/win/dpi.h" | 71 #include "ui/display/win/dpi.h" |
76 #elif defined(OS_MACOSX) | 72 #elif defined(OS_MACOSX) |
77 #include "base/mac/scoped_nsautorelease_pool.h" | 73 #include "base/mac/scoped_nsautorelease_pool.h" |
78 #include "base/power_monitor/power_monitor_device_source.h" | 74 #include "base/power_monitor/power_monitor_device_source.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 feature_list.get()); | 177 feature_list.get()); |
182 base::FeatureList::SetInstance(std::move(feature_list)); | 178 base::FeatureList::SetInstance(std::move(feature_list)); |
183 } | 179 } |
184 | 180 |
185 void InitializeV8IfNeeded( | 181 void InitializeV8IfNeeded( |
186 const base::CommandLine& command_line, | 182 const base::CommandLine& command_line, |
187 const std::string& process_type) { | 183 const std::string& process_type) { |
188 if (process_type == switches::kGpuProcess) | 184 if (process_type == switches::kGpuProcess) |
189 return; | 185 return; |
190 | 186 |
191 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | |
192 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 187 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
193 base::FileDescriptorStore& file_descriptor_store = | 188 base::FileDescriptorStore& file_descriptor_store = |
194 base::FileDescriptorStore::GetInstance(); | 189 base::FileDescriptorStore::GetInstance(); |
195 base::MemoryMappedFile::Region region; | 190 base::MemoryMappedFile::Region region; |
191 #endif | |
192 | |
193 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | |
194 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
196 base::ScopedFD v8_snapshot_fd = | 195 base::ScopedFD v8_snapshot_fd = |
197 file_descriptor_store.MaybeTakeFD(kV8SnapshotDataDescriptor, ®ion); | 196 file_descriptor_store.MaybeTakeFD(kV8SnapshotDataDescriptor, ®ion); |
198 if (v8_snapshot_fd.is_valid()) { | 197 if (v8_snapshot_fd.is_valid()) { |
199 gin::V8Initializer::LoadV8SnapshotFromFD(v8_snapshot_fd.get(), | 198 gin::V8Initializer::LoadV8SnapshotFromFD(v8_snapshot_fd.get(), |
200 region.offset, region.size); | 199 region.offset, region.size); |
201 } else { | 200 } else { |
202 gin::V8Initializer::LoadV8Snapshot(); | 201 gin::V8Initializer::LoadV8Snapshot(); |
203 } | 202 } |
204 base::ScopedFD v8_natives_fd = | 203 base::ScopedFD v8_natives_fd = |
205 file_descriptor_store.MaybeTakeFD(kV8NativesDataDescriptor, ®ion); | 204 file_descriptor_store.MaybeTakeFD(kV8NativesDataDescriptor, ®ion); |
206 if (v8_natives_fd.is_valid()) { | 205 if (v8_natives_fd.is_valid()) { |
207 gin::V8Initializer::LoadV8NativesFromFD(v8_natives_fd.get(), | 206 gin::V8Initializer::LoadV8NativesFromFD(v8_natives_fd.get(), region.offset, |
208 region.offset, region.size); | 207 region.size); |
209 } else { | 208 } else { |
210 gin::V8Initializer::LoadV8Natives(); | 209 gin::V8Initializer::LoadV8Natives(); |
211 } | 210 } |
212 #else | 211 #else |
213 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | 212 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) |
214 gin::V8Initializer::LoadV8Snapshot(); | 213 gin::V8Initializer::LoadV8Snapshot(); |
215 gin::V8Initializer::LoadV8Natives(); | 214 gin::V8Initializer::LoadV8Natives(); |
216 #endif // !CHROME_MULTIPLE_DLL_BROWSER | 215 #endif // !CHROME_MULTIPLE_DLL_BROWSER |
217 #endif // OS_POSIX && !OS_MACOSX | 216 #endif // OS_POSIX && !OS_MACOSX |
218 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 217 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
218 | |
219 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
220 base::ScopedFD v8_context_fd = | |
221 file_descriptor_store.MaybeTakeFD(kV8ContextDataDescriptor, ®ion); | |
222 if (v8_context_fd.is_valid()) { | |
223 gin::V8Initializer::LoadV8ContextFromFD(v8_context_fd.get(), region.offset, | |
224 region.size); | |
225 } else { | |
226 gin::V8Initializer::LoadV8Context(); | |
227 } | |
228 #elif !defined(CHROME_MULTIPLE_DLL_BROWSER) | |
Yuki
2017/05/30 14:35:56
Why is this not |#else|?
Is it okay to not run Loa
peria
2017/06/20 10:20:14
it seems we can't use V8initializer on MULTIPLE_DL
| |
229 gin::V8Initializer::LoadV8Context(); | |
230 #endif // OS | |
219 } | 231 } |
220 | 232 |
221 } // namespace | 233 } // namespace |
222 | 234 |
223 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 235 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
224 base::LazyInstance<ContentBrowserClient>::DestructorAtExit | 236 base::LazyInstance<ContentBrowserClient>::DestructorAtExit |
225 g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER; | 237 g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER; |
226 #endif // !CHROME_MULTIPLE_DLL_CHILD | 238 #endif // !CHROME_MULTIPLE_DLL_CHILD |
227 | 239 |
228 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | 240 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
761 | 773 |
762 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 774 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
763 }; | 775 }; |
764 | 776 |
765 // static | 777 // static |
766 ContentMainRunner* ContentMainRunner::Create() { | 778 ContentMainRunner* ContentMainRunner::Create() { |
767 return new ContentMainRunnerImpl(); | 779 return new ContentMainRunnerImpl(); |
768 } | 780 } |
769 | 781 |
770 } // namespace content | 782 } // namespace content |
OLD | NEW |