Chromium Code Reviews| 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 "ui/base/ui_base_paths.h" | 61 #include "ui/base/ui_base_paths.h" |
| 61 #include "ui/base/ui_base_switches.h" | 62 #include "ui/base/ui_base_switches.h" |
| 62 | 63 |
| 63 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) && \ | |
| 64 !defined(CHROME_MULTIPLE_DLL_BROWSER) | |
| 65 #include "gin/v8_initializer.h" | |
| 66 #endif | |
| 67 | |
| 68 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
| 69 #include <malloc.h> | 65 #include <malloc.h> |
| 70 #include <cstring> | 66 #include <cstring> |
| 71 | 67 |
| 72 #include "base/trace_event/trace_event_etw_export_win.h" | 68 #include "base/trace_event/trace_event_etw_export_win.h" |
| 73 #include "sandbox/win/src/sandbox_types.h" | 69 #include "sandbox/win/src/sandbox_types.h" |
| 74 #include "ui/display/win/dpi.h" | 70 #include "ui/display/win/dpi.h" |
| 75 #elif defined(OS_MACOSX) | 71 #elif defined(OS_MACOSX) |
| 76 #include "base/mac/scoped_nsautorelease_pool.h" | 72 #include "base/mac/scoped_nsautorelease_pool.h" |
| 77 #include "base/power_monitor/power_monitor_device_source.h" | 73 #include "base/power_monitor/power_monitor_device_source.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 feature_list.get()); | 176 feature_list.get()); |
| 181 base::FeatureList::SetInstance(std::move(feature_list)); | 177 base::FeatureList::SetInstance(std::move(feature_list)); |
| 182 } | 178 } |
| 183 | 179 |
| 184 void InitializeV8IfNeeded( | 180 void InitializeV8IfNeeded( |
| 185 const base::CommandLine& command_line, | 181 const base::CommandLine& command_line, |
| 186 const std::string& process_type) { | 182 const std::string& process_type) { |
| 187 if (process_type == switches::kGpuProcess) | 183 if (process_type == switches::kGpuProcess) |
| 188 return; | 184 return; |
| 189 | 185 |
| 190 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | |
| 191 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 186 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 192 base::FileDescriptorStore& file_descriptor_store = | 187 base::FileDescriptorStore& file_descriptor_store = |
| 193 base::FileDescriptorStore::GetInstance(); | 188 base::FileDescriptorStore::GetInstance(); |
| 194 base::MemoryMappedFile::Region region; | 189 base::MemoryMappedFile::Region region; |
| 190 #endif | |
| 191 | |
| 192 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | |
| 193 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
| 195 base::ScopedFD v8_snapshot_fd = | 194 base::ScopedFD v8_snapshot_fd = |
| 196 file_descriptor_store.MaybeTakeFD(kV8SnapshotDataDescriptor, ®ion); | 195 file_descriptor_store.MaybeTakeFD(kV8SnapshotDataDescriptor, ®ion); |
| 197 if (v8_snapshot_fd.is_valid()) { | 196 if (v8_snapshot_fd.is_valid()) { |
| 198 gin::V8Initializer::LoadV8SnapshotFromFD(v8_snapshot_fd.get(), | 197 gin::V8Initializer::LoadV8SnapshotFromFD(v8_snapshot_fd.get(), |
| 199 region.offset, region.size); | 198 region.offset, region.size); |
| 200 } else { | 199 } else { |
| 201 gin::V8Initializer::LoadV8Snapshot(); | 200 gin::V8Initializer::LoadV8Snapshot(); |
| 202 } | 201 } |
| 203 base::ScopedFD v8_natives_fd = | 202 base::ScopedFD v8_natives_fd = |
| 204 file_descriptor_store.MaybeTakeFD(kV8NativesDataDescriptor, ®ion); | 203 file_descriptor_store.MaybeTakeFD(kV8NativesDataDescriptor, ®ion); |
| 205 if (v8_natives_fd.is_valid()) { | 204 if (v8_natives_fd.is_valid()) { |
| 206 gin::V8Initializer::LoadV8NativesFromFD(v8_natives_fd.get(), | 205 gin::V8Initializer::LoadV8NativesFromFD(v8_natives_fd.get(), region.offset, |
| 207 region.offset, region.size); | 206 region.size); |
| 208 } else { | 207 } else { |
| 209 gin::V8Initializer::LoadV8Natives(); | 208 gin::V8Initializer::LoadV8Natives(); |
| 210 } | 209 } |
| 211 #else | 210 #else |
| 212 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | 211 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 213 gin::V8Initializer::LoadV8Snapshot(); | 212 gin::V8Initializer::LoadV8Snapshot(); |
| 214 gin::V8Initializer::LoadV8Natives(); | 213 gin::V8Initializer::LoadV8Natives(); |
| 215 #endif // !CHROME_MULTIPLE_DLL_BROWSER | 214 #endif // !CHROME_MULTIPLE_DLL_BROWSER |
| 216 #endif // OS_POSIX && !OS_MACOSX | 215 #endif // OS_POSIX && !OS_MACOSX |
| 217 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 216 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
| 217 | |
| 218 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
| 219 base::ScopedFD v8_context_fd = | |
| 220 file_descriptor_store.MaybeTakeFD(kV8ContextDataDescriptor, ®ion); | |
|
Yuki
2017/04/28 13:48:27
Here and there, you seem calling "a snapshot of V8
peria
2017/06/01 08:33:30
Done.
| |
| 221 if (v8_context_fd.is_valid()) { | |
| 222 gin::V8Initializer::LoadV8ContextFromFD(v8_context_fd.get(), region.offset, | |
|
Yuki
2017/04/28 13:48:27
LoadV8ContextSnapshotFromFD?
peria
2017/06/01 08:33:31
Done.
| |
| 223 region.size); | |
| 224 } else { | |
| 225 gin::V8Initializer::LoadV8Context(); | |
| 226 } | |
| 227 #elif !defined(CHROME_MULTIPLE_DLL_BROWSER) | |
| 228 gin::V8Initializer::LoadV8Context(); | |
| 229 #endif // OS | |
| 218 } | 230 } |
| 219 | 231 |
| 220 } // namespace | 232 } // namespace |
| 221 | 233 |
| 222 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 234 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
| 223 base::LazyInstance<ContentBrowserClient>::DestructorAtExit | 235 base::LazyInstance<ContentBrowserClient>::DestructorAtExit |
| 224 g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER; | 236 g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER; |
| 225 #endif // !CHROME_MULTIPLE_DLL_CHILD | 237 #endif // !CHROME_MULTIPLE_DLL_CHILD |
| 226 | 238 |
| 227 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | 239 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 759 | 771 |
| 760 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 772 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 761 }; | 773 }; |
| 762 | 774 |
| 763 // static | 775 // static |
| 764 ContentMainRunner* ContentMainRunner::Create() { | 776 ContentMainRunner* ContentMainRunner::Create() { |
| 765 return new ContentMainRunnerImpl(); | 777 return new ContentMainRunnerImpl(); |
| 766 } | 778 } |
| 767 | 779 |
| 768 } // namespace content | 780 } // namespace content |
| OLD | NEW |